Suresh Rohan's Blog

This blog is all about Java, J2EE,Spring, Angular, React JS, NoSQL, Microservices, DevOps, BigData, Tutorials, Tips, Best practice, Interview questions, Views, News, Articles, Techniques, Code Samples, Reference Application and much more

Friday, October 16, 2015

Pattern: Smart Proxy


Pattern: Smart Proxy

How can you track messages on a service that publishes reply messages to the Return Address specified by the requestor?



In order to track messages flowing through a service, we need to capture both request and reply
messages. Intercepting a request message using a Wire Tap is easy enough. Intercepting reply
messages is the tough part because the service publishes the reply message to different channels
based on the requestor's preferred Return Address.


Use a Smart Proxy to store the Return Address supplied by the original requestor and replace it with the address of the Smart Proxy. When the service sends the reply message route it to the original Return Address.



The Smart Proxy intercepts messages sent on the request channel to the Request-Reply service. For each incoming message, the Smart Proxy stores the Return Address specified by the original sender. 

It then replaces the Return Address in the message with the channel the reply channel that the Smart Proxy is listening on.

When a reply message comes in on that channel, the Smart Proxy retrieves the stored Return Address and uses a Message Router to forward the unmodified reply address to that channel.

No comments:

Post a Comment