Class AmqpMessageSource
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<java.lang.Object>
org.springframework.integration.amqp.inbound.AmqpMessageSource
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.integration.core.MessageSource<java.lang.Object>
,org.springframework.integration.IntegrationPattern
,org.springframework.integration.support.context.NamedComponent
,org.springframework.integration.support.management.IntegrationInboundManagement
,org.springframework.integration.support.management.IntegrationManagement
public class AmqpMessageSource
extends org.springframework.integration.endpoint.AbstractMessageSource<java.lang.Object>
A pollable
MessageSource
for RabbitMQ.- Since:
- 5.0.1
-
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. -
Field Summary
-
Constructor Summary
Constructors Constructor Description AmqpMessageSource(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory, java.lang.String queue)
AmqpMessageSource(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory, AmqpMessageSource.AmqpAckCallbackFactory ackCallbackFactory, java.lang.String queue)
-
Method Summary
Modifier and Type Method Description protected org.springframework.integration.support.AbstractIntegrationMessageBuilder<java.lang.Object>
doReceive()
protected org.springframework.amqp.rabbit.batch.BatchingStrategy
getBatchingStrategy()
java.lang.String
getComponentType()
protected AmqpHeaderMapper
getHeaderMapper()
protected org.springframework.amqp.support.converter.MessageConverter
getMessageConverter()
protected org.springframework.amqp.rabbit.support.MessagePropertiesConverter
getPropertiesConverter()
protected boolean
isRawMessageHeader()
protected boolean
isTransacted()
void
setBatchingStrategy(org.springframework.amqp.rabbit.batch.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(org.springframework.amqp.support.converter.MessageConverter messageConverter)
Set a customMessageConverter
to replace the defaultSimpleMessageConverter
.void
setPropertiesConverter(org.springframework.amqp.rabbit.support.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
-
Constructor Details
-
AmqpMessageSource
public AmqpMessageSource(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory, java.lang.String queue) -
AmqpMessageSource
public AmqpMessageSource(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory, AmqpMessageSource.AmqpAckCallbackFactory ackCallbackFactory, java.lang.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
protected org.springframework.amqp.rabbit.support.MessagePropertiesConverter getPropertiesConverter() -
setPropertiesConverter
public void setPropertiesConverter(org.springframework.amqp.rabbit.support.MessagePropertiesConverter propertiesConverter)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
protected org.springframework.amqp.support.converter.MessageConverter getMessageConverter() -
setMessageConverter
public void setMessageConverter(org.springframework.amqp.support.converter.MessageConverter messageConverter)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
protected org.springframework.amqp.rabbit.batch.BatchingStrategy getBatchingStrategy() -
setBatchingStrategy
public void setBatchingStrategy(org.springframework.amqp.rabbit.batch.BatchingStrategy batchingStrategy)Set a batching strategy to use when de-batching messages. Default isSimpleBatchingStrategy
.- Parameters:
batchingStrategy
- the strategy.- Since:
- 5.2
-
getComponentType
public java.lang.String getComponentType() -
doReceive
protected org.springframework.integration.support.AbstractIntegrationMessageBuilder<java.lang.Object> doReceive()- Specified by:
doReceive
in classorg.springframework.integration.endpoint.AbstractMessageSource<java.lang.Object>
-