ConfigurationContext context = msgCtx.getConfigurationContext();
if (context == null) {
String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.configContextNotSet);
log.debug(message);
throw new AxisFault(message);
}
String DONE = (String) msgCtx.getProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE);
if (null != DONE && Sandesha2Constants.VALUE_TRUE.equals(DONE)) {
if (log.isDebugEnabled())
log.debug("Exit: SandeshaInHandler::invoke, Application processing done " + returnValue);
return returnValue;
}
// look at the service to see if RM is totally disabled. This allows the user to disable RM using
// a property on the service, even when Sandesha is engaged.
if (msgCtx.getAxisService() != null) {
Parameter unreliableParam = msgCtx.getAxisService().getParameter(SandeshaClientConstants.UNRELIABLE_MESSAGE);
if (null != unreliableParam && "true".equals(unreliableParam.getValue())) {
log.debug("Exit: SandeshaInHandler::invoke, Service has disabled RM " + returnValue);
return returnValue;
}
}
if (log.isDebugEnabled()) log.debug("SandeshaInHandler::invoke Continuing beyond basic checks");
Transaction transaction = null;
try {
StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(context, context.getAxisConfiguration());
transaction = storageManager.getTransaction();
AxisService axisService = msgCtx.getAxisService();
if (axisService == null) {
String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.axisServiceIsNull);
log.debug(message);
throw new AxisFault(message);
}
RMMsgContext rmMsgCtx = null;
if (msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT) != null)
rmMsgCtx = (RMMsgContext)msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT);
else
rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
// validating the message
MessageValidator.validateIncomingMessage(rmMsgCtx, storageManager);
// commit the current transaction
if(transaction != null && transaction.isActive()) transaction.commit();
transaction = storageManager.getTransaction();
// Process Ack headers in the message
AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor();
ackProcessor.processAckHeaders(rmMsgCtx);
// commit the current transaction
if(transaction != null && transaction.isActive()) transaction.commit();
transaction = storageManager.getTransaction();
// Process Ack Request headers in the message
AckRequestedProcessor reqProcessor = new AckRequestedProcessor();
if(reqProcessor.processAckRequestedHeaders(rmMsgCtx)){
returnValue = InvocationResponse.SUSPEND;
}
// Process MessagePending headers
MessagePendingProcessor pendingProcessor = new MessagePendingProcessor();
pendingProcessor.processMessagePendingHeaders(rmMsgCtx);
// commit the current transaction
if(transaction != null && transaction.isActive()) transaction.commit();
transaction = storageManager.getTransaction();
// Process the Sequence header, if there is one
SequenceProcessor seqProcessor = new SequenceProcessor();
returnValue = seqProcessor.processSequenceHeader(rmMsgCtx, transaction);
// commit the current transaction
if(transaction != null && transaction.isActive()) transaction.commit();
transaction = null;
} catch (Exception e) {
if (log.isDebugEnabled())
log.debug("SandeshaInHandler::invoke Exception caught during processInMessage", e);
// message should not be sent in a exception situation.
msgCtx.pause();
returnValue = InvocationResponse.SUSPEND;
// Rethrow the original exception if it is an AxisFault
if (e instanceof AxisFault)
throw (AxisFault)e;
String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.inMsgError, e.toString());
throw new AxisFault(message, e);
}
finally {
if (log.isDebugEnabled()) log.debug("SandeshaInHandler::invoke Doing final processing");
if (transaction != null && transaction.isActive()) {
try {