org.axonframework.eventhandling.amqp.spring
Class SpringAMQPConsumerConfiguration

java.lang.Object
  extended by org.axonframework.eventhandling.amqp.spring.SpringAMQPConsumerConfiguration
All Implemented Interfaces:
AMQPConsumerConfiguration

public class SpringAMQPConsumerConfiguration
extends Object
implements AMQPConsumerConfiguration

AMQPConsumerConfiguration implementation that has additional support for all Spring-specific AMQP Configuration properties. This bean allows configuration using setters, to make it easier to configure inside an application context configuration file.

Note that this class is not thread-safe and should not be used outside of the Spring Application context.

Since:
2.0
Author:
Allard Buijze

Field Summary
 
Fields inherited from interface org.axonframework.eventhandling.amqp.AMQPConsumerConfiguration
AMQP_CONFIG_PROPERTY
 
Constructor Summary
SpringAMQPConsumerConfiguration()
           
 
Method Summary
 org.springframework.amqp.core.AcknowledgeMode getAcknowledgeMode()
          Returns the AcknowledgeMode configured in this instance, or the one provided by the default configuration if not explicitly provided.
 org.aopalliance.aop.Advice[] getAdviceChain()
          Returns the Advice Chain configured in this instance, or the one provided by the default configuration if not explicitly provided.
 Integer getConcurrentConsumers()
          Returns the Concurrent Consumers configured in this instance, or the one provided by the default configuration if not explicitly provided.
 org.springframework.util.ErrorHandler getErrorHandler()
          Returns the ErrorHandler configured in this instance, or the one provided by the default configuration if not explicitly provided.
 Boolean getExclusive()
          Indicates whether this Cluster wishes to be an exclusive consumer on a Queue.
 org.springframework.amqp.rabbit.support.MessagePropertiesConverter getMessagePropertiesConverter()
          Returns the MessagePropertiesConverter configured in this instance, or the one provided by the default configuration if not explicitly provided.
 Integer getPrefetchCount()
          Returns the Prefetch Count configured in this instance, or the one provided by the default configuration if not explicitly provided.
 String getQueueName()
          Returns the Queue Name the Cluster should be connected to, or null if no explicit cluster is configured.
 Long getReceiveTimeout()
          Returns the Receive Timeout configured in this instance, or the one provided by the default configuration if not explicitly provided.
 Long getRecoveryInterval()
          Returns the Recovery Interval configured in this instance, or the one provided by the default configuration if not explicitly provided.
 Long getShutdownTimeout()
          Returns the Shutdown Timeout configured in this instance, or the one provided by the default configuration if not explicitly provided.
 Executor getTaskExecutor()
          Returns the Task Executor configured in this instance, or the one provided by the default configuration if not explicitly provided.
 org.springframework.transaction.interceptor.TransactionAttribute getTransactionAttribute()
          Returns the TransactionAttribute configured in this instance, or the one provided by the default configuration if not explicitly provided.
 org.springframework.transaction.PlatformTransactionManager getTransactionManager()
          Returns the TransactionManager configured in this instance, or the one provided by the default configuration if not explicitly provided.
 Integer getTxSize()
          Returns the Transaction Size configured in this instance, or the one provided by the default configuration if not explicitly provided.
 void setAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode acknowledgeMode)
          Sets the acknowledge mode to use for the cluster
 void setAdviceChain(org.aopalliance.aop.Advice[] adviceChain)
          Sets the Advice Chain to use for the cluster.
 void setConcurrentConsumers(Integer concurrentConsumers)
          Sets the number of concurrent consumers to use for the cluster
 void setDefaults(SpringAMQPConsumerConfiguration defaults)
          Sets the defaults to use when this instance does not explicitly provide a configuration value.
 void setErrorHandler(org.springframework.util.ErrorHandler errorHandler)
          Sets the Error Handler to use for the cluster.
 void setExclusive(Boolean exclusive)
          Sets whether the listener container created by this factory should be exclusive.
 void setMessagePropertiesConverter(org.springframework.amqp.rabbit.support.MessagePropertiesConverter messagePropertiesConverter)
          Sets the message properties converter to use for the cluster
 void setPrefetchCount(Integer prefetchCount)
          Sets the PrefetchCount to use for the cluster.
 void setQueueName(String queueName)
          Sets the name of the Queue that a Cluster should be connected to.
 void setReceiveTimeout(Long receiveTimeout)
          Sets the receive timeout to use for the cluster
 void setRecoveryInterval(Long recoveryInterval)
          Sets the Recovery Interval to use for the cluster.
 void setShutdownTimeout(Long shutdownTimeout)
          Sets the shutdown timeout to use for the cluster
 void setTaskExecutor(Executor taskExecutor)
          Sets the task executor to use for the cluster
 void setTransactionAttribute(org.springframework.transaction.interceptor.TransactionAttribute transactionAttribute)
          Sets the transaction attribute to use for the cluster
 void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
          Sets the PlatformTransactionManager to use for the cluster.
 void setTxSize(Integer txSize)
          Sets the Transaction Size to use for the cluster.
