Class AbstractAmqpOutboundEndpoint
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.MessageHandlerSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.handler.AbstractMessageProducingHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.amqp.outbound.AbstractAmqpOutboundEndpoint
- All Implemented Interfaces:
- org.reactivestreams.Subscriber<Message<?>>,- Aware,- BeanClassLoaderAware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Lifecycle,- Ordered,- ComponentSourceAware,- ExpressionCapable,- Orderable,- MessageProducer,- HeaderPropagationAware,- IntegrationPattern,- NamedComponent,- IntegrationManagement,- ManageableLifecycle,- TrackableComponent,- MessageHandler,- reactor.core.CoreSubscriber<Message<?>>
- Direct Known Subclasses:
- AmqpOutboundEndpoint,- AsyncAmqpOutboundGateway
public abstract class AbstractAmqpOutboundEndpoint
extends AbstractReplyProducingMessageHandler
implements ManageableLifecycle
A base 
AbstractReplyProducingMessageHandler extension for AMQP message handlers.- Since:
- 4.3
- Author:
- Gary Russell, Artem Bilan, Christian Tzolov, Ngoc Nhan
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static final classNested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandlerAbstractReplyProducingMessageHandler.RequestHandlerNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.handler.AbstractMessageProducingHandlermessagingTemplateFields 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.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidaddDelayProperty(Message<?> message, Message amqpMessage) protected AbstractIntegrationMessageBuilder<?> buildReply(MessageConverter converter, Message amqpReplyMessage) protected Message<?> buildReturnedMessage(ReturnedMessage returnedMessage, MessageConverter converter) protected final voiddoInit()protected voiddoStart()protected voiddoStop()protected voidSubclasses can override to perform any additional initialization.protected CorrelationDatagenerateCorrelationData(Message<?> requestMessage) protected StringgenerateExchangeName(Message<?> requestMessage) protected StringgenerateRoutingKey(Message<?> requestMessage) protected MessageChannelprotected Expressionprotected MessageChannelprotected Durationprotected ExpressionEvaluatingMessageProcessor<Object> protected MessageDeliveryModeprotected Stringprotected Expressionprotected ExpressionEvaluatingMessageProcessor<String> protected abstract RabbitTemplateprotected MessageChannelprotected Stringprotected Expressionprotected ExpressionEvaluatingMessageProcessor<String> protected voidhandleConfirm(CorrelationData correlationData, boolean ack, String cause) protected booleanprotected booleanbooleanvoidsetConfirmAckChannel(MessageChannel ackChannel) Set the channel to which acks are send (publisher confirms).voidsetConfirmAckChannelName(String ackChannelName) Set the channel name to which acks are send (publisher confirms).voidsetConfirmCorrelationExpression(Expression confirmCorrelationExpression) Set a SpEL expression to evaluate confirm correlation at runtime.voidsetConfirmCorrelationExpressionString(String confirmCorrelationExpression) Set a SpEL expression to evaluate confirm correlation at runtime.voidsetConfirmNackChannel(MessageChannel nackChannel) Set the channel to which nacks are send (publisher confirms).voidsetConfirmNackChannelName(String nackChannelName) Set the channel name to which nacks are send (publisher confirms).voidsetConfirmTimeout(long confirmTimeout) Set a timeout after which a nack will be synthesized if no publisher confirm has been received within that time.protected final voidsetConnectionFactory(ConnectionFactory connectionFactory) voidsetDefaultDeliveryMode(MessageDeliveryMode defaultDeliveryMode) Set the default delivery mode.voidsetDelay(int delay) Set the value to set in thex-delayheader when using the RabbitMQ delayed message exchange plugin.voidsetDelayExpression(Expression delayExpression) Set the SpEL expression to calculate thex-delayheader when using the RabbitMQ delayed message exchange plugin.voidsetDelayExpressionString(String delayExpression) Set the SpEL expression to calculate thex-delayheader when using the RabbitMQ delayed message exchange plugin.voidsetErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy) Set the error message strategy to use for returned (or negatively confirmed) messages.voidsetExchangeName(String exchangeName) Configure an AMQP exchange name for sending messages.voidsetExchangeNameExpression(Expression exchangeNameExpression) Configure a SpEL expression to evaluate an exchange name at runtime.voidsetExchangeNameExpressionString(String exchangeNameExpression) voidsetHeaderMapper(AmqpHeaderMapper headerMapper) Set a customAmqpHeaderMapperfor mapping request and reply headers.voidsetHeadersMappedLast(boolean headersMappedLast) When mapping headers for the outbound message, determine whether the headers are mapped before the message is converted, or afterwards.voidsetLazyConnect(boolean lazyConnect) Set tofalseto attempt to connect during endpoint start; defaulttrue, meaning the connection will be attempted to be established on the arrival of the first message.voidsetReturnChannel(MessageChannel returnChannel) Set the channel to which returned messages are sent.voidsetRoutingKey(String routingKey) Configure an AMQP routing key for sending messages.voidsetRoutingKeyExpression(Expression routingKeyExpression) voidsetRoutingKeyExpressionString(String routingKeyExpression) voidstart()voidstop()Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandlerdoInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, handleRequestMessage, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReplyMethods inherited from class org.springframework.integration.handler.AbstractMessageProducingHandleraddNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, setupMessageProcessor, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeadersMethods inherited from class org.springframework.integration.handler.AbstractMessageHandlerhandleMessage, onComplete, onError, onNext, onSubscribe, setObservationConventionMethods inherited from class org.springframework.integration.handler.MessageHandlerSupportbuildSendTimer, destroy, getComponentType, getManagedName, getManagedType, getMetricsCaptor, getObservationRegistry, getOrder, getOverrides, isLoggingEnabled, isObserved, registerMetricsCaptor, registerObservationRegistry, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrackMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscribercurrentContextMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
AbstractAmqpOutboundEndpointpublic AbstractAmqpOutboundEndpoint()
 
- 
- 
Method Details- 
setHeaderMapperSet a customAmqpHeaderMapperfor mapping request and reply headers. Defaults toDefaultAmqpHeaderMapper.outboundMapper().- Parameters:
- headerMapper- the- AmqpHeaderMapperto use.
 
- 
setHeadersMappedLastpublic void setHeadersMappedLast(boolean headersMappedLast) When mapping headers for the outbound 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:
- headersMappedLast- true if headers are mapped after conversion.
- Since:
- 5.0
 
- 
setExchangeNameConfigure an AMQP exchange name for sending messages.- Parameters:
- exchangeName- the exchange name for sending messages.
 
- 
setExchangeNameExpressionConfigure a SpEL expression to evaluate an exchange name at runtime.- Parameters:
- exchangeNameExpression- the expression to use.
- Since:
- 4.3
 
- 
setExchangeNameExpressionString- Parameters:
- exchangeNameExpression- the String in SpEL syntax.
- Since:
- 4.3
 
- 
setRoutingKeyConfigure an AMQP routing key for sending messages.- Parameters:
- routingKey- the routing key to use
 
- 
setRoutingKeyExpression- Parameters:
- routingKeyExpression- the expression to use.
- Since:
- 4.3
 
- 
setRoutingKeyExpressionString- Parameters:
- routingKeyExpression- the String in SpEL syntax.
- Since:
- 4.3
 
- 
setConfirmCorrelationExpressionSet a SpEL expression to evaluate confirm correlation at runtime.- Parameters:
- confirmCorrelationExpression- the expression to use.
- Since:
- 4.3
 
- 
setConfirmCorrelationExpressionStringSet a SpEL expression to evaluate confirm correlation at runtime.- Parameters:
- confirmCorrelationExpression- the String in SpEL syntax.
- Since:
- 4.3
 
- 
setConfirmAckChannelSet the channel to which acks are send (publisher confirms).- Parameters:
- ackChannel- the channel.
 
- 
setConfirmAckChannelNameSet the channel name to which acks are send (publisher confirms).- Parameters:
- ackChannelName- the channel name.
- Since:
- 4.3.12
 
- 
setConfirmNackChannelSet the channel to which nacks are send (publisher confirms).- Parameters:
- nackChannel- the channel.
 
- 
setConfirmNackChannelNameSet the channel name to which nacks are send (publisher confirms).- Parameters:
- nackChannelName- the channel name.
- Since:
- 4.3.12
 
- 
setReturnChannelSet the channel to which returned messages are sent.- Parameters:
- returnChannel- the channel.
 
- 
setDefaultDeliveryModeSet the default delivery mode.- Parameters:
- defaultDeliveryMode- the delivery mode.
 
- 
setLazyConnectpublic void setLazyConnect(boolean lazyConnect) Set tofalseto attempt to connect during endpoint start; defaulttrue, meaning the connection will be attempted to be established on the arrival of the first message.- Parameters:
- lazyConnect- the lazyConnect to set
- Since:
- 4.1
 
- 
setDelaypublic void setDelay(int delay) Set the value to set in thex-delayheader when using the RabbitMQ delayed message exchange plugin. By default, theAmqpHeaders.DELAYheader (if present) is mapped; setting the delay here overrides that value.- Parameters:
- delay- the delay.
- Since:
- 4.3.5
 
- 
setDelayExpressionSet the SpEL expression to calculate thex-delayheader when using the RabbitMQ delayed message exchange plugin. By default, theAmqpHeaders.DELAYheader (if present) is mapped; setting the expression here overrides that value.- Parameters:
- delayExpression- the expression.
- Since:
- 4.3.5
 
- 
setDelayExpressionStringSet the SpEL expression to calculate thex-delayheader when using the RabbitMQ delayed message exchange plugin. By default, theAmqpHeaders.DELAYheader (if present) is mapped; setting the expression here overrides that value.- Parameters:
- delayExpression- the expression.
- Since:
- 4.3.5
 
- 
setErrorMessageStrategySet the error message strategy to use for returned (or negatively confirmed) messages.- Parameters:
- errorMessageStrategy- the strategy.
- Since:
- 4.3.12
 
- 
setConfirmTimeoutpublic void setConfirmTimeout(long confirmTimeout) Set a timeout after which a nack will be synthesized if no publisher confirm has been received within that time. Missing confirms will be checked every 50% of this value so the synthesized nack will be sent between 1x and 1.5x this timeout.- Parameters:
- confirmTimeout- the approximate timeout.
- Since:
- 5.2
- See Also:
 
- 
setConnectionFactory
- 
getExchangeName
- 
getRoutingKey
- 
getExchangeNameExpression
- 
getRoutingKeyExpression
- 
getRoutingKeyGenerator
- 
getExchangeNameGenerator
- 
getHeaderMapper
- 
getConfirmCorrelationExpression
- 
getCorrelationDataGenerator
- 
getConfirmAckChannel
- 
getConfirmNackChannel
- 
getReturnChannel
- 
getDefaultDeliveryMode
- 
isLazyConnectprotected boolean isLazyConnect()
- 
isHeadersMappedLastprotected boolean isHeadersMappedLast()
- 
getConfirmTimeout
- 
doInitprotected final void doInit()- Overrides:
- doInitin class- AbstractReplyProducingMessageHandler
 
- 
endpointInitprotected void endpointInit()Subclasses can override to perform any additional initialization. Called from afterPropertiesSet().
- 
startpublic void start()- Specified by:
- startin interface- Lifecycle
- Specified by:
- startin interface- ManageableLifecycle
 
- 
getRabbitTemplate
- 
stoppublic void stop()- Specified by:
- stopin interface- Lifecycle
- Specified by:
- stopin interface- ManageableLifecycle
 
- 
doStartprotected void doStart()
- 
doStopprotected void doStop()
- 
isRunningpublic boolean isRunning()- Specified by:
- isRunningin interface- Lifecycle
- Specified by:
- isRunningin interface- ManageableLifecycle
 
- 
generateCorrelationData
- 
generateExchangeName
- 
generateRoutingKey
- 
addDelayProperty
- 
buildReplyprotected AbstractIntegrationMessageBuilder<?> buildReply(MessageConverter converter, Message amqpReplyMessage) 
- 
buildReturnedMessageprotected Message<?> buildReturnedMessage(ReturnedMessage returnedMessage, MessageConverter converter) 
- 
handleConfirm
 
-