• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MDB state

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If MDB is stateless, how can the messages forward to multiple clients?
To check the content of the message before forwarding?

Thanks
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand the question. Why do you think MDB's need to be stateful to forward to multiple clients?

As a side note, there are ways to make MDBs function as having state, but again, I don't understand what this has to do with sending messages.
 
Scott Selikoff
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"whatIsThis Idontknow "

I almost forgot, please update your name to conform to the Java Ranch naming policy.
 
Allen Springers
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was reading an article on Sun's website
It says that A message-driven bean has no state for a specific client, but its instance variables can contain state across the handling of client message, including an open database connection and an object reference to an EJB object

From my understanding, the client application must also locate in the server where MDB is located.
Then, inside the client application, I create a MDB object and call its onMessage() method to check messages and determine the owner of the message?

Please let me know if my understanding is not correct

Thanks
 
Scott Selikoff
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Allen Springers:
From my understanding, the client application must also locate in the server where MDB is located.



No, the client must know where the queue for the MDB is. It doesn't have to know anything about the MDB.

Originally posted by Allen Springers:
Then, inside the client application, I create a MDB object and call its onMessage() method to check messages and determine the owner of the message?



It sounds like your mixing MDB code with EJB code, but I could be wrong. In general, the message should contain information about who sent it or in the case that it doesn't, you can encode that information in the header (not the content) of the message before sending to the MDB.

I still don't understand what any of this has to do with state. Every time an MDB gets a message off the queue, it can just decode the header (or if needs to the content) to determine where the message came from. Generally you only want an MDB decoding the content if its going to do something with it. A lot of times, though, MDBs are placed as routing mechanisms in which they read the header and then pass to a session bean.
[ October 24, 2007: Message edited by: Scott Selikoff ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic