-
Notifications
You must be signed in to change notification settings - Fork 60
Persistence Opt out
The Persistence system allows for a safer way of sending messages, but it comes at a cost, it impacts performance. While it will still be possible to send tens of thousands of messages per second, persistent messages imply sending twice as much messages on the network, which is not free.
So when a user needs the extra performance and can afford to lose a message (which only happens in rare occasions, since we rely on TCP), it is possible to disable the Persistence system.
By decorating a message class with the Transient
attribute, it is possible to disable the Persistence mechanism for a specific message. This way a copy of the message won't be sent to the Persistence Service when it is sent, and the receiving Peer won't acknowledge processing it.
When starting its Bus, a Peer can set the IsPersistent
property in the Bus configuration (off by default if using the BusFactory). If the property is set to false
, the messages sent to this Peer won't be sent to the Persistence.
In order for a Message to benefit from the Persistence feature, it must not be decorated as Transient
AND the receiving Peer needs to be Persistent.
Message marked as persistent | Message marked as transient | |
---|---|---|
Service marked as persistent | ✔️ persisted | ✖️ not persisted |
Service marked as transient | ✖️ not persisted | ✖️ not persisted |