Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sequenctial processing of requests

 
Michal Glowacki
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I haven't not get help in this thread, but one user asked why I use LinkedList in Message Driven Bean, I thought this could be the error. So now I would like to form question another way:

how to make sure, in Java EE environment (JBoss), that multiple request that come to specific address (I tried MDB), will be processed one by one, not all at the same time?

If I create MessageDrivenBean singleton, should it be enough? All incoming requests will wait in JMS Queue until processing is over (FIFO like) ?

Regards,
Michal
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would need to use a single instance of a message driven bean, so yes a Singleton MDB. You can usually control the number of instances via your server, though the need to use a single instance usually indicates an MDB is perhaps not the right choice.

You could with change the logic of your application so ordering is less important, or use an old-fashioned MessageListener (i.e. not an EJB) which will guarantee sequential processing of messages at the expense of scalability. You could also look at more sophisticated JMS implementations (such as ActiveMQ) which could give you more control or grouping and ordering messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic