0

I'm trying to implement my specific transport for WSO2 ESB based on some proprietary binary protocol. From protocol specification I need acknowledge every packet I receive only if I'm 100% sure that it will be processed in future. For those reasons some persistent store must be used.

I want to implement that protocol logic via WSO2 ESB sequence that gets protocol packets/messages and stores them to temporary messageStore which is used as a queue in producer/consumer pattern (where producer is transport itself and consumer is my packet processor).

I have to be sure that my packet got to the messageStore before sending acknowledge to the client. But AxisEngine.receive() does always return CONTINUE even if message store is not available.

The configuration of the proxy is:

<proxy name="MyProxyService">
    <target>
        <inSequence>
            <store messageStore="MyStore" sequence="onStoreSequence"/>
        </inSequence>
        <outSequence>
            <send/>
        </outSequence>
        <faultSequence>
            <makefault version="soap11" response="true">
                <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/>
                <reason expression="get-property('ERROR_MESSAGE')"/>
            </makefault>
            <send/>
        </faultSequence>
    </target>
</proxy>

The code I use in transport is:

MessageContext msgContext = confContext.createMessageContext();
AxisConfiguration axisConf = confContext.getAxisConfiguration();
try {
   msgContext.setTransportIn(axisConf.getTransportIn(transportName));
   msgContext.setTransportOut(axisConf.getTransportOut(transportName));
   msgContext.setIncomingTransportName(Constants.TRANSPORT_LOCAL);
   msgContext.setAxisService(axisConf.getService("MyProxyService"));
   msgContext.setEnvelope(TransportUtils.createSOAPMessage(msgContext));
   msgContext.setServerSide(true);
   Handler.InvocationResponse response = AxisEngine.receive(msgContext);
   log.error(String.valueOf(response));
} catch (Exception e) {
   log.error("ERROR", e);
}

The behaviour I want to have is what I see in HTTP transport: http request from the client (SOAP UI) is translated to Axis2 MessageContext and delivered to MyProxyService. If everything is ok - I get positive response, otherwise - error code and SOAP fault.

Community
  • 1
  • 1
revenforv
  • 103
  • 5

1 Answers1

0

After additional investigation I can say that idea behind HTTP transport request/response is that for sending response the HttpSender not HttpReceiver is used. HttpReceiver gets request from HTTP connection, sets link to HTTP connection to the message context, uses AxisEngine.receive() to deliver message to the ESB and returns.

HTTP response itself is received via HttpSender, identified as response to the previous request (via empty To header) and sent to the connection referenced from the message context.

revenforv
  • 103
  • 5