static SpringAMQPConsumerConfiguration wrap(AMQPConsumerConfiguration configuration)
          Creates a SpringAMQPConsumerConfiguration instance from the given configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringAMQPConsumerConfiguration

public SpringAMQPConsumerConfiguration()
Method Detail

wrap

public static SpringAMQPConsumerConfiguration wrap(AMQPConsumerConfiguration configuration)
Creates a SpringAMQPConsumerConfiguration instance from the given configuration. If tha configuration is already an instance of SpringAMQPConsumerConfiguration, it is returned as is. Otherwise, the properties in the configuration are copied into a fresh instance of SpringAMQPConsumerConfiguration.

Parameters:
configuration - The configuration to wrap in a SpringAMQPConsumerConfiguration
Returns:
a SpringAMQPConsumerConfiguration reflecting given configuration

setDefaults

public void setDefaults(SpringAMQPConsumerConfiguration defaults)
Sets the defaults to use when this instance does not explicitly provide a configuration value. If defaults were already provided, they are all overwritten by the given instance, even if the new instance returns null for some configuration options that the previous defaults did provide a value for.

Parameters:
defaults - The defaults to use

getQueueName

public String getQueueName()
Description copied from interface: AMQPConsumerConfiguration
Returns the Queue Name the Cluster should be connected to, or null if no explicit cluster is configured.

Specified by:
getQueueName in interface AMQPConsumerConfiguration
Returns:
the Queue the cluster should be connected to, or null to revert to a default

getTransactionManager

public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
Returns the TransactionManager configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the TransactionManager configured in this instance, or by the default configuration

getErrorHandler

public org.springframework.util.ErrorHandler getErrorHandler()
Returns the ErrorHandler configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the ErrorHandler configured in this instance, or by the default configuration

getTxSize

public Integer getTxSize()
Returns the Transaction Size configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the Transaction Size configured in this instance, or by the default configuration

getPrefetchCount

public Integer getPrefetchCount()
Returns the Prefetch Count configured in this instance, or the one provided by the default configuration if not explicitly provided.

Specified by:
getPrefetchCount in interface AMQPConsumerConfiguration
Returns:
the Prefetch Count configured in this instance, or by the default configuration

getAdviceChain

public org.aopalliance.aop.Advice[] getAdviceChain()
Returns the Advice Chain configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the Advice Chain configured in this instance, or by the default configuration

getRecoveryInterval

public Long getRecoveryInterval()
Returns the Recovery Interval configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the Recovery Interval configured in this instance, or by the default configuration

getConcurrentConsumers

public Integer getConcurrentConsumers()
Returns the Concurrent Consumers configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the Concurrent Consumers configured in this instance, or by the default configuration

getReceiveTimeout

public Long getReceiveTimeout()
Returns the Receive Timeout configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the Receive Timeout configured in this instance, or by the default configuration

getShutdownTimeout

public Long getShutdownTimeout()
Returns the Shutdown Timeout configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the Shutdown Timeout configured in this instance, or by the default configuration

getTaskExecutor

public Executor getTaskExecutor()
Returns the Task Executor configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the Task Executor configured in this instance, or by the default configuration

getTransactionAttribute

public org.springframework.transaction.interceptor.TransactionAttribute getTransactionAttribute()
Returns the TransactionAttribute configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the TransactionAttribute configured in this instance, or by the default configuration

getMessagePropertiesConverter

public org.springframework.amqp.rabbit.support.MessagePropertiesConverter getMessagePropertiesConverter()
Returns the MessagePropertiesConverter configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the MessagePropertiesConverter configured in this instance, or by the default configuration

getAcknowledgeMode

public org.springframework.amqp.core.AcknowledgeMode getAcknowledgeMode()
Returns the AcknowledgeMode configured in this instance, or the one provided by the default configuration if not explicitly provided.

Returns:
the AcknowledgeMode configured in this instance, or by the default configuration

getExclusive

public Boolean getExclusive()
Description copied from interface: AMQPConsumerConfiguration
Indicates whether this Cluster wishes to be an exclusive consumer on a Queue. null indicated that no explicit preference is provided, and a default should be used.

