title: Achieving JMS/AMQP messaging patterns using Redis
body: <p>This question arises as I came across some mentions (such as <a href="http://www.youtube.com/watch?v=Z-4EqEZbfBM">this</a>), about using a Messaging software such as ZeroMQ <strong>alongwith</strong> Redis, but I keep hearing about Redis itself used a messaging-system. So, if Redis is used along with other messaging systems, does it mean Redis has some serious deficiencies when used as a messaging system by itself ?</p>
  
  <p>While the use of Redis for caching and pub/sub is clear to me, it is not clear if Redis can be used <strong>in place</strong> of a full-fledged messaging system such as JMS, AMQP or ZeroMQ. <br/>
  Leaving alone the standards-compliance aspect and only concentrating on the functionality/features, does Redis provide support for all the messaging patterns/models required of a messaging system ? <br/></p>
  
  <p>The messaging patterns I am talking about are : <br/></p>
  
  <ol>
  <li>RPC/Request-reply (an
  <a href="http://activemq.apache.org/how-should-i-implement-request-response-with-jms.html">example</a>
  using ActiveMQ/JMS and <a href="http://www.rabbitmq.com/tutorials/tutorial-six-java.html">another</a> using RabbitMQ/AMQP)</li>
  <li>Pipeline/Work queues (once and atmost once consumption of each message)</li>
  <li>Broadcast (everyone subscribed to the channel)</li>
  <li>Multicast (filtering of messages at server based on consumers' selectors)</li>
  <li>Any other messaging pattern ?</li>
  </ol>
  
  <p>If yes, then Redis seems to solve two (possibly more) aspects at once: Caching and Messaging.</p>
  
  <p>I am looking at this in the context of a web-application backed by a Java/Java EE server.
  And I am looking at this not from a proof-of-concept point-of-view but from a large-scale software development angle.</p>
  
  <p><strong>Edit1:</strong>
  <br/>
  user:791406 asked a valid question:</p>
  
  <blockquote>
    <p>"Who cares if redis supports those patterns; will redis meet your SLA
    and QoS needs?"</p>
  </blockquote>
  
  <p>I thought it is better to give this detail as part of the question instead of in the comments section.</p>
  
  <p>My current needs are less to do with SLA and QOS and more to do with choosing a tool for my job (messaging) that I can use even when my requirements grow (reasonably) in future.
  I am starting with simplistic requirements at first and we all know requirements tend to grow.
  And <strong>NO</strong>, I am not looking for a one tool that does it all.
  I just want to know if Redis fulfills the usual requirements expected out of a messaging system, like ActiveMQ/RabbitMQ does. Ofcourse, if my SLA/QOS needs are extreme/eccentric, I would need to get a special tool for satisfying that. For ex: In some cases ZeroMQ could be chosen over RabbitMQ due to specific SLA requirements. I am not talking about such special requirements. I am focusing on average enterprise requirements.</p>
  
  <p>I was afraid (based on my little understanding) that eventhough redis could be used as a basic tool for my messaging needs of today, it might be the wrong tool for a real messaging job in future. I have experiences with messaging systems like ActiveMQ/RabbitMQ and know that they could be used for simple to (reasonably) complex messaging needs. </p>
  
  <p><strong>Edit2</strong>:</p>
  
  <ol>
  <li><p>The redis website mentions <a href="http://redis.io/commands/rpoplpush">"Redis is often used as a messaging server"</a> but how to achieve the messaging patterns is not clear.</p></li>
  <li><p>Salvatore sanfilippo mentions <a href="http://thechangelog.com/episode-0-4-5-redis-with-salvatore-sanfilippo/">Redis users tend to use it as a database, <strong>as a messaging bus</strong>, or as a cache</a>. To what extent can it serve as a "messaging bus" is not clear.</p></li>
  <li><p>When I was trying to find out what messaging requirements of JMS that redis doesnt support, I came across something that Redis supports but JMS doesnt: <strong>Pattern-matching subscriptions</strong> i.e Clients may subscribe to glob-style patterns in order to receive all the messages sent to channel names matching a given pattern.</p></li>
  </ol>
  
  <p><strong>Conclusion</strong>:</p>
  
  <p>I have decided to use JMS for my messaging needs and use Redis for Caching.</p>