📜 ⬆️ ⬇️

Implementing a proxy server on the integration bus

The solution is implemented in one of the rather large banks for caching requests to information systems (IS).

Formulation of the problem


Tibco Business Works JMS queues (BW) receive XML requests in canonical format:

<request> <service>service_name</service> <client>client_id</client> <requestData>request_data</requestData > <replyTo>response_queue</replyTo> </request> 

Here:


BW analyzes the service_name and redirects the request to the incoming queue of the corresponding service.
')
The service parses the request, forms the response and sends it to the response_queue queue. Answer format:

 <response> <service>service_name</service> <client>client_id</client> <responseData>response_data</responseData > </response> 

Where:

Some services respond in a few seconds, and sometimes in tens of seconds. It is too long for the customer. However, sometimes requests are repeated after a sufficiently short period of time to receive repetitive replies. In general, the standard situation for a proxy server (proxy).

Proposed solution


Proxy is organized as a separate service with its incoming JMS queue. The body of the proxy request is:

 <request> <service>proxy</service> <client>client_id</client> <requestData> service_name request_data live_time </requestData > <replyTo>response_queue</replyTo> </request> 

Where:
live_time - time of response from service service_name .

Proxy service:

• based on the parameters service_name and client_id, the proxy searches in its repository for the actual response from the service service_name for the client client_id
• If there is an answer, it is sent to the response_queue queue as a response from the service_name service.
• if there is no answer, a request is made to the service_name service

 <request> <service>service_name</service> <client>client_id</client> <requestData>request_data</requestData > <replyTo>proxy_response_queue</replyTo> </request> 

where proxy_response_queue is the JMS queue of the proxy service for IP responses; while the request itself is saved
• when an IP response is received in the proxy_response_queue queue, it is stored in the repository; then retrieves the saved query; based on the request and response of the IS, a proxy response is generated:

 <response> <service>service_name</service> <client>client_id</client> <responseData>response_data</responseData > </response> 

and placed on the response_queue queue.

It's all for today. If there is interest, I will explain some points in more detail.

Source: https://habr.com/ru/post/340754/


All Articles