-
-
Save geggleto/29614279acee4912a7d9bdf26cd1a7ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bus = servicebus.bus({ | |
url: "amqp://user:pass@localhost:5672, //RabbitMQ or any other AMQP supporting service | |
}) | |
//Export the bus so that somewhere else can listen | |
//In component A - This can be on a different physica/virtual server | |
bus.subscribe('my.event', function (event) { | |
bus.publish('my.event.conclusion', { something: 'happened' }); | |
}); | |
//In component B - This can be on a different physica/virtual server | |
bus.subscribe('my.event.conclusion', function (event) { | |
}); | |
//In component C - This can be on a different physica/virtual server | |
//Maybe I care about all of these types of events | |
bus.subscribe('my.*', function (event) { | |
//Log or do something | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment