• Post Reply Bookmark Topic Watch Topic
  • New Topic

Stateless Session Bean -> MDB (Thread)  RSS feed

 
kri shan
Ranch Hand
Posts: 1487
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateless Session Bean should call two operations concurrently. Since EJB does not allow multi-threading, can i call two different MDB for each thread ?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36446
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kri,
The MDBs would be asynchronous. Is this what you want? You don't have any guarantee they will run concurrently.

Also, who calls your stateless session bean? Can it launch the threads?
 
kri shan
Ranch Hand
Posts: 1487
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who calls your stateless session bean? Can it launch the threads?
Servlet calls stateless session bean. It can't launch threads.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a Session EJB method, you can sequentially place two messages on two message ques.

The two Message-Driven EJB that are connected to these message ques will process the message on their message que in their own thread.

Whatever logic that happens from each Message-Driven EJB will occur concurrently.

Keep in mind that you should not code business logic in the Message-Driven EJB code. So, whatever logic that occurs with message should either be in a Session EJB or a POJO business object.
 
kri shan
Ranch Hand
Posts: 1487
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a Session EJB method, you can sequentially place two messages on two message ques.
Is it Statefull Session bean or Stateless Session Bean ?
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter.
 
kri shan
Ranch Hand
Posts: 1487
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a Session EJB method, you can sequentially place two messages on two message ques. Each message has its own Thread. Hence i guess parallely place two messages on two message queues.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!