سؤال

I have simple scenario, I have WSO2 ESB instance and I built sequence for processing message, where one step of this sequence is content enrichement of message body. Informations, which should be added into enriched body, are available over REST webservice deployed somewhere else on application server. I wasn't able to find working solution with default mediator set (I know, there is posibility to write my own mediator). Enrich mediator itself doesn't have this capability. I found similar solution in book from PacktPub, sample is called content enricher, but it uses database () as source for future enrichement and Enrich mediator isn't used there. Is there any solution for this or I am on wrong way?

Thanks in advance.

هل كانت مفيدة؟

المحلول

For my understanding, what you are trying is, at some point you want to alter the message(enrich) using some data, But that required data, you need to get from an REST endpoint.

If this is the case;

What you have to do is,

Before enriching, call your REST endpoint and get the response first. From that response, extract the data you needed. Use that extracted data in the enrich mediator to enrich your new message payload.

This type of scenario is called service chaining. You have to use proper mediators in place to achieve your final requirement.

Edit:
//I want to have still the same message at the end of chain//

1)So, store your initial message in a property mediator(with type=OM)

2)Then call your REST endpoint and get data and extract needed value.

3) Then use enrich mediator to enrich the previously stored message.

4)Then again use enrich mediator to convert that property to soapbody

5)Send that to client.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top