I’ve an utility which primarily offers with enterprise workflow administration. On this, there are going to be many occasions which will likely be processed async. The appliance raises the occasion and these occasions are pushed to the cloud service bus. We’re on GCP and utilizing GCP’s pub-sub as service bus.
As soon as the message is obtained on pub-sub, I take advantage of the google cloud operate to work with these occasions.
On processing the messages, the actions could possibly be many, like
- Ship Notification
- Replace the database
- Construct search index
- Audit occasions to OLAP
In lots of instances the actions contain, including/updating the first database.
for e.g. For instance if person updates the workflow information, the exercise log could possibly be processed through pub-sub and subsequently up to date to the database.
The best way my utility is structured is that there are 2 separate functions:
- “core” – nodejs, categorical based mostly API which is the principle utility api layer. This API the occasions
- “task-hub” – nodejs, categorical based mostly API, however hosted as cloud capabilities on google. That is liable for processing the occasions
The “task-hub” utility works with lots of the similar entities because the “core”, like WorkflowData, WorkflowActivityLog and so on.
Is it a good suggestion to have “task-hub” instantly entry the database through its personal providers or does it make sense to maintain the API’s on the “core” API and task-hub to make internet http requests to work together with these API’s?
The professionals of getting the direct interplay to database are
- Simpler to jot down and handle
- No overhead on making one other http name and managing the potential failures of these requests
- “core” api needn’t deal with these further requests (although this won’t be a difficulty, since its simply upserts)
On the opposite facet
- It seems like logic is distributed throughout a number of functions
I might have isolate all the service in a separate bundle and re-use throughout each, nonetheless thats an excessive amount of of refactoring which I will not be to undertake now.
Additionally, my utility being nodejs utility, would not make this effort any simpler.
I want to hear some ideas on how I might clear the separations.