/** * Send a message out from the Synapse engine to an external service * * @param endpoint the endpoint definition where the message should be sent * @param synapseInMessageContext the Synapse message context */ public static void sendOn(EndpointDefinition endpoint, org.apache.synapse.MessageContext synapseInMessageContext) { try { // Invoke Synapse Handlers Iterator<SynapseHandler> iterator = synapseInMessageContext.getEnvironment().getSynapseHandlers().iterator(); while (iterator.hasNext()) { SynapseHandler handler = iterator.next(); if (!handler.handleRequestOutFlow(synapseInMessageContext)) { return; } } Axis2FlexibleMEPClient.send( // The endpoint where we are sending to endpoint, // The Axis2 Message context of the Synapse MC synapseInMessageContext); } catch (Exception e) { handleException("Unexpected error during sending message out", e); } }
/** * Send a message out from the Synapse engine to an external service * @param endpoint the endpoint definition where the message should be sent * @param synapseInMessageContext the Synapse message context */ public static void sendOn(EndpointDefinition endpoint, org.apache.synapse.MessageContext synapseInMessageContext) { try { Axis2FlexibleMEPClient.send( // The endpoint where we are sending to endpoint, // The Axis2 Message context of the Synapse MC synapseInMessageContext); if (synapseInMessageContext.isResponse()) { // report stats for any component at response sending check point StatisticsReporter.reportForAllOnResponseSent(synapseInMessageContext); } } catch (Exception e) { handleException("Unexpected error during sending message out", e); } }