Destination replyTo = null;
boolean transacted = false;
boolean cached = false;
boolean useReplyToDestination;
final Transaction muleTx = TransactionCoordination.getInstance().getTransaction();
if (logger.isDebugEnabled())
{
logger.debug("dispatching on endpoint: " + endpoint.getEndpointURI()
+ ". MuleEvent id is: " + event.getId()
+ ". Outbound transformers are: " + endpoint.getTransformers());
}
// assume session is transacted first, and thus, managed
boolean sessionManaged = true;
try
{
session = connector.getSessionFromTransaction();
if (session != null)
{
transacted = true;
}
// Should we be caching sessions? Note this is not part of the JMS spec.
// and is turned off by default.
else if (event.getMessage().getOutboundProperty(JmsConstants.CACHE_JMS_SESSIONS_PROPERTY, connector.isCacheJmsSessions()))
{
sessionManaged = false;
cached = true;
if (cachedSession != null)
{
session = cachedSession;
}
else
{
session = connector.getSession(endpoint);
cachedSession = session;
}
}
else
{
// by now we're running with a different connector and connection
sessionManaged = muleTx != null && muleTx.isXA();
session = connector.getSession(endpoint);
if (endpoint.getTransactionConfig().isTransacted())
{
transacted = true;