Blog > Social Media > Using Twitter as a Collaboration Message Queue

Using Twitter as a Collaboration Message Queue

ToddAs the web moved more towards mash-ups and other forms of heterogenous applications, there is a need to reliably send messages between these applications leveraging a common interface. While there are services out there that provide Internet-based message queuing, like OnlineMQ, cloudMQ, Amazon Simple Queue Service and others, I think another mechanism is staring us in the face. In looking at Twitter and how tweets are distributed and queued, in essence this really could be a Collaboration Message Queue. Twitter is mainly focused on human interactions. Could it be used as a platform for non-human collaboration?

Wikipedia defines a message queue as follows:

“… a message queue is a software-engineering component used for interprocess communication or inter-thread communication within the same process. It uses a queue for messaging – the passing of control or of content. Message queues provide an asynchronous communications protocol, meaning that the sender and receiver of the message do not need to interact with the message queue at the same time. Messages placed onto the queue are stored until the recipient retrieves them.”

Twitter definitely provided the component necessary to use it as a message queue:

  • RESTful API
  • Ability to send short messages
  • Messages can be broadcast to all listeners
  • Messages can be replied to or directed to specific listeners
  • Messages are queued until picked-up by the listener
  • (Very) limited security in that updates can be kept private to only specifically approved listeners
  • Ability to search messages (may or may not matter)

“Listeners” above would normally be referred to as “followers” for human collaboration.

So, what would a Twitter-based Collaboration Message Queue look like:
Twitter Message Queue

Each application leverages the Twitter API to speak with Twitter. The sending application authenticates to Twitter and initiates a conversation. The conversation can be broadcast to all of the listeners, sent specifically to one listener using an @reply/mention or sent privately to one listener using a direct message. The receiving application also authenticates to Twitter and checks for messages in its queue. Those message can then be read off the queue. Since the order of the messages in maintained, asynchronous communication is possible. Since there are multiple services that integrate with Twitter for sending binary information (think TwitPic) those API’s could also be leveraged to send non-text based messages.

A use case for this might include using Twitter as a way to federate site communication. If, for example, you have an application that sits out at your customer site and want an easy way for your application to send and receive inter-application messages, the Twitter API provides an extremely easy mechanism of accomplishing this. In the example of a workflow-based application, perhaps you want to assign a task outside of your company to a partner also using the same software. The application could send the task into the receiving application’s Twitter queue. The receiving application could then acknowledge the receipt of the task with a response and easily communicate back when the task is completed. Since the application would use the same language, each site is able to establish a dialog with the other sites.

To implement this type of model, each participant application would do the following:

  1. Register a Twitter handle
  2. Mark their updates as private
  3. Each new participant follows the initial participant
  4. The initial participant accepts the follow and follows the requesting participant back

The participants can now send messages into each other using the mechanisms called out above. Additionally, all participants will see broadcasts across the system. Using re-tweets, conversations happening between specific participants could be forwarded on to other participants allowing certain participants to act as distribution hubs.

I am unsure as to the usefulness of this approach. While this allows non-humans to collaborate with little new code, message limits of 140 characters and the fact that conversation security is limited lessen the overall value. Messages longer than 140 characters could be broken down and chunked across multiple messages. Since order is maintained, the listener could put the message pieces back together relatively simply.

I’m fairly sure that Twitter will mainly be a human collaboration platform, but if they’re looking to find some other ways to leverage their infrastructure, you never know. Maybe non-human social networks are the future.

As always, I would love to hear your feedback.

Todd

Miko Lureven April 27, 2009 | 10:28am

seems interesting as distribution queue.
The limitation of char is a killer for MQ and the fact that the service is limited for 7 days and security is limited makes it not attractive for businesses.

But we cannot resist to the fact that cloud message queuing is the future, we have worked with SQS and lately with onlinemq.com
and so far they both rock.

Todd Clayton April 27, 2009 | 11:45am

Hi Miko,

Thanks for the feedback. I agree that these types of services are the future. To me the security is probably the biggest factor, but if the apps are all public facing, perhaps there is still a place for this type of a (free) model.

Have you posted anywhere on what types of projects you are working on with SQS and onlinemq? It would be great to show some additional example.

Thanks,
Todd

Miko Lureven May 14, 2009 | 3:49pm

Well are working in a milking robot arena, which means we have around 5000 robots for milking around the world that check automatically the milk quality, cow feeding and cow health.

Now the European union medical authorities (eurorec) asked us to send them reports from each robot to find global milks problems (like blood in the milk) or cow plague.

We have solved it in a simple way, each robot is sending 3 times a day xml to OnlineMQ the eurorec read those messages from a queue and process them via weblogic WLI workflow engine.

Todd Clayton May 17, 2009 | 5:49pm

Wow! Sounds interesting. Without something like OnlineMQ, how much harder do you think the implementation would have been?

Todd

Bill July 6, 2009 | 8:49am

Interesting article. This is something that I’ve been rolling around in my head since taking a look at Twitter. The character limit is the only drawback I can see, and possibly doc sharing, at least in terms of human collaboration.

Todd Clayton July 6, 2009 | 1:19pm

Thanks for dropping by. Out of curiosity, are you thinking of any specific use cases?

Leave a Reply