Skip to content
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

integration questions #135

Closed
gocandra opened this issue Sep 14, 2021 · 2 comments
Closed

integration questions #135

gocandra opened this issue Sep 14, 2021 · 2 comments

Comments

@gocandra
Copy link

i'm building a simple system consisting of an orchestrator and three microservices.
should I define event classes in each service? or should I create an npm module with all message (commands / events) definitions?
I'm thinking something like this

  • @org/bus-module
  1. init method to instantiate rabbitmq
  2. export all message definitions
  3. publish method that abstracts rabbitmq connection and bus.publish() method
  4. export HandlesMessage method as is
  • service#1 / servie#2 / servie#3
  1. import @org/bus-module
  2. on server start init rabbitmq
  3. on each controller import HandlesMessage and corresponding event class
  • orchestrator
  1. import @org/bus-module
  2. on server start init rabbitmq and sql
  3. on each controller import publish method and corresponding command class

Would this implementation be correct? Is there any example of a different and better way?

@adenhertog
Copy link
Contributor

should I create an npm module with all message (commands / events) definitions

This is usually the easier path to take. A separate module that only contains your message definitions and is imported into your orchestrator and services.

This way your dependencies will stay loosely coupled, whilst still allowing any service to publish/subscribe to any message.

@gocandra
Copy link
Author

Fantastic! thank you very much for the quick reply! I'll try and contribute an article with a concrete implementation.
cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants