This is a generic component that can wraps "any" PubSub client/broker in your own repository and strategy provider.
Run the following command to install
npm i -s loopback-pubsub-component
loopback-pubsub-component package is installed, bind it to your application with
Create a repository
Create a repository that implements your client/broker logic, here an example for a simple EventEmitter. You could create several repositories, with MQTT client or other kinds of PubSub clients.
Create a strategy provider that implements your custom logic. If you have several repositories, inject them and create a function to switch between repositories with trigerName filtering.
Use in a controller
Inject the bindings, to make available PubSubStrategy provider functions.
- Adding decorator to use it like a router in a Controller ( @publish, @subscribe ... ) and control access ( when using broker )