-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
Send events even if no service is registered in the Service Registry #426
Comments
The problem is here: moleculer/src/service-broker.js Lines 1080 to 1081 in 6e76848
But there are other problems too. The |
Hi mathias, The broker.start().then(() => {
setInterval(() => {
broker.emit("test.event", { ddata: "this is test data" }, ["group"]);
}, 2000);
});
nats.subscribe("MOL.EVENTB.group.test.event", { queue: "group" }, message => {
broker.logger.info("nodejs-subscriber: Test event received with payload:", message);
}); I will fix the |
Thanks! I will try this approach ASAP. |
It seems to work! Thanks a lot. Should I leave my demo project public so you can use it to test the |
Not need it. I've created a simple dev example to demonstrate it: https://github.com/moleculerjs/moleculer/blob/fix-426/dev/no-balancer.js |
Is your feature request related to a problem? Please describe.
I am building a system of micro services that broadcast events. One of the services will be a Moleculer service.
Even with
disableBalancer: true
Moleculer will only publish events to the transporter (NATS in my case) if another Moleculer service is registered in the Service Registry of Moleculer. If not no events will be broadcasted.If you use Moleculer together with other frameworks they will not receive any events unless one of them is a Moleculer service.
Describe the solution you'd like
It would be great to have an option that forces Moleculer to send events to the transporter no matter if another service is registered in the Service Registry or not. This is crucial to be able to use Moleculer in an diverse micro service environment.
I created a small project to show the issue:
https://github.com/mathiasmoeller/moleculer-publish-subscribe-demo
The text was updated successfully, but these errors were encountered: