Class RabbitStreamMessageHandler
- java.lang.Object
-
- org.springframework.integration.context.IntegrationObjectSupport
-
- org.springframework.integration.handler.MessageHandlerSupport
-
- org.springframework.integration.handler.AbstractMessageHandler
-
- org.springframework.cloud.stream.binder.rabbit.RabbitStreamMessageHandler
-
- All Implemented Interfaces:
org.reactivestreams.Subscriber<org.springframework.messaging.Message<?>>,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.context.ApplicationContextAware,org.springframework.context.Lifecycle,org.springframework.core.Ordered,org.springframework.integration.context.ExpressionCapable,org.springframework.integration.context.Orderable,org.springframework.integration.IntegrationPattern,org.springframework.integration.support.context.NamedComponent,org.springframework.integration.support.management.IntegrationManagement,org.springframework.integration.support.management.TrackableComponent,org.springframework.messaging.MessageHandler,reactor.core.CoreSubscriber<org.springframework.messaging.Message<?>>
public class RabbitStreamMessageHandler extends org.springframework.integration.handler.AbstractMessageHandler implements org.springframework.context.LifecycleMessageHandlerbased onRabbitStreamOperations. TODO: This class will move to Spring Integration in 6.0.- Since:
- 3.2
- Author:
- Gary Russell
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRabbitStreamMessageHandler.FailureCallbackCallback for when publishing fails.
-
Constructor Summary
Constructors Constructor Description RabbitStreamMessageHandler(org.springframework.rabbit.stream.producer.RabbitStreamOperations streamOperations)Create an instance with the providedRabbitStreamOperations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.rabbit.stream.producer.RabbitStreamOperationsgetStreamOperations()Return theRabbitStreamOperations.protected voidhandleMessageInternal(org.springframework.messaging.Message<?> requestMessage)booleanisRunning()voidsetConfirmTimeout(long confirmTimeout)Set the confirm timeout.voidsetFailureCallback(RabbitStreamMessageHandler.FailureCallback failureCallback)Set a callback to be invoked when a send fails.voidsetHeaderMapper(org.springframework.integration.amqp.support.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.voidsetSuccessCallback(org.springframework.util.concurrent.SuccessCallback<org.springframework.messaging.Message<?>> successCallback)Set a callback to be invoked when a send is successful.voidsetSync(boolean sync)Set to true to wait for a confirmation.voidstart()voidstop()-
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
handleMessage, onComplete, onError, onNext, onSubscribe
-
Methods inherited from class org.springframework.integration.handler.MessageHandlerSupport
buildSendTimer, destroy, getComponentType, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
-
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
setSuccessCallback
public void setSuccessCallback(org.springframework.util.concurrent.SuccessCallback<org.springframework.messaging.Message<?>> successCallback)
Set a callback to be invoked when a send is successful.- Parameters:
successCallback- the callback.
-
setFailureCallback
public void setFailureCallback(RabbitStreamMessageHandler.FailureCallback failureCallback)
Set a callback to be invoked when a send fails.- Parameters:
failureCallback- the callback.
-
setSync
public void setSync(boolean sync)
Set to true to wait for a confirmation.- Parameters:
sync- true to wait.- See Also:
setConfirmTimeout(long)
-
setConfirmTimeout
public void setConfirmTimeout(long confirmTimeout)
Set the confirm timeout.- Parameters:
confirmTimeout- the timeout.- See Also:
setSync(boolean)
-
setHeaderMapper
public void setHeaderMapper(org.springframework.integration.amqp.support.AmqpHeaderMapper headerMapper)
Set a customAmqpHeaderMapperfor mapping request and reply headers. Defaults toDefaultAmqpHeaderMapper.outboundMapper().- Parameters:
headerMapper- theAmqpHeaderMapperto use.
-
setHeadersMappedLast
public 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.
-
getStreamOperations
public org.springframework.rabbit.stream.producer.RabbitStreamOperations getStreamOperations()
Return theRabbitStreamOperations.- Returns:
- the operations.
-
handleMessageInternal
protected void handleMessageInternal(org.springframework.messaging.Message<?> requestMessage)
- Specified by:
handleMessageInternalin classorg.springframework.integration.handler.AbstractMessageHandler
-
start
public void start()
- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()
- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()
- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
-