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 class
AmqpMessageSource.AmqpAckCallback
static class
AmqpMessageSource.AmqpAckCallbackFactory
static class
AmqpMessageSource.AmqpAckInfo
Information 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, logger
Fields 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 BatchingStrategy
getBatchingStrategy()
String
getComponentType()
protected AmqpHeaderMapper
getHeaderMapper()
protected MessageConverter
getMessageConverter()
protected MessagePropertiesConverter
getPropertiesConverter()
protected boolean
isRawMessageHeader()
protected boolean
isTransacted()
void
setBatchingStrategy(BatchingStrategy batchingStrategy)
Set a batching strategy to use when de-batching messages.void
setHeaderMapper(AmqpHeaderMapper headerMapper)
Set a customAmqpHeaderMapper
to replace the defaultDefaultAmqpHeaderMapper.inboundMapper()
.void
setMessageConverter(MessageConverter messageConverter)
Set a customMessageConverter
to replace the defaultSimpleMessageConverter
.void
setPropertiesConverter(MessagePropertiesConverter propertiesConverter)
Set a customMessagePropertiesConverter
to replace the defaultDefaultMessagePropertiesConverter
.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.void
setTransacted(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, setManagedType
Methods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, onInit, setBeanFactory, setConversionService
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs
Methods 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 customMessagePropertiesConverter
to replace the defaultDefaultMessagePropertiesConverter
.- Parameters:
propertiesConverter
- the converter.
-
getHeaderMapper
-
setHeaderMapper
Set a customAmqpHeaderMapper
to replace the defaultDefaultAmqpHeaderMapper.inboundMapper()
.- Parameters:
headerMapper
- the header mapper.
-
getMessageConverter
-
setMessageConverter
Set a customMessageConverter
to 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:AbstractMessageSource
Subclasses must implement this method. Typically the returned value will be thepayload
of type T, but the returned value may also be aMessage
instance whose payload is of type T; also can beAbstractIntegrationMessageBuilder
which is used for additional headers population.- Specified by:
doReceive
in classAbstractMessageSource<Object>
- Returns:
- The value returned.
-