Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Asynchronous Messaging Solution other than MDB

 
Moha Shaf
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am looking for a solution where my application can put messages to be read by another listener for further processing. I do not want to go for MDBs as I do not want to use EJB container (My application runs on a Tomcat). Is there any J2EE or non J2EE alternative?

Thanks in advance for your help.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do not necessarily need an MDB if you want to do messaging or use JMS.
There are many JMS vendors, few of which like ActiveMQ are free.
 
Moha Shaf
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to read messages as the messages come to the queue. Its not a request response messaging that I wanted to do. I want to process messages asynchronously as they come to a queue. I know that MDB is a choice. What if I do not have the option of doing it through an MDB. Is a scheduler to read the messages from the queue a viable option? Is there any other better options available.

And my another question is, if it can be done through other means such a scheduler why do we need MDB at all.

Thanks.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moha:
I want to read messages as the messages come to the queue. Its not a request response messaging that I wanted to do. I want to process messages asynchronously as they come to a queue.

JMS is not always request-response. It can be a fire-and-forget mode also and it is always asynchronous.
So, I do not understand what do you want to convey with this.

Moha:
Is a scheduler to read the messages from the queue a viable option? Is there any other better options available.

When you register a listener to a queue/topic you get an intimation when a message is available. It is a "push" model VS a "pull" model that a scheduler follow.

Moha:
And my another question is, if it can be done through other means such a scheduler why do we need MDB at all

Thats the point with any EJB.
You can call a business processing object without a session bean.
You can access a DB/persistent store without an Entity Bean.
So, Why use EJBs?
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MDB is for convenient, but you can use JMS directly, MDB isn't the only way to use JMS.
 
Bobby Lewis
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The original poster may want to check out Spring Message Driven POJOs or MDPs. This is a Spring framework for producing and consuming messages on a JMS queue or topic which does not require an EJB container. We've found it easy to use and it integrates nicely of course with the rest of our Spring solutions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic