Reputation: 1696
I need to write a server that listens (Consumer) on message queue and sends the data it reads to a database, and also another server which publish information (Producer) to this queue.
I am following this official spring reference on Spring+JMS.
I don't understand the following:
on the example I see:
FileSystemUtils.deleteRecursively(new File("activemq-data"));
as a means to delete the queue.
Is the data of the queue maintained inside a file?
If the queue is maintained of the file system, how can I scale my JMS server to more than one computer (server)
Thanks!
Upvotes: 1
Views: 1694
Reputation: 206776
JMS is only an API specification, not an implementation. You need a piece of software that implements the JMS API if you want to do something with message queues.
ActiveMQ is a message broker which implements the JMS API. Besides ActiveMQ there are many other products that implement the JMS API.
The idea is that your software uses the JMS API without specifically tying it to a particular implementation, so that in principle you could replace ActiveMQ by another product that implements JMS without changing anything in your program. This principle is used a lot in software development, and in the Java EE world there are many other APIs and implementations that work this way (for example, JDBC and JDBC drivers, JPA and Hibernate, the Servlet API and Tomcat).
So, ActiveMQ is what actually implements the message queue.
Is the data of the queue maintained inside a file?
Apparently that's what ActiveMQ does by default.
If the queue is maintained of the file system, how can I scale my JMS server to more than one computer (server)
First of all, the fact that ActiveMQ stores data on the file system doesn't mean that it can't scale to more than one server. In fact, ultimately all software (also databases) store their data on the file system (if the data has to be persistent). Read the documentation on the ActiveMQ website to learn how to scale it (it does support clustering).
Upvotes: 5
Reputation: 1254
What is the relationship between JMS and ActiveMQ?
The Java Message Service (JMS) API is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. JMS is a part of the Java Platform, Enterprise Edition, and is defined by a specification developed under the Java Community Process as JSR 914. And ActiveMQ is a third party messaging service provider by following JSR 914.
Which one of them is actually implementing the message queue?
ActiveMQ provides the messaging queue implementations.
For Spring and ActiveMQ integration refer this post.
Upvotes: 1