-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concatenation of mediators #1107
Comments
Hi @delcroip I think if I understand your question correctly this has to do with chaining mediators together to complete a flow of business logic to implement. There are a few ways this can possibly be achieved and depends on your specific needs and constraints (server resources / http request duration's etc). OpenHIM mediators at its fundamentals are just micro services that communicate back to OpenHIM in a specific defined format. A Mediator doesn't technically have to respond to the OpenHIM in the mediator format, but then we dont have visibility into the various orchestrations that took place. The condition of your routing will however sit within the relevant Mediator itself and not in the OpenHIM (The OpenHIM does the routing, not the business logic to be applied). To avoid round trips via the OpenHIM, the Mediators itself should handle this.
|
thank you, We will do it like that but we'll need to hardcode the chaining logic into the mediators meaning that we will have to duplicate the mediator if it needs to be used in different chains event if its other actions don't change Br |
Sure, but this all depends on your implementation and how flexible you need to make it. Your mediator can be developed to accept configuration via Environment variables or other config to make it re-usable and flexible. You can also dockerize the mediator making it much easier to re-use with alternative config, and allow it to better scale horizontally if need be. At Jembi we have also been working on a common Mediator written in NodeJS that could potentially handle this kind of logic if configured correctly. The mediator doesnt require any additional coding and is purely configured via JSON config files to define the endpoint to listen on and the various business logic to apply. We have been making use of this common mediator to define endpoints which contain business logic to call other endpoints and complete our relevant flows: |
Thanks, I need to have a closer look at this one, On our side we develop the same kind of generic mediator using openfn-core as engine br |
Great thanks @delcroip This looks interesting and will dive a bit deeper into this :) |
We were wondering if there is a way to concatenate mediators or routes with openHIM functionality so that e.g. the success of the first mediator triggers the execution of the second one.
We have tried something now by having two mediators A and B where mediator A executes its expression and passes the result to mediator B with a POST request which finalizes the process by also executing its expression and sending back a response but this approach have a performance toll because it generate more traffic (8) isntead of (6)
Traffic using the workarround described
Traffic that should happen
Thanks in advance
The text was updated successfully, but these errors were encountered: