Package org.apache.activemq.ra
Class InboundContextSupport
- java.lang.Object
-
- org.apache.activemq.ra.InboundContextSupport
-
public final class InboundContextSupport extends Object
A helper class used to provide access to the current activeInboundContext
instance being used to process a message in the current thread so that messages can be produced using the same session.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static InboundContext
getActiveSessionAndProducer()
Returns the currentInboundContext
used by the current thread which is processing a message.static void
register(InboundContext sessionAndProducer)
Registers the session and producer which should be called before theMessageEndpoint.beforeDelivery(java.lang.reflect.Method)
method is called.static void
unregister(InboundContext sessionAndProducer)
Unregisters the session and producer which should be called after theMessageEndpoint.afterDelivery()
method is called.
-
-
-
Method Detail
-
getActiveSessionAndProducer
public static InboundContext getActiveSessionAndProducer()
Returns the currentInboundContext
used by the current thread which is processing a message. This allows us to access the current Session to send a message using the same underlying session to avoid unnecessary XA or to use regular JMS transactions while using message driven POJOs.- Returns:
-
register
public static void register(InboundContext sessionAndProducer)
Registers the session and producer which should be called before theMessageEndpoint.beforeDelivery(java.lang.reflect.Method)
method is called.- Parameters:
sessionAndProducer
-
-
unregister
public static void unregister(InboundContext sessionAndProducer)
Unregisters the session and producer which should be called after theMessageEndpoint.afterDelivery()
method is called.- Parameters:
sessionAndProducer
-
-
-