br24-event
v1.0.0-rc.1
Published
## Install
Downloads
3
Readme
@sep/br24-event
Install
yarn add @sep/br24-event
Usage
import EventManager, { Event } from '@sep/br24-event';
const em = new EventManager<Event.Database.Notification>({ topic: '<topic_name>' });
em.publish({
channel: 'change',
payload: {
table: 'articles',
action: 'UPDATE',
newArticle: {
// ...
},
oldArticle: {
// ...
},
},
});
const subscription = em.subscribe('<subscription>', {
flowControl: {
allowExcessMessages: false,
maxMessages: 3,
},
});
subscription.on('message', (message) => {
const payload = em.parse(message);
// ...
});