News: All about Message Driven EJBs
The EJB 2.0 specification will offer Java programmers a new toolkit for asynchronous messaging in an n-tier architecture. Find out how to use message beans to take enterprise messaging beyond the functionality currently available with JMS.
- Posted by: Dharani Babu Arumugam
- Posted on: December 26 2000 02:13 EST
Read the full article.
- All about Message Driven EJBs by Ramesh Hosahalli on December 28 2000 07:23 EST
- All about Message Driven EJBs by kishore Dandu on December 28 2000 15:36 EST
- Message Driven EJBs - Can they Publish? by Bill Ennis on December 29 2000 15:05 EST
Too good to start with a new monster!!!!!
Is it possible to persist these message driven beans(like entity beans) .
(according to EJB2.0 spec we can not, dispute me otherwise)
Well, you could persist data using a MessageDriven bean, but an MDB is not a persistent object in itself because it doesn't have an associated primary key, and its stateless, so there aren't any persistent fields to be mapped to a database.
I actually recommend against putting any real complex logic in an MDB.. I use MDBs as a message gateway to other session beans, which encapsulate business logic and then delegate to entity beans. That way the business logic is reusable for non-messaging clients.
They are persistent in a sense. The bean it-self is stateless but the message contents (i.e. the state) is persisted in the queue until you consume it and commit. Not quite what you're after though, maybe.
This article was excellent for getting started with
Beans that act as Listeners. but, what about Beans
that produce messages? I assume this is also possible,
but am wondering why it was not mentioned in the article.
Any bean can publish a message even without any special support from the app server. The main issue here is transactions and security. There are other issues also as most JMS transports will probably create a few threads/use the file system etc and basically break some rules as far as J2EE goes.
But, if you'll accept that then even EJB 1.0 servers can happily publish messages.