Class AmqpInboundGateway
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.amqp.inbound.AmqpInboundGateway
- All Implemented Interfaces:
- Aware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Lifecycle,- Phased,- SmartLifecycle,- ExpressionCapable,- IntegrationPattern,- NamedComponent,- IntegrationInboundManagement,- IntegrationManagement,- ManageableLifecycle,- ManageableSmartLifecycle,- TrackableComponent
Adapter that receives Messages from an AMQP Queue, converts them into
 Spring Integration Messages, and sends the results to a Message Channel.
 If a reply Message is received, it will be converted and sent back to
 the AMQP 'replyTo'.
- Since:
- 2.1
- Author:
- Mark Fisher, Artem Bilan, Gary Russell
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class org.springframework.integration.gateway.MessagingGatewaySupportMessagingGatewaySupport.ConvertingMessagingTemplateNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.gateway.MessagingGatewaySupportmessagingTemplateFields inherited from class org.springframework.integration.endpoint.AbstractEndpointlifecycleCondition, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionAmqpInboundGateway(AbstractMessageListenerContainer listenerContainer) AmqpInboundGateway(MessageListenerContainer listenerContainer, AmqpTemplate amqpTemplate) ConstructAmqpInboundGatewaybased on the providedMessageListenerContainerto receive request messages andAmqpTemplateto send replies.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voiddoStart()Subclasses must implement this method with the start behavior.protected voiddoStop()Subclasses must implement this method with the stop behavior.Subclasses may implement this method to provide component type information.protected AttributeAccessorgetErrorMessageAttributes(Message<?> message) Populate anAttributeAccessorto be used when building an error message with theerrorMessageStrategy.protected voidonInit()Subclasses may implement this for initialization logic.voidsetBatchingStrategy(BatchingStrategy batchingStrategy) Set a batching strategy to use when de-batching messages.voidsetBindSourceMessage(boolean bindSourceMessage) Set to true to bind the source message in the header namedIntegrationMessageHeaderAccessor.SOURCE_DATA.voidsetDefaultReplyTo(String defaultReplyTo) ThedefaultReplyToaddress with the formvoidsetHeaderMapper(AmqpHeaderMapper headerMapper) voidsetMessageConverter(MessageConverter messageConverter) Specify theMessageConverterto convert request and reply to/fromMessage.voidsetMessageRecoverer(MessageRecoverer messageRecoverer) Configure aMessageRecovererfor retry operations.voidsetRecoveryCallback(org.springframework.retry.RecoveryCallback<? extends Object> recoveryCallback) Set aRecoveryCallbackwhen using retry within the gateway.voidsetReplyHeadersMappedLast(boolean replyHeadersMappedLast) When mapping headers for the outbound (reply) message, determine whether the headers are mapped before the message is converted, or afterwards.voidsetRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate) Set aRetryTemplateto use for retrying a message delivery within the gateway.Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupportbuildErrorMessage, buildSendTimer, destroy, getErrorChannel, getErrorMessageStrategy, getIntegrationPatternType, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, isObserved, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerObservationRegistry, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setObservationConvention, setReceiverObservationConvention, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackMethods inherited from class org.springframework.integration.endpoint.AbstractEndpointdoStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
AmqpInboundGateway
- 
AmqpInboundGatewayConstructAmqpInboundGatewaybased on the providedMessageListenerContainerto receive request messages andAmqpTemplateto send replies.- Parameters:
- listenerContainer- the- MessageListenerContainerto receive AMQP messages.
- amqpTemplate- the- AmqpTemplateto send reply messages.
 
 
- 
- 
Method Details- 
setMessageConverterSpecify theMessageConverterto convert request and reply to/fromMessage. If theamqpTemplateis explicitly set, thisMessageConverterisn't populated there. You must configure that externalamqpTemplate.- Parameters:
- messageConverter- the- MessageConverterto use.
 
- 
setHeaderMapper
- 
setDefaultReplyToThedefaultReplyToaddress with the form(exchange)/(routingKey) or(queueName) if the request message doesn't have areplyToproperty. The second form uses the default exchange ("") and the queue name as the routing key.- Parameters:
- defaultReplyTo- the default- replyToaddress to use.
- Since:
- 4.2
- See Also:
 
- 
setRetryTemplatepublic void setRetryTemplate(org.springframework.retry.support.RetryTemplate retryTemplate) Set aRetryTemplateto use for retrying a message delivery within the gateway. Unlike adding retry at the container level, this can be used with anErrorMessageSendingRecovererRecoveryCallbackto publish to the error channel after retries are exhausted. You generally should not configure an error channel when using retry here, use aRecoveryCallbackinstead.- Parameters:
- retryTemplate- the template.
- Since:
- 4.3.10.
- See Also:
 
- 
setRecoveryCallbackpublic void setRecoveryCallback(org.springframework.retry.RecoveryCallback<? extends Object> recoveryCallback) Set aRecoveryCallbackwhen using retry within the gateway. Mutually exclusive withsetMessageRecoverer(MessageRecoverer).- Parameters:
- recoveryCallback- the callback.
- Since:
- 4.3.10
- See Also:
 
- 
setMessageRecovererConfigure aMessageRecovererfor retry operations. A more AMQP-specific convenience instead ofsetRecoveryCallback(RecoveryCallback).- Parameters:
- messageRecoverer- the- MessageRecovererto use.
- Since:
- 5.5
 
- 
setBatchingStrategySet a batching strategy to use when de-batching messages. Default isSimpleBatchingStrategy.- Parameters:
- batchingStrategy- the strategy.
- Since:
- 5.2
 
- 
setBindSourceMessagepublic void setBindSourceMessage(boolean bindSourceMessage) Set to true to bind the source message in the header namedIntegrationMessageHeaderAccessor.SOURCE_DATA.- Parameters:
- bindSourceMessage- true to bind.
- Since:
- 5.1.6
 
- 
setReplyHeadersMappedLastpublic void setReplyHeadersMappedLast(boolean replyHeadersMappedLast) When mapping headers for the outbound (reply) message, determine whether the headers are mapped before the message is converted, or afterwards. This only affects headers that might be added by the message converter. When false, the converter's headers win; when true, any headers added by the converter will be overridden (if the source message has a header that maps to those headers). You might wish to set this to true, for example, when using aSimpleMessageConverterwith a String payload that contains json; the converter will set the content type totext/plainwhich can be overridden toapplication/jsonby setting theAmqpHeaders.CONTENT_TYPEmessage header. Default: false.- Parameters:
- replyHeadersMappedLast- true if reply headers are mapped after conversion.
- Since:
- 5.1.9
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- MessagingGatewaySupport
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- MessagingGatewaySupport
 
- 
doStartprotected void doStart()Description copied from class:AbstractEndpointSubclasses must implement this method with the start behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock.- Overrides:
- doStartin class- MessagingGatewaySupport
 
- 
doStopprotected void doStop()Description copied from class:AbstractEndpointSubclasses must implement this method with the stop behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock.- Overrides:
- doStopin class- MessagingGatewaySupport
 
- 
getErrorMessageAttributesDescription copied from class:MessagingGatewaySupportPopulate anAttributeAccessorto be used when building an error message with theerrorMessageStrategy.- Overrides:
- getErrorMessageAttributesin class- MessagingGatewaySupport
- Parameters:
- message- the message.
- Returns:
- the attributes.
 
 
-