• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

can there be MDB without onMessage method

Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read this from tutorial

It is recommended, but not required, that a message-driven bean class should implement the MessageListener interface for the message type it supports. This interface defines only one method onMessage( ). When the EJB container arrives a message, it calls the onMessage( ) method of the message-driven bean to process the message

then which method to call EJB container?
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There can be a lot of messaging systems in a JavaEE environment, JMS is just one of them.
As a messaging system, JMS defines a message listener interface, called javax.jms.MessageListener. It has only one message listener method - onMessage().
Every MDB that is based on JMS, i.e. a JMS-MDB must implement this interface and hence its single onMessage() method.

If there are other messaging systems (based on a JCA integration) supported in your JavaEE server, they can have different message listener interfaces, that can include a set of message listener methods (including more than one). So, the corresponding MDB must implement the particular message listener interface, and hence its set of message listener methods.

I am not an expert in the integration between the JMS provider and the EJB container, in most of the cases it is proprietary (because there is no spec for this).
Other messaging systems, however, are integrated with the EJB container, via Java Connector Architecture and resource adapters.

I am not a JavaEE guru, but i hoped i haven't lied to you ;) (at least not a lot...)
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic