Sunday, June 12, 2016

What would you chose AMQP or MQTT ?

WSO2 Message Broker currently supports both AMQP and MQTT protocols. whether to use AMQP or MQTT was a frequent question i came across. The answer would subjective in my opinion, in simple terms both protocols has its own advantages, hence i would like to share a few of my findings on various strengths of both these protocols.

Large Messages Transmission
Uses buffer oriented approach and supports fragmentation, hence it’s more suitable in comparison
Stream oriented protocol, does not support fragmentation. Hence more suitable for smaller size messages
Message Exchanges
Supports both topics and queues, suitable for long lived messages
Optimized for active routing, publisher-subscriber based.
Transactional Support
Supports different level of transactions and acknowledgment modes i.e distributed XA transactions, client acknowledgement, auto acknowledgment  
Supports three acknowledgment modes. Specifically focusses on exactly once delivery
Connection Security
Supports standard TLS through SASL.
Supports basic auth and SSL. Security is embedded into the protocol itself. This requires security changes to be included in the protocol itself.  
Last value queues
Does not support explicitly
Supports this in the form of RETAIN flag.
Reliable Messaging
Supports reliability using different acknowledgment modes and session durability
Supports reliability using different acknowledgment modes and session durability  
Supports native failover
Need to support failover explicitly

Depending on the enterprise needs the above selection of protocols could defer, AMQP is a more matured protocol in comparison to MQTT and its readily available for the use of enterprise requirements, however AMQP is more heavy weight than MQTT which makes it less suitable for devices running in low powered and constrained network environments.

What if you want to use both these protocols? I would be discussing on how protocols could be switched in my next post.

No comments:

Post a Comment