Messaging for the Internet of Things
Messaging for the Internet of Things
As we embed processing power to a lot of our everyday things. The thing will need to communicate with a server to send data or get data . The thing needs data in order to make something happen. The thing needs to send data so that we can be smarter on how we use the thing. But How do we send data to a central server that is robust, asynchronous and reliable ?
MQ, what is old is new Again
MQ or Message Qeueing is new again in the age of the Internet of Things. Messaging Patterns for the enterprise has been around for ages. What were the major reasons that messaging addresses ?
1. Networks are unreliable - data needs to be transported over the network. These networks are a conglemeration of different types of network. Since we do not have control of over most of the network that we use to access the internet. The network will present a lot of problem specially when you are sending messages across the internet.
2. Networks are slow - The network that we are using to use the internet is mostly aging. Again, not having control how some of the networks that we might use to send data over the internet it can have performance implications.
3.Application are different - Using messaging any application can listen or subscribe to the message as long as it can be parsed or consumed by the application subscribing to that message.
4. Change is inevitable - in the internet of things, we can put more processing power in more things. There will probably be a need to add more devices that will send data over time. We might need to change the servers where it send data to as well as it gets updated.
These are the same issues that the Internet of Things will encounter.
Messaging Patterns
Since messaging allows high-speed, asynchronous, program to program communication with reliable delivery it is only but natural to be adopted in the internet of things. But why use messaging for the Internet of Things ?1. Asynchronous communication - Messaging enables a send and forget approach to communication. Since most of the connected devices would be somewhere remote. These devices does not have to wait for the receiver to receive the message. 2. Throttling - The issue with synchronous communication or call to a server like HTTP. A lot of connected devices can
overload the receiver which can cause performance degradation on the server. Messaging will help control the rate at which the receiver can consume the requests.
3. Disconnected operation - most of the time an internet of thing device will be used in a low-power autonomous setting. Low power consumption can be achieved by not doing a lot of communication with the server. During those time that the device tries to communicate and the network is not available it can queue up the messages and synchronize when the network becomes available.
Asynchronous Communication
Since messaging using MQ can be done asynchronously. A different kind of approach is required for designing applications like the use of callbacks and other result notification patterns.Since messaging has been around for a while we can adapt certain patterns that have been used in the enterprise to the internet of things. Sample patterns [for a complete list please go to website in the reference at the end of this article]:
1. Guaranteed Delivery - make messaging persistent so that they are not lost if the messaging system crashes. The messages are stored locally until it can be successfully delivered.
2. Datatype Channel - provide a separate channels for each type of message. The sender knowing what message to send can choose the appropriate channel to send it thru. The receiver knowing what channel the data was received from will know the type of message it receives.
3. Publish-Subscribe Channel - delivers a copy of the message to multiple subscribers.
Conclusion:
Messaging systems like MQTT will be an essential infrastructure to the internet of things. We should learn from the patterns that we learned from creating enterprise software that leverages messaging and apply the experience when rolling out devices for the internet of things.Reference:
1[http://www.enterpriseintegrationpatterns.com/patterns/messaging/Introductio
n.html]
Comments