MessageBroker
MessageBroker provides framework agnostic, decoupled communication between publishers and subscribers. This library is fully type safe and works in both browsers and Node.js. MessageBroker is built ontop of RxJS providing access to observables and a comprehensive list of operators.
Full documentation can be found at https://morganstanley.github.io/message-broker/
Basic Usage
First, install the message-broker
npm install @morgan-stanley/message-broker
then you can start sending and receiving messages like this
import { messagebroker, IMessageBroker } from '@morgan-stanley/message-broker';
interface IContracts {
myChannel: {
payload: string;
};
}
const broker: IMessageBroker<IContracts> = messagebroker<IContracts>();
broker.get('myChannel').subscribe((message) => {
console.log(message.payload);
});
broker.create('myChannel').publish({
payload: 'My first message using the MessageBroker!',
});
Development
For guidelines on how to contribute please click here.
Here are a list of commands to run if you are interested in developing or contributing to the project.
npm install
npm run test
npm run watch-test
npm run lint
npm run build
npm run watch-build
npm run build-release