node-ts / bus

A typescript based enterprise service bus framework based on enterprise integration patterns
https://bus.node-ts.com/
MIT License
270 stars 26 forks source link

integration questions #135

Closed gocandra closed 2 years ago

gocandra commented 3 years ago

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

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

adenhertog commented 3 years ago

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 commented 3 years ago

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