Review this generated subscription before it handles production orders.
Register at most once, format valid string ids with the instance prefix, never log tokens, and make stop remove the exact registered callback.
JavaScript
class OrderFeed {
constructor(bus, prefix) {
this.bus = bus;
this.prefix = prefix;
}
start() {
this.bus.on('order', (order) => {
const id = order.id.trim();
console.log(`${this.prefix}:${id}:${order.token}`);
});
}
stop() {
this.bus.off('order', (order) => {
const id = order.id.trim();
console.log(`${this.prefix}:${id}:${order.token}`);
});
}
}
generated code is illustrative, not from any one model