SOA – How to Share Data Between Web Applications

databasesoa

I have two web applications, say Application_1 and Application_2.

Application_2 has a database table named table_2, which changes infrequently, and needs to be accessed by Application_1.

Does it make sense to create a table_2 table in Application_1 and update it with an ETL task?

A straightforward solution would be expose the data through a REST API in Application_2, but this will break the decoupling between both applications and introduce a new point of failure in Application_1.

Best Answer

Since you tagged the question with SOA, I suspect that you're thinking the right answer might be using a service interface. Such a service interface should not expose the data, but the functionality you want to provide as a contract to be exposed by one application and consumed by the other application.

As the question is being asked in the abstract, this contract could range anywhere from providing answer to a very specific lookup to an event stream notifying the consumer of changes.

Either application (i.e. on either or both sides of the service interface) can make use of caching (copy of table) if they need to, but caching is an optimization that should not be prematurely applied.

Either way, these applications are coupled. The ETL job you suggest will also couple the applications and probably result in a more poorly understood contract between the them than a well-designed service interface.