//Set the replyTo to the JBpmCallback Service
String esbToBpmVarsXml=null;
if (esbToBpmVars!=null) {
esbToBpmVarsXml = esbToBpmVars.asXML();
}
EPR replyTo = createReplyTo(esbToBpmVarsXml, globalProcessScope, executionContext);
message.getHeader().getCall().setReplyTo(replyTo);
if (exceptionTransition!=null) {
// Set the replyTo to the JBpmCallback Service
EPR faultTo = createFaultTo(esbToBpmVarsXml, globalProcessScope, executionContext);
message.getHeader().getCall().setFaultTo(faultTo);
}
final ContextInstance contextInstance = executionContext.getContextInstance() ;
if (isReplyToOrFaultToSet(contextInstance))
{
setRelatesToMessageId(contextInstance, message);
}
//Sending the message on its way
if (logger.isDebugEnabled()) logger.debug("Created ESB message=" + message);
if (replyToOriginator != null) {
final EPR epr ;
final Object replyToEPR = contextInstance.getVariable(Constants.REPLY_TO);
final Object faultToEPR = contextInstance.getVariable(Constants.FAULT_TO);
if (Constants.EPR_FAULT.equals(replyToOriginator) && (faultToEPR != null)) {
epr = EPRHelper.fromXMLString(faultToEPR.toString()) ;