login button

Multiple endpoints and conditionals?

Forums :

I need to work in some conditional logic to one of my proxys

Example scenario (see diagram for guide in following along)

  1. ESB receives HTTP SOAP message from client
  2. ESB transforms the SOAP payload as part of in sequence
  3. ESB sends to endpoint #1
  4. Endpoint #1 responds
  5. ESB receives response from endpoint and begins processing an out sequence
    1. (5.1) As part of out sequence, validity of response is checked
    2. (5.2) If good, original message is used, and target endpoint set to endpoint #2
    3. (5.3) If bad, the response is returned to user (step 9)
  6. ESB sends to endpoint #2
  7. Endpoint #2 responds
  8. ESB receives response from endpoint #2 and begins processing a different out sequence
  9. Payload from the outsequence sent back to the client


After doing transformations in step 2, I lose the original message content received in step 1.

I don't think I can use cloning because that happens in parallel and in this case there is synchronous dependencies (only send to second endpoint if first endpoint was ok).

How can I get a message from one endpoint and direct it to another?

-Lucas

AttachmentSize
Drawing1.png20.31 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi Lucas, What you need is a

Hi Lucas,

What you need is a blocking call to the first endpoint. Try to understand the callout mediator and use it for the first sending and use a normal send mediator with an endpoint for the second endpoint.

Refer to the callout configuration for more details;
http://wso2.org/project/esb/java/1.7.1/docs/ESB_Configuration_Language.html#callout

and this sample
http://wso2.org/project/esb/java/1.7/docs/ESB_Samples.html#Callout

Thanks,
Ruwan Linton

Thanks Ruwan. A callout

Thanks Ruwan. A callout worked nicely in this case.

Previously I found that I could reuse an outsequence multiple times, but that obviously lost important information needed in the original message context that the callout mitigates.

-Lucas

Lucas Ruwans suggestion will

Lucas

Ruwans suggestion will work for your requirement. If you do not want to block using the callout, you can set a copy of the original message into the message context as a property using a script mediator, and when necessary pick it up again and replace the current message for step 5.2. You can use a scripting language such as groovy for this

asankha

asankha, You read my mind on

asankha,

You read my mind on using properties and manipulating with script mediator. My chain of events looks something like this..
1. property mediator to retain some values
2. script mediator to manipulate payload
3. callout mediator to do some intermediate actions on modified payload
4. script mediator to manipulate payload, reassigning properties captured.
5. final endpoint

-Lucas

Lucas If my suggestion

Lucas

If my suggestion works, you will not need to use the callout mediator and block waiting for its response. One of the WSO2 engineers from my team will take a look at a sample to show this in the next few days

asankha

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.