Search code examples
springjmsactivemq-classicrabbitmqamqp

Is it possible to implement a generic msg consumer from both activemq and rabbitmq?


Our current implementation has an abstraction layer separating out (quite) a few interface apis like start, close, etc., essentially following the Template Pattern. Is there a better way to do so?
Not an expert on Spring, but could Spring be our answers?


Solution

  • Short answer: No. Longer answer: The APIs and protocols are different. Spring or similar frameworks won't help you. A common abstraction layer would be a subset, feature wise, of both AMQ(JMS) and RMQ (AMQP).

    In theory, you could try to connect to RMQ with JMS (like the client JMS lib of Apache QPid). It won't support all features of AMQP, and last time I tried, I merly got a connection running. So don't go there. Or go by some common supported wire protocol, such as MQTT (very limited).

    I think you are on the right way - write your own abstraction that supports the subset of features you need.