0
votes

I have a proxy service which is exposed on http. After receiving the request the service validates it against its schema. Now if a validation fails, the service should send back client an error response and should also send that error message to a queue.

<validate [source="xpath"]>
   <property name="validation-feature-id" value="true|false"/>*
   <schema key="string"/>+
   <on-fail>
      mediator+
   </on-fail>
</validate>

Problem:

I am making a custom message in "Validate" mediator "on-fail" sequence. I am sending back that message by using "Response" mediator. After sending back the response I want to send this same error message to a jms queue. But the problem is that after "Respond" mediator, no mediator works and if I put "Call" mediator" before the "Respond" mediator, only message is sent to queue, no response is sent back to client.

Things to achieve: To summarize, I need to do following two things in a validate mediator fault sequence.

  • Send Back the Response to client.
  • Send the response to a queue.

how can I achieve that or is there any alternative approach to achieve this task?

1
One thing to add that WSO2 does not allow us to put any mediator after "send" mediator.omer khalid

1 Answers

2
votes

When you say

I am making a custom message in "Validate" mediator "on-fail" sequence

I assume you are using payloadFactory. So , once you have built you're custom message , you can use the < clone > mediator to send the message to 2 destinations like so :

<clone>
    <target> 
        <sequence>
            <respond/>
        </sequence>
    </target>

    <target>
        <sequence>
            <send>
                <endpoint>
                    <address uri=""/> <!-- Specify the JMS connection URL here -->
                </endpoint>
            </send>
        </sequence>
    </target>
</clone>

Hope that works for you!