Message Replaying
Replaying will allow new subscriptions to receive the latest ānā number of messages. Using the messagebroker config the user can configure how many messages they want to be cached when subscriptions are made. Configs can only be provided when the messagebroker channels are created.
import { messagebroker } from "@morgan-stanley/message-broker";
messagebroker()
.create('myCachedChannel', { replayCacheSize: 2 })
.publish({
payload: 'a message to all new Subscribers!'
});
It is important to note that creating a channel with the same name but with different configurations will throw an error.