STOMP v1.1 SupportProbably the biggest change in ActiveMQ 5.6 is that we now support STOMP v1.1 but that's not the only thing we've done, there's plenty of new goodies even if you are stuck using a STOMP v1.0 based client. With the addition of STOMP 1.1 support STOMP you get:
- protocol negotiation to allow for interoperability between clients and servers supporting successive versions of STOMP
- heartbeats to allow for reliable detection of disconnecting clients and servers
- NACK frames for negative acknowledgment of message receipt
- Support for virtual hosting.
Other New STOMP Features and FixesOf course support for STOMP 1.1 isn't the only thing we added to our STOMP support, there's several other new goodies in there as well. Lets take a look at what else you can now do with the STOMP Transport in ActiveMQ 5.6.
Queue BrowsingA normal subscription on a queue will consume messages so that no other subscription will get a copy of the message. If you want to browse all the messages on a queue in a non-destructive fashion, you can create browsing subscription. To make a a browsing subscription, just add the
browser:trueheader to the
SUBSCRIBEframe. For example:
SUBSCRIBE id:mysub browser:true destination:/queue/foo ^@
Once the broker sends a browsing subscription the last message in the queue, it will send the subscription a special “end of browse” message to indicate browsing has completed and that the subscription should not expect any more messages. The “end of browse” message will have a
browser:endheader set. Example:
MESSAGE subscription:mysub destination: message-id: browser:end ^@
The Queue browsing support works for both STOMP 1.0 and STOMP 1.1 clients so you don't need to upgrade your client in order to take advantage of this new feature.
Message Selectors and Numeric ValuesPrior to the 5.6 release you couldn't specify a numeric selector expression on a STOMP subscription, this has now been fixed so you are free to subscribe to a destination via STOMP using selectors such as the following:
SUBSCRIBE id:mysub selector:someId = 42 destination:/queue/foo ^@
With this subscription any JMS Message's sent to this destination with an numeric message property named 'someId' and a value of 42 will be picked up as expected.
STOMP+NIO+SSL TransportIn 5.6 we've added NIO+SSL transports for both Openwire and STOMP clients which allow you to connect large numbers of SSL based STOMP clients to a single broker instance. You can configure a STOMP+NIO+SSL TransportConnector in you broker as follows:
transportconnector name="stomp+nio+ssl" uri="stomp+nio+ssl://0.0.0.0:61616"
STOMP 1.0 default heartbeat configurationUnlike STOMP 1.1 the original STOMP 1.0 does not provide for an inactivity monitor since there was no defined hear-beat capability. A client connect that stays idle will remain active on the broker indefinitely. With STOMP 1.1, the inactivity monitor has come into play in response to the
heart-beatheader. Since not all your clients might not be upgraded to STOMP 1.1 right away we added the capability to specify a default
heart-beatvalue to the transportConnector so that you can still timeout idle STOMP connections. You can setup this default value on your connector as follows:
In the absence of a heartbeat header, as in the STOMP 1.0 case, this default value would cause an InactivityMonitor with read check interval of 5 seconds to be installed on each new broker stomp transport connection. Any client that remains inactive (sends no messages) for more than 5 seconds will have their broker connection closed. You should tune this value based on the exceptions of the behavior of you clients.