public abstract class AbstractAmqpOutboundEndpoint extends AbstractReplyProducingMessageHandler implements ManageableLifecycle
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractAmqpOutboundEndpoint.CorrelationDataWrapper |
AbstractReplyProducingMessageHandler.RequestHandler
IntegrationManagement.ManagementOverrides
messagingTemplate
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
AbstractAmqpOutboundEndpoint() |
Modifier and Type | Method and Description |
---|---|
protected void |
addDelayProperty(Message<?> message,
org.springframework.amqp.core.Message amqpMessage) |
protected AbstractIntegrationMessageBuilder<?> |
buildReply(org.springframework.amqp.support.converter.MessageConverter converter,
org.springframework.amqp.core.Message amqpReplyMessage) |
protected Message<?> |
buildReturnedMessage(org.springframework.amqp.core.Message message,
int replyCode,
String replyText,
String exchange,
String returnedRoutingKey,
org.springframework.amqp.support.converter.MessageConverter converter)
Deprecated.
since 5.4 in favor of
buildReturnedMessage(ReturnedMessage, MessageConverter) |
protected Message<?> |
buildReturnedMessage(org.springframework.amqp.core.ReturnedMessage returnedMessage,
org.springframework.amqp.support.converter.MessageConverter converter) |
protected void |
doInit() |
protected void |
doStart() |
protected void |
doStop() |
protected void |
endpointInit()
Subclasses can override to perform any additional initialization.
|
protected org.springframework.amqp.rabbit.connection.CorrelationData |
generateCorrelationData(Message<?> requestMessage) |
protected String |
generateExchangeName(Message<?> requestMessage) |
protected String |
generateRoutingKey(Message<?> requestMessage) |
protected MessageChannel |
getConfirmAckChannel() |
protected Expression |
getConfirmCorrelationExpression() |
protected MessageChannel |
getConfirmNackChannel() |
protected java.time.Duration |
getConfirmTimeout() |
protected ExpressionEvaluatingMessageProcessor<Object> |
getCorrelationDataGenerator() |
protected org.springframework.amqp.core.MessageDeliveryMode |
getDefaultDeliveryMode() |
protected String |
getExchangeName() |
protected Expression |
getExchangeNameExpression() |
protected ExpressionEvaluatingMessageProcessor<String> |
getExchangeNameGenerator() |
AmqpHeaderMapper |
getHeaderMapper() |
protected abstract org.springframework.amqp.rabbit.core.RabbitTemplate |
getRabbitTemplate() |
protected MessageChannel |
getReturnChannel() |
protected String |
getRoutingKey() |
protected Expression |
getRoutingKeyExpression() |
protected ExpressionEvaluatingMessageProcessor<String> |
getRoutingKeyGenerator() |
protected void |
handleConfirm(org.springframework.amqp.rabbit.connection.CorrelationData correlationData,
boolean ack,
String cause) |
protected boolean |
isHeadersMappedLast() |
protected boolean |
isLazyConnect() |
boolean |
isRunning() |
void |
setConfirmAckChannel(MessageChannel ackChannel)
Set the channel to which acks are send (publisher confirms).
|
void |
setConfirmAckChannelName(String ackChannelName)
Set the channel name to which acks are send (publisher confirms).
|
void |
setConfirmCorrelationExpression(Expression confirmCorrelationExpression)
Set a SpEL expression to evaluate confirm correlation at runtime.
|
void |
setConfirmCorrelationExpressionString(String confirmCorrelationExpression)
Set a SpEL expression to evaluate confirm correlation at runtime.
|
void |
setConfirmNackChannel(MessageChannel nackChannel)
Set the channel to which nacks are send (publisher confirms).
|
void |
setConfirmNackChannelName(String nackChannelName)
Set the channel name to which nacks are send (publisher confirms).
|
void |
setConfirmTimeout(long confirmTimeout)
Set a timeout after which a nack will be synthesized if no publisher confirm has
been received within that time.
|
protected void |
setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory) |
void |
setDefaultDeliveryMode(org.springframework.amqp.core.MessageDeliveryMode defaultDeliveryMode)
Set the default delivery mode.
|
void |
setDelay(int delay)
Set the value to set in the
x-delay header when using the
RabbitMQ delayed message exchange plugin. |
void |
setDelayExpression(Expression delayExpression)
Set the SpEL expression to calculate the
x-delay header when using the
RabbitMQ delayed message exchange plugin. |
void |
setDelayExpressionString(String delayExpression)
Set the SpEL expression to calculate the
x-delay header when using the
RabbitMQ delayed message exchange plugin. |
void |
setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy)
Set the error message strategy to use for returned (or negatively confirmed)
messages.
|
void |
setExchangeName(String exchangeName)
Configure an AMQP exchange name for sending messages.
|
void |
setExchangeNameExpression(Expression exchangeNameExpression)
Configure a SpEL expression to evaluate an exchange name at runtime.
|
void |
setExchangeNameExpressionString(String exchangeNameExpression) |
void |
setHeaderMapper(AmqpHeaderMapper headerMapper)
Set a custom
AmqpHeaderMapper for mapping request and reply headers. |
void |
setHeadersMappedLast(boolean headersMappedLast)
When mapping headers for the outbound message, determine whether the headers are
mapped before the message is converted, or afterwards.
|
void |
setLazyConnect(boolean lazyConnect)
Set to
false to attempt to connect during endpoint start;
default true , meaning the connection will be attempted
to be established on the arrival of the first message. |
void |
setReturnChannel(MessageChannel returnChannel)
Set the channel to which returned messages are sent.
|
void |
setRoutingKey(String routingKey)
Configure an AMQP routing key for sending messages.
|
void |
setRoutingKeyExpression(Expression routingKeyExpression) |
void |
setRoutingKeyExpressionString(String routingKeyExpression) |
void |
start() |
void |
stop() |
doInvokeAdvisedRequestHandler, getBeanClassLoader, getIntegrationPatternType, getRequiresReply, handleMessageInternal, handleRequestMessage, hasAdviceChain, onInit, setAdviceChain, setBeanClassLoader, setRequiresReply
addNotPropagatedHeaders, createOutputMessage, getNotPropagatedHeaders, getOutputChannel, isAsync, messageBuilderForReply, produceOutput, resolveErrorChannel, sendErrorMessage, sendOutput, sendOutputs, setAsync, setNotPropagatedHeaders, setOutputChannel, setOutputChannelName, setSendTimeout, shouldCopyRequestHeaders, shouldSplitOutput, updateNotPropagatedHeaders
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getComponentType, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public void setHeaderMapper(AmqpHeaderMapper headerMapper)
AmqpHeaderMapper
for mapping request and reply headers.
Defaults to DefaultAmqpHeaderMapper.outboundMapper()
.headerMapper
- the AmqpHeaderMapper
to use.public void setHeadersMappedLast(boolean headersMappedLast)
SimpleMessageConverter
with a
String payload that contains json; the converter will set the content type to
text/plain
which can be overridden to application/json
by setting
the AmqpHeaders.CONTENT_TYPE
message header. Default: false.headersMappedLast
- true if headers are mapped after conversion.public void setExchangeName(String exchangeName)
exchangeName
- the exchange name for sending messages.public void setExchangeNameExpression(Expression exchangeNameExpression)
exchangeNameExpression
- the expression to use.public void setExchangeNameExpressionString(String exchangeNameExpression)
exchangeNameExpression
- the String in SpEL syntax.public void setRoutingKey(String routingKey)
routingKey
- the routing key to usepublic void setRoutingKeyExpression(Expression routingKeyExpression)
routingKeyExpression
- the expression to use.public void setRoutingKeyExpressionString(String routingKeyExpression)
routingKeyExpression
- the String in SpEL syntax.public void setConfirmCorrelationExpression(Expression confirmCorrelationExpression)
confirmCorrelationExpression
- the expression to use.public void setConfirmCorrelationExpressionString(String confirmCorrelationExpression)
confirmCorrelationExpression
- the String in SpEL syntax.public void setConfirmAckChannel(MessageChannel ackChannel)
ackChannel
- the channel.public void setConfirmAckChannelName(String ackChannelName)
ackChannelName
- the channel name.public void setConfirmNackChannel(MessageChannel nackChannel)
nackChannel
- the channel.public void setConfirmNackChannelName(String nackChannelName)
nackChannelName
- the channel name.public void setReturnChannel(MessageChannel returnChannel)
returnChannel
- the channel.public void setDefaultDeliveryMode(org.springframework.amqp.core.MessageDeliveryMode defaultDeliveryMode)
defaultDeliveryMode
- the delivery mode.public void setLazyConnect(boolean lazyConnect)
false
to attempt to connect during endpoint start;
default true
, meaning the connection will be attempted
to be established on the arrival of the first message.lazyConnect
- the lazyConnect to setpublic void setDelay(int delay)
x-delay
header when using the
RabbitMQ delayed message exchange plugin. By default, the AmqpHeaders.DELAY
header (if present) is mapped; setting the delay here overrides that value.delay
- the delay.public void setDelayExpression(Expression delayExpression)
x-delay
header when using the
RabbitMQ delayed message exchange plugin. By default, the AmqpHeaders.DELAY
header (if present) is mapped; setting the expression here overrides that value.delayExpression
- the expression.public void setDelayExpressionString(@Nullable String delayExpression)
x-delay
header when using the
RabbitMQ delayed message exchange plugin. By default, the AmqpHeaders.DELAY
header (if present) is mapped; setting the expression here overrides that value.delayExpression
- the expression.public void setErrorMessageStrategy(ErrorMessageStrategy errorMessageStrategy)
errorMessageStrategy
- the strategy.public void setConfirmTimeout(long confirmTimeout)
confirmTimeout
- the approximate timeout.setConfirmNackChannel(MessageChannel)
protected final void setConnectionFactory(org.springframework.amqp.rabbit.connection.ConnectionFactory connectionFactory)
protected String getExchangeName()
protected String getRoutingKey()
protected Expression getExchangeNameExpression()
protected Expression getRoutingKeyExpression()
protected ExpressionEvaluatingMessageProcessor<String> getRoutingKeyGenerator()
protected ExpressionEvaluatingMessageProcessor<String> getExchangeNameGenerator()
public AmqpHeaderMapper getHeaderMapper()
protected Expression getConfirmCorrelationExpression()
protected ExpressionEvaluatingMessageProcessor<Object> getCorrelationDataGenerator()
protected MessageChannel getConfirmAckChannel()
protected MessageChannel getConfirmNackChannel()
protected MessageChannel getReturnChannel()
protected org.springframework.amqp.core.MessageDeliveryMode getDefaultDeliveryMode()
protected boolean isLazyConnect()
protected boolean isHeadersMappedLast()
@Nullable protected java.time.Duration getConfirmTimeout()
protected final void doInit()
doInit
in class AbstractReplyProducingMessageHandler
protected void endpointInit()
public void start()
start
in interface Lifecycle
start
in interface ManageableLifecycle
@Nullable protected abstract org.springframework.amqp.rabbit.core.RabbitTemplate getRabbitTemplate()
public void stop()
stop
in interface Lifecycle
stop
in interface ManageableLifecycle
protected void doStart()
protected void doStop()
public boolean isRunning()
isRunning
in interface Lifecycle
isRunning
in interface ManageableLifecycle
protected org.springframework.amqp.rabbit.connection.CorrelationData generateCorrelationData(Message<?> requestMessage)
protected void addDelayProperty(Message<?> message, org.springframework.amqp.core.Message amqpMessage)
protected AbstractIntegrationMessageBuilder<?> buildReply(org.springframework.amqp.support.converter.MessageConverter converter, org.springframework.amqp.core.Message amqpReplyMessage)
@Deprecated protected Message<?> buildReturnedMessage(org.springframework.amqp.core.Message message, int replyCode, String replyText, String exchange, String returnedRoutingKey, org.springframework.amqp.support.converter.MessageConverter converter)
buildReturnedMessage(ReturnedMessage, MessageConverter)
message
- the returned AMQP messagereplyCode
- the returned message reason codereplyText
- the returned message reason textexchange
- the exchange the message returned fromreturnedRoutingKey
- the routing key for returned messageconverter
- the converter to deserialize body of the returned AMQP messageprotected Message<?> buildReturnedMessage(org.springframework.amqp.core.ReturnedMessage returnedMessage, org.springframework.amqp.support.converter.MessageConverter converter)
protected void handleConfirm(org.springframework.amqp.rabbit.connection.CorrelationData correlationData, boolean ack, String cause)