Class AmqpMessageSource
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<Object>
org.springframework.integration.amqp.inbound.AmqpMessageSource
- All Implemented Interfaces:
Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,MessageSource<Object>,IntegrationPattern,NamedComponent,IntegrationInboundManagement,IntegrationManagement
public class AmqpMessageSource extends AbstractMessageSource<Object>
A pollable
MessageSource for RabbitMQ.- Since:
- 5.0.1
- Author:
- Gary Russell
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAmqpMessageSource.AmqpAckCallbackstatic classAmqpMessageSource.AmqpAckCallbackFactorystatic classAmqpMessageSource.AmqpAckInfoInformation for building an AmqpAckCallback.Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME -
Constructor Summary
Constructors Constructor Description AmqpMessageSource(ConnectionFactory connectionFactory, String queue)AmqpMessageSource(ConnectionFactory connectionFactory, AmqpMessageSource.AmqpAckCallbackFactory ackCallbackFactory, String queue) -
Method Summary
Modifier and Type Method Description protected AbstractIntegrationMessageBuilder<Object>doReceive()Subclasses must implement this method.protected BatchingStrategygetBatchingStrategy()StringgetComponentType()protected AmqpHeaderMappergetHeaderMapper()protected MessageConvertergetMessageConverter()protected MessagePropertiesConvertergetPropertiesConverter()protected booleanisRawMessageHeader()protected booleanisTransacted()voidsetBatchingStrategy(BatchingStrategy batchingStrategy)Set a batching strategy to use when de-batching messages.voidsetHeaderMapper(AmqpHeaderMapper headerMapper)Set a customAmqpHeaderMapperto replace the defaultDefaultAmqpHeaderMapper.inboundMapper().voidsetMessageConverter(MessageConverter messageConverter)Set a customMessageConverterto replace the defaultSimpleMessageConverter.voidsetPropertiesConverter(MessagePropertiesConverter propertiesConverter)Set a customMessagePropertiesConverterto replace the defaultDefaultMessagePropertiesConverter.voidsetRawMessageHeader(boolean rawMessageHeader)Set to true to include the raw spring-amqp message as a header with keyAmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, enabling callers to have access to the message to process errors.voidsetTransacted(boolean transacted)Set to true to use a transacted channel for the ack.Methods inherited from class org.springframework.integration.endpoint.AbstractMessageSource
buildMessage, destroy, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, onInit, setBeanFactory, setConversionServiceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAsMethods inherited from interface org.springframework.integration.core.MessageSource
getIntegrationPatternType
-
Constructor Details
-
AmqpMessageSource
-
AmqpMessageSource
public AmqpMessageSource(ConnectionFactory connectionFactory, AmqpMessageSource.AmqpAckCallbackFactory ackCallbackFactory, String queue)
-
-
Method Details
-
isTransacted
protected boolean isTransacted() -
setTransacted
public void setTransacted(boolean transacted)Set to true to use a transacted channel for the ack.- Parameters:
transacted- true for transacted.
-
getPropertiesConverter
-
setPropertiesConverter
Set a customMessagePropertiesConverterto replace the defaultDefaultMessagePropertiesConverter.- Parameters:
propertiesConverter- the converter.
-
getHeaderMapper
-
setHeaderMapper
Set a customAmqpHeaderMapperto replace the defaultDefaultAmqpHeaderMapper.inboundMapper().- Parameters:
headerMapper- the header mapper.
-
getMessageConverter
-
setMessageConverter
Set a customMessageConverterto replace the defaultSimpleMessageConverter.- Parameters:
messageConverter- the converter.
-
isRawMessageHeader
protected boolean isRawMessageHeader() -
setRawMessageHeader
public void setRawMessageHeader(boolean rawMessageHeader)Set to true to include the raw spring-amqp message as a header with keyAmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE, enabling callers to have access to the message to process errors. The raw message is also added to the common headerIntegrationMessageHeaderAccessor.SOURCE_DATA.- Parameters:
rawMessageHeader- true to include the headers.
-
getBatchingStrategy
-
setBatchingStrategy
Set a batching strategy to use when de-batching messages. Default isSimpleBatchingStrategy.- Parameters:
batchingStrategy- the strategy.- Since:
- 5.2
-
getComponentType
-
doReceive
Description copied from class:AbstractMessageSourceSubclasses must implement this method. Typically the returned value will be thepayloadof type T, but the returned value may also be aMessageinstance whose payload is of type T; also can beAbstractIntegrationMessageBuilderwhich is used for additional headers population.- Specified by:
doReceivein classAbstractMessageSource<Object>- Returns:
- The value returned.
-