STOMP provides a simple yet flexible messaging protocol. It also offers an extensible way for brokers to provide additional features beyond the ones specified in the protocol.
In this chapter, we will show how to leverage broker features with STOMP headers. Until this chapter, all STOMP brokers could be used to send and receive messages from our applications but in this chapter, you will have to check your broker documentation to see if it provides these features (or others not covered by this chapter).
Some STOMP brokers support persistent messages
to ensure that if a message is held by the broker when it crashes, the message will be persisted (that means stored on a durable support) so that the broker can
fetch it when it restarts and handle it again. This prevents any data loss (at the cost of performance since the broker must ensure that the message is effectively
written on the storage support).
To use persistent messages, most STOMP brokers (including ActiveMQ) require that the message must be sent with a
persistent header set to
Locations application we send two types of messages: one for with the device location and one for text messages.
The location messages do not need to be persisted and survive a broker crash. It has minimal consequences if these messages are lost if the broker was crashed. Once the broker is up again, the device will send updated position.
However for the text messages sent to the devices, we want ...