• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Message Facade (Message Driven Bean)

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi In the Message facade pattern, the client send the JMS to the Message drive beans. how can he call the MDB? Becaseu there is no client-view in the MDB. how it is possible.
Thanks and regards
Anna Madhusudhanan
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
An MDB is a special type of EJB - it doesn't have any method for the client to call. More than that - it doesn't have any method for anyone to call.
When you deploy the MDB, you specify the destination (queue/topic) that it will listen on. From then on, it it the application server's responsibility to call this MDB's onMessage() method when a message arrives at that destination.
This contract is the only thing that you can rely on. Nothing else. Therefore, when you use an MDB to listen on a destination, all you do is program that onMessage() method to do the work for you. From this method you may call other EJBs, log stuff to file, send messages to other destinations, etc.
Nimo.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No client ever talks to an EJB. A client sends message to a destination, which is either a queue or a topic. For asynchronous messaging, the Container will invoke the MessageListener's onMessage() method. If the consumer is an MDB, which is a type of MessageListener, the Container will pull an MDB instance from the pool to service the call.
The MDB is a MessageListener, kind of like an event listener but receives messages of type javax.jms.Message (passed into the onMessage() method) rather than events.
 
Anna Madhusudhanan Natanagopalan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nimo and Roger
Thank you so much for your great explanation.
Thanks and regards
Anna Madhusudhanan.
 
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic