Common java AMQP interface - jms

Hi is there any java shared common amqp interface that is shared among all the amqp implementors?
Something similar to JMS, in a way to avoid vendor locking for amqp message broker implementor.

AMQP is a standardised Messaging protocol and JMS is an API. You can use a AMQP client library that implements the JMS API if you want but it is not necessary. All AMQP libraries should able to talk with an AMQP broker, if their AMQP version is compatible.
So the answer is: yes, you can use JMS.

Related

Is the Solace message broker compatible with "regular" AMQP or JMS clients?

I'd like to use regular AMQP or JMS clients to connect to a Solace message broker but don't know enough about these protocols to know if they are compatible. From what I can tell Solace implements AMQP and JMS bu possibly with incompatible extensions (e.g. "message vpn").
Does Solace have incompatible extensions, particularly for JMS, or is there a straightforward way to get a JMS client to speak to a Solace broker with "message vpn" enabled?
The choice is yours as Solace provides both a JMS client implementation and it also supports AMQP 1.0.
Keep in mind that JMS is an API and AMQP is a protocol. The JMS API can be implemented over any suitable wire protocol, and AMQP can be exposed via any suitable API. JMS is Java-based and there are many JMS implementations using different protocols under the covers. There are also many AMQP clients written in different languages on different platforms all with different APIs. There are even projects which combine both JMS and AMQP like Qpid JMS.
Solace's PubSub+ event broker works on binary payloads which means that you can indeed publish and consume messages on cross protocols and APIs.
The Solace APIs have detailed documentation on how to process the payload in a type agnostic fashion.
As you can see in this diagram, we support a wide range of APIs and protocol integrations.
There are also sample codes present over at this Github account listing examples on using Solace broker with JMS and AMQP : https://github.com/SolaceSamples?
(Answering my own question).
I basically wanted to know if it was possible to connect to a Solace/JMS broker using more popular messaging libraries. As far as I can tell the answer is no in general.
For example,
one feature of JMS is JNDI lookup of the InitialContextFactory. I don't think that is possible to do outside of a JMS library.

Difference in RabbitMq and RabbitMq with JMS plugin

I am new to JMS.
I am little aware of RabbitMq and now trying to find the difference in rabbitMQ with JMS. How it is used and why it should be used?
Thanks in advance.
JMS is a Java API (part of JEE).
JMS Vendors use a proprietary protocol to talk to the broker; they are not wire-compatible.
You can generally talk to any JMS broker by just changing vendor-specific configuration (connection factory etc).
Vendors provide a JMS client library to talk to their brokers.
AMQP is a wire protocol, not an API.
Vendors provide a Java client API.
You can use Spring AMQP, which sits on top of RabbitMQ's amqp-client library and its API.
You can use Spring JMS, which talks to any JMS broker (including RabbitMQ with the plugin) using the JMS API.
If you need to be compatible with any JMS vendor, use spring-jms; if you only intend to use RabbitMQ, I would recommend using Spring AMQP.
Or, use Spring Integration on top of either one, and you can switch between AMQP and JMS by just changing configuration.
I'm not sure what you mean by RabbitMQ for JMS. But, i'll list out the differences below.
RabbitMQ
Works on AMQP protocol and it is not a J2EE specification
Applications written in several languages can produce and consume messages(Python, Ruby, Java, C#, Perl etc.,)
Does not work with J2EE specs, so you cannot use XA Transactions, bean pools, connection factory pools which are all provided by J2EE container by default
Community is not so mature, but, if your organization needs to communicate with a lot of different types and languages of applications you can sacrifice all the beautiful features that are provided by J2EE/JMS spec.
JMS
It is J2EE specification, any application server that provides JMS support should follow the guidelines mentioned in the spec.
Only the Java/J2EE applications can produce and consume, it can be made to work for other languages but with use of adapters
J2EE container provides XA Transaction, Bean pooling, Connection pooling etc., out of the box with little configuration at your end.
If your organization only uses Java based applications, you need not look in RabbitMQ way as you have JMS support which works well.

How does the JMS API work with ActiveMQ

NEWBIE Question here, maybe I am way off...
When I send a JMS text message to an ActiveMQ topic using the activemq-all jar, is a JMS message actually sent over the wire, or does ActiveMQ actually map/transform the message to pure AMQP?
Thanks.
JMS is an API specification and not a wire level protocol specification. It defines a set of APIs a Messaging provider must implement to call the messaging provider a JMS provider. How the JMS APIs are implemented is internal to the implementer. ActiveMQ might(or does) use AMQP protocol under the hood to implement JMS APIs. Others, for example, IBM MQ uses it's own proprietary protocol.

Is there a JMS API/Client that works with all AMQP brokers?

The JMS is the vendor neutral API to messaging in the Java space. AMQP's mission is "to become the standard protocol for interoperability between all messaging middleware". I'm looking for a JMS client implementation that is interoperable between AMQP vendors. Specifically, it would be nice if it could talk to either RabbitMQ or Qpid.
The Qpid JMS client (which is, for the avoidance of effort, the same code as the OpenAMQ JMS client) encodes JMS in AMQP 0-9-1. I cannot speak for the quality of the client, but that should work for both Qpid Java edition and RabbitMQ.
It won't be an entirely lossless encoding, however -- there are some bits of API in JMS that don't carry across to AMQP. Qpid may have shims in place for those; RabbitMQ, by and large, doesn't. I am thinking specifically of 'nolocal' and selectors. There are probably others.
(Actually it /kind of/ does selectors using AMQP header exchanges, but the results may not be what you expect from JMS)
There is an effort to create a JMS client that uses AMQP 1.0. But there are no Qpid nor RabbitMQ releases that support AMQP 1.0, which is after all really an entirely different protocol to 0-9-1 and other prior versions.
I have used Apache Qpid client library (qpid-client-0.32-bin.tar.gz) with RabbitMQ (AMQP 0-9-1) recently and It worked very well.
If you want to connect to AMQP 1.0 Broker you should use this Qpid lib (apache-qpid-jms-0.1.0-bin.tar.gz)
Both libs can be downloaded from here:
http://qpid.apache.org/download.html
Qpid itself has a JMS client. I've never used it, but it is listed here under AMQP Client APIs
http://qpid.apache.org/

Using existing JMS libraries with a AMQP broker (RabbitMQ)

We use RabbitMQ and Spring-AMQP for our messaging system.
However there are many Java libraries that use JMS that I would rather not rewrite to AMQP.
I failed to Google a JMS client that will use AMQP.
Should I just rewrite the library to use AMQP directly?
qpid , which also speaks amqp , has a JMS client library. Perhaps that also works with rabbitmq.
There's some (old) indications the OpenAMQ library works works with rabbitmq
Depending on what you're actually building, you'll probably find that Spring Integration is useful:
http://www.springsource.org/spring-integration
It abstracts the concepts of end points, such that they are pluggable and there is built-in support for JMS & AMQP.
It's fairly trivial to build a simple AMQP <-> JMS adapter.

Resources