Oracle Mediator, the-always-give-response-pattern by using the Echo-reply

In my usecase i subscribed to an eventbus solution (rabbitmq with some custom code to be able to publish to consumers based on the soap protocol).

The backend system which generated the notications can generate the next type of events :

— employeename got changed
[code language=”xml”]

EMPLOYEE
EMPLOYEE

[/code]

— employee contactaddress got changed
[code language=”xml”]

EMPLOYEE
ADDRESS

[/code]

The current subscription mechanism only allows me to subscribe based on the value of entity.
Since i’m not interested in all EMPLOYEE related events i need to do the filtering myself.

When i register myself as consumer on the event i need to configure a soap endpoint at which the event bus will deliver the soap envelope.
The definition of this soap interface defines a http sync operation. (http 200)

This means, when the event bus tries to deliver an event and it receives back a soap response with http200, the message will be removed from the queue (i have 1 queue dedicated for my consumer application).
When the event bus tries to deliver an event and it receives back a empty response with http202, the publish on the event bus will fail since it checks on a valid soap body response.

So..this is a bit of background information.

The event bus publishes the event to our Oracle SOA Suite 12c platform. We store the events and have polling interfaces which process the events based on entity values.
To process events as soon as possible i was playing a bit with the meditor for filtering the messages. This all works ok.
Problem : when i was sending an event which wouldn’t pass the filter of the first (and only) routing rule, i would receive a http202.

Since the event bus won’t remove the event (since it’s received http202), the event will end up in a retry-sitution, this is not wanted.
I want to reply back a http200 in both situations (events i’m interested in and events i’m not interested in).

Let’s copy/paste some code from my mediator

[code language=”xml”]






(
($in.notification/nce:notification/nce:entity = ‘EMPLOYEE’ and $in.notification/nce:notification/nce:subentity = ‘EMPLOYEE’)
)













[/code]

When i send a event EMPLOYEE/EMPLOYEE combination this will pass the filter restriction and it will be stored (http200 will be send back to the client).
When i send a event EMPLOYEE/ADDRESS combination this will not pass the filter restriction (http202 will be send back to the client).

Now let’s make use of the “Echo Reply” routing rule type.

[code language=”xml”]






(
($in.notification/nce:notification/nce:entity = ‘EMPLOYEE’ and $in.notification/nce:notification/nce:subentity = ‘EMPLOYEE’)
)



















[/code]

I’m using the “Sequential routing rule” option to force the mediator to evaluate the routing rules in the order they’re added to the mediator.

If an event matches the first case filter, it will pass on the event and it will pass on the response from the backend system.
If an event doesn’t match all the filters of all the cases it will end up at the “otherwise” (last routing rule) case. Since this one just sends back and echo with the ok response from and xslt, the event bus will receive the http200.
Now both wanted and unwanted events will be removed from the event bus.

I could have added extra routing rules to define the opposite of for example the =’EMPLOYEE’ (!=EMPLOYEE) expression but then you will arrive at the problem of defining the opposite of (=’EMPLOYEE’ AND =’ADDRESS’)
which means i need to list all the possible event types and exclude them (mathematical negation ?).

A lot of non Oracle Mediator related information, sorry ;). Just wanted to share my first ever use of the mighty “Echo reply” routing rule 😉

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

Comments are closed.