skip to Main Content

We have two applications App1 and App2.

App1 – Legacy search application on Java6 (being upgraded to Java 8) with legacy UI; Request payload is a complex string delimited structure

App2 – Java 8 on TomEE 1.7 with accepting Json request payload

Requirement – App2 needs to invoke the App1 service

Currently, App2’s UI makes a call to App2 server with JSON payload. App2 server converts JSON to App1 understandable String delimited payload and invokes App1 service. On receiving the response from App1, App2 server converts the response to App2 UI understandable Json

Question – Could there be a better solution avoiding the hop to App2 server side and then to App1? Any better approach like utilizing API Gateway / NGinx / Mod Proxy?

2

Answers


  1. I don’t see any way of avoiding the hop, particularly because App2 is performing data transformations in both directions. My only suggestion is to verify and ensure that your chosen solution is creating a persistent connection to the App1 service. If you’re opening and closing the TCP connection with each request, then that’s an easy place to optimize.

    Login or Signup to reply.
  2. The protocol translator between App1 proprietary "string delimited" protocol and a JSON protocol is implemented in App2 server. A better approach would be to add an additional endpoint to App1 server which accepts JSON requests.

    Each App1 client could choose if it wants to use the old "string delimited" or the new JSON protocol to communicate with the search service. App2 is now able to speak JSON with App1 and the code for the "string delimited" client could be removed from App2.

    This is called "content negotiation" and a good way to migrate from an old proprietary protocol to a more standardized JSON-based RESTful API.

    If the App2 UI client cannot communicate directly with the new App1 server (because the JSON formats of the payloads aren’t compatible and need some mapping), you can take a look at some JSON-to-JSON mapping tools, like JsonToJsonMapper.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search