miércoles, 8 de octubre de 2014

... service with variable number of bindings in SwitchYard


Variable bindings

What we are trying to achieve is a functionality in where we have a generic application (I216_APP) that does some common logic with the contents of some files read from the filesystem. The files that this application has to read depends on the main "role" of the platform, so it can be "Local" or "Global" or both. We want to deploy a an application that there is no need to be modified to make it work in both 3 of the scenarios. As endpoint url are defined at application start up, and number of bindings in any application is fixed, we have following options:
  • Mock the endpoints. Endpoints not available on specific geography will be mocked, that will incurr on useless polling and wasting of resources.
  • Split implementations according to geography. Tight coupling between implementation and geography and duplication of code.
  • Stop bindings per "role". Difficult to make automated. Tight coupling between implementation and geography and duplication of code.

Proposed solution

Create 2 new applications that will contain the appropiate file bindings per role, "global" and "local", that will read the files and delegate into the real I216_APP.
This I216_APP service binding will then be changed to SCA, so can be called locally from any other application (with minimal cost).
Implement a direct routing in the new applications with following logic:
from("switchyard://FileService")
.to("switchyard://I216_APP")
In this way, this new applications (file services) will have the responsibility of reading the corresponding files per platform role, "local" or "global".

Local role

In this platform role scenario, only the I216_APP_Local and I216_APP applications will be deployed, and will allow the platform to read "local" files and delegate the processing responsibility to the I216_APP.

Global role

In this platform role scenario, only the I216_APP_Global and I216_APP applications will be deployed, and will allow the platform to read "global" files and delegate the processing responsibility to the I216_APP.

Local + Global role

In this platform role scenario, the 3 applications will be deployed altogether, and will allow the platform to read "local" files and "global" files and delegate the processing responsibility to the I216_APP.

No hay comentarios: