Two message-driven beans examples are provided with JOnAS. The first and simplest is located in $JONAS_ROOT/examples/src/mdb/samplemdb; it contains a Message Driven bean listening to a topic and an MdbClient, which is a pure JMS Client that sends 10 messages on the corresponding topic. This is a very good example of how to write and use message driven beans.
$JONAS_ROOT/examples/src/mdb/sampleappli has the second, more complex, example. The example contains two Message Driven beans—one listening to a topic (StockHandlerBean) and the other listening to a queue (OrderBean), an Entity bean with container managed persistence (StockBean), and a Stateless Session bean for creating the table used in the database.
SampleAppliClient sends several messages on the topic. At receipt of the message, the StockHandlerBean updates the database via the StockBean and sends a message to the Queue inside a global transaction. All the EJBs are involved in transactions that may commit or rollback.