/** Create the initial message context for the file */ private org.apache.synapse.MessageContext createMessageContext() { org.apache.synapse.MessageContext msgCtx = synapseEnvironment.createMessageContext(); MessageContext axis2MsgCtx = ((org.apache.synapse.core.axis2.Axis2MessageContext) msgCtx).getAxis2MessageContext(); axis2MsgCtx.setServerSide(true); axis2MsgCtx.setMessageID(UUIDGenerator.getUUID()); return msgCtx; }
/** Create the initial message context for the file */ private org.apache.synapse.MessageContext createMessageContext() { org.apache.synapse.MessageContext msgCtx = synapseEnvironment.createMessageContext(); // Need to set this to build the message msgCtx.setProperty(SynapseConstants.INBOUND_JMS_PROTOCOL, true); MessageContext axis2MsgCtx = ((org.apache.synapse.core.axis2.Axis2MessageContext) msgCtx).getAxis2MessageContext(); axis2MsgCtx.setServerSide(true); axis2MsgCtx.setMessageID(UUIDGenerator.getUUID()); PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); axis2MsgCtx.setProperty(MultitenantConstants.TENANT_DOMAIN, carbonContext.getTenantDomain()); // There is a discrepency in what I thought, Axis2 spawns a nes threads // to // send a message is this is TRUE - and I want it to be the other way msgCtx.setProperty(MessageContext.CLIENT_API_NON_BLOCKING, true); return msgCtx; }
/** This will be invoked by the schedular to inject the message in to the SynapseEnvironment */ public void execute() { log.debug("execute"); if (synapseEnvironment == null) { log.error("Synapse Environment not set"); return; } if (message == null) { log.error("message not set"); return; } if (to == null) { log.error("to address not set"); return; } MessageContext mc = synapseEnvironment.createMessageContext(); // AspectHelper.setGlobalAudit(mc); TODO mc.pushFaultHandler(new MediatorFaultHandler(mc.getFaultSequence())); mc.setTo(new EndpointReference(to)); if (format == null) { PayloadHelper.setXMLPayload(mc, message.cloneOMElement()); } else { try { if (SOAP11_FORMAT.equalsIgnoreCase(format)) { mc.setEnvelope(OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope()); } else if (SOAP12_FORMAT.equalsIgnoreCase(format)) { mc.setEnvelope(OMAbstractFactory.getSOAP12Factory().createSOAPEnvelope()); } else if (POX_FORMAT.equalsIgnoreCase(format)) { mc.setDoingPOX(true); } else if (GET_FORMAT.equalsIgnoreCase(format)) { mc.setDoingGET(true); } PayloadHelper.setXMLPayload(mc, message.cloneOMElement()); } catch (AxisFault axisFault) { String msg = "Error in setting the message payload : " + message; log.error(msg, axisFault); throw new SynapseException(msg, axisFault); } } if (soapAction != null) { mc.setSoapAction(soapAction); } synapseEnvironment.injectMessage(mc); }