Specified by:
getExclusive in interface AMQPConsumerConfiguration
Returns:
the exclusivity indicator for this cluster

setQueueName

public void setQueueName(String queueName)
Sets the name of the Queue that a Cluster should be connected to. If it is null, a Queue Name is expected to be provided by the default configuration.

Parameters:
queueName - The queue name to connect the Cluster to

setTransactionManager

public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Sets the PlatformTransactionManager to use for the cluster. Setting the transaction manager will also mark used channels as transacted (see setChannelTransacted()).

Parameters:
transactionManager - The transaction manager to set
See Also:
SimpleMessageListenerContainer.setTransactionManager(org.springframework.transaction.PlatformTransactionManager)

setErrorHandler

public void setErrorHandler(org.springframework.util.ErrorHandler errorHandler)
Sets the Error Handler to use for the cluster.

Parameters:
errorHandler - the Error Handler to set
See Also:
AbstractMessageListenerContainer.setErrorHandler(org.springframework.util.ErrorHandler)

setTxSize

public void setTxSize(Integer txSize)
Sets the Transaction Size to use for the cluster.

Parameters:
txSize - the transaction size to set
See Also:
SimpleMessageListenerContainer.setTxSize(int)

setPrefetchCount

public void setPrefetchCount(Integer prefetchCount)
Sets the PrefetchCount to use for the cluster.

Parameters:
prefetchCount - the prefetch count to set
See Also:
SimpleMessageListenerContainer.setPrefetchCount(int)

setAdviceChain

public void setAdviceChain(org.aopalliance.aop.Advice[] adviceChain)
Sets the Advice Chain to use for the cluster.

Parameters:
adviceChain - the advice chain to set
See Also:
SimpleMessageListenerContainer.setAdviceChain(org.aopalliance.aop.Advice[])

setRecoveryInterval

public void setRecoveryInterval(Long recoveryInterval)
Sets the Recovery Interval to use for the cluster.

Parameters:
recoveryInterval - the recovery interval to set
See Also:
SimpleMessageListenerContainer.setRecoveryInterval(long)

setConcurrentConsumers

public void setConcurrentConsumers(Integer concurrentConsumers)
Sets the number of concurrent consumers to use for the cluster

Parameters:
concurrentConsumers - The number of concurrent consumers
See Also:
SimpleMessageListenerContainer.setConcurrentConsumers(int)

setReceiveTimeout

public void setReceiveTimeout(Long receiveTimeout)
Sets the receive timeout to use for the cluster

Parameters:
receiveTimeout - The receive timeout to set
See Also:
SimpleMessageListenerContainer.setReceiveTimeout(long)

setShutdownTimeout

public void setShutdownTimeout(Long shutdownTimeout)
Sets the shutdown timeout to use for the cluster

Parameters:
shutdownTimeout - The shutdown timeout to set
See Also:
SimpleMessageListenerContainer.setShutdownTimeout(long)

setTaskExecutor

public void setTaskExecutor(Executor taskExecutor)
Sets the task executor to use for the cluster

Parameters:
taskExecutor - The task executor to set
See Also:
SimpleMessageListenerContainer.setTaskExecutor(java.util.concurrent.Executor)

setTransactionAttribute

public void setTransactionAttribute(org.springframework.transaction.interceptor.TransactionAttribute transactionAttribute)
Sets the transaction attribute to use for the cluster

Parameters:
transactionAttribute - The transaction attribute to set
See Also:
SimpleMessageListenerContainer.setTransactionAttribute(org.springframework.transaction.interceptor.TransactionAttribute)

setMessagePropertiesConverter

public void setMessagePropertiesConverter(org.springframework.amqp.rabbit.support.MessagePropertiesConverter messagePropertiesConverter)
Sets the message properties converter to use for the cluster

Parameters:
messagePropertiesConverter - The message properties converter to set
See Also:
SimpleMessageListenerContainer.setMessagePropertiesConverter(org.springframework.amqp.rabbit.support.MessagePropertiesConverter)

setAcknowledgeMode

public void setAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode acknowledgeMode)
Sets the acknowledge mode to use for the cluster

Parameters:
acknowledgeMode - The acknowledge mode to set
See Also:
AbstractMessageListenerContainer.setAcknowledgeMode(org.springframework.amqp.core.AcknowledgeMode)

setExclusive

public void setExclusive(Boolean exclusive)
Sets whether the listener container created by this factory should be exclusive. That means it will not allow other listeners to connect to the same queue. If a non-exclusive listener is already connected to the queue, this listener is rejected.

By default, listeners are exclusive.

Parameters:
exclusive - Whether the created container should be an exclusive listener


Copyright © 2010-2016. All Rights Reserved.