Difference in RabbitMq and RabbitMq with JMS plugin - spring-boot

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.

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.

Multiple ways to configure MQ or ActiveMQ Listener

Can someone explain different ways of configuring message listener.
I know two ways:
Spring Jms Listener
EJB MDB way.
Are there any other ways (should be applicable to both IBM MQ and Active MQ)?
For the first question, your proposed ways are good ones with Camel JMS.
For the second question take a look at Java JMS mix messaging implementations
if you want to use the same client without changing anything you have to use AMQP ptotocol wich is designed for this.
here is 2 examples :
ActiveMQ AMQP with JMS transformer leveraging spring Integration
Unable to access ActiveMQ using JMS based code and amqp 1.0

JMS without any Third Party Messaging

I have few basic douts.
I have developed a JMS application for P-P and the messages are geeting stored in Jboss 7.1 JMS engine. My questions are below.
1.For any JMS application do we need to have any messaging engine like IBM MQ,HornetQ,Active MQ etc
If Yes then we need to configure the MQ to atlk to Appserver Messaging engine.
3.If No, Then we need to have to create a message consumer
JMS is a specification of a messaging interface - and a state model for how messages are handled in transactions.
jms.jar contains pretty much all interfaces - no implementations. Therefore whilst you can write an application against jms.jar you can't actually run it.
You'll need to pick some type of messaging provider. That's appropriate to your requirements.
That's not a discussion for here however keep in mind that they each have possible extensions and functional behavior outside of the specification so if you want to be portable between providers pay close attention to only use specification defined functionality.
Within a JavaEE Application Server there will be a JMS implementation that provides messaging features. Therefore an app here in JBOSS will be a MOM (messaging oridentated middleware) application. If you want the message to be accessed by an application not running in a JavaEE server then that is possible with some providers. There's often a JavaEE client container. Or the messaging engine will have a JavaSE based client that can be used. (WAS thin client client for example).
Remember that with JavaEE servers you are not restricted to a the choice of messaging provider - you can use the JCA interface to directly plug in a external messagin implementation. This might present an easier route if a lot of messaging will be outside the JavaEE server.
EDIT - added JavaEE notes

JMS without a queue

I am not expert in JMS and recently came across a situation in my project where they wanted to use JMS to communicate between applications. Is it possible to make use of JMS without an underlying MQ software like Websphere MQ / TIBCO EMS to communicate asynchronously. My thinking is that just like we use JDBC API to speak to a physical Database product (like Oracle/DB2 DB) underneath, we would use JMS to speak to a physical queue. But my team says just JMS and no queue. Can anyone help me understand? We use Websphere 6.0 server and use spring framework.
Thanks in advance.
You are correct: JMS is solely an interface, it contains no implementation. The comparison with JDBC is quite fitting.
When using JMS you always need a JMS provider. A provider is the JMS implementation, which interfaces a message oriented middleware.
Most application servers have built in JMS providers, so maybe your team meant using JMS without an external provider.
Is it possible to make use of JMS without an underlying MQ software like Websphere MQ / TIBCO EMS to communicate asynchronously
This makes no sense. Few points to note -
JMS is just specs. By specs you can imagine it as set of APIs/interfaces/ method signatures and governing rules.
There are various organization/companies that provide implementation of these APIs.Apache's ActiveMQ,IBM's Websphere MQ or TIBCO EMS are some of the examples.
Now when you say I want to use JMS then you need a JMS compatible server i.e server which understands the rules laid down by specs. This is generally know as MQ server and is provided by the provider.
My thinking is that just like we use JDBC API to speak to a physical Database product (like Oracle/DB2 DB) underneath, we would use JMS to speak to a physical queue. But my team says just JMS and no queue
Two things to note here. When you say you want to use databases and JDBC APIs to communicate JMS comes no where in the picture. Please understand why JMS is used. In short it is used to transfer messages between two decoupled system. What storage type JMS server uses(and if it is configurable) will depend on the provider. Generally all have DB storage type and can be configured to use your DB.
Next JMS has two types of communications - PTP(peer to peer) which uses queues and PUBSUB(publish subscribe) which uses Topics. When you say you are using JMS everything boils down to either of these two and some of it's variants.Now when you say JMS without a queue perhaps your team meant using PUBSUB. But again it is not something you decide randomly and use it in your application. This decision is takes as per what your requirement is as both of them behave differently.
First you will need queues/topics to use JMS.
Second (your team probably means not using WebSphere MQ because my team was saying the same thing)
This diagram in IBM's Red Book will fully answer your question (it is the same as WS6):
http://www.redbooks.ibm.com/redbooks/pdfs/sg247770.pdf
page 4.
Probably what you will be using is the WebSphere Default Messaging Provider.

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