Implementation of Stomp 1.1 support is based on existing Stomp 1.0 code base in HornetQ. With Stomp 1.0 support, HornetQ uses a StompProtocolManager to handle
Stomp frames. It acts as a mediating layer between Stomp functionalities and the HornetQ core. It translates Stomp requests into core operations and deliver messages
from core layer to Stomp clients. It also has a StompDecoder to decode Stomp 1.0 frames from the network data stream.
The Stomp 1.1 (http://stomp.github.com/stomp-specification-1.1.html) is a new version of Stomp 1.0 compatible spec, with a few enhancements, such as:
Version negotiation: Clients can negotiate with the server on which version to use via Stomp CONNECT frame.
Two-way heartbeat functionality: clients and servers can accept or issue 'heartbeat' frames to keep the connection alive or achieve failure detection.
new frames like NACK and STOMP.
Header character escaping.
Virtual hosting.
And so on. But in general the main formats and functionalities of Stomp 1.0 and 1.1 are same.
To support Stomp 1.1, the following changes are done.
1. Move the Stomp frame handling from the StompProtocolManager into separate versioned frame handlers. There are two frame handlers, one for Stomp 1.0 frames and the
other for Stomp 1.1.
2. Decoding (StompDecoder) is also handled in the frame handlers of corresponding versions.
Because of the similarity between Stomp 1.0 and 1.1. Much of the existing code for 1.0 can be reused.
Working branch: