# Part Three: Adding a Message-Driven Bean

In part two of the tutorial you added an entity bean called Recording and modified the Band and Music beans to enable adding and listing recordings for a band. In part three of the tutorial you will add a message-driven bean that will compile rating information for recordings.

To understand what this message-driven bean is doing, let's take a step back to provide a background for the EJBs you have created thus far. Imagine that you are using this EJB application to create an online record of your favorite bands and recordings. You have created the basics of this web site but the completed functionality includes the ability to enter copious notes on bands, including the history of the band and its members, to rate and review recordings, and so forth. In addition, other parts of the EJB application run in the background to search various web sites and collect information on price, average rating, and so forth. The latter functionality is what you will build in this part of the tutorial with a message-driven bean.

It might be clear from the above description that a true and accurate implementation of the business logic of the message-driven bean will require internet search capabilities. At this point you are going to focus on the core functionality of sending messages and the processing of these messages by message-driven beans instead, and implement placeholder business logic for the message-driven bean, which could be fully implemented at a later time.

## Steps in Part Three

Step 10: Create a Message-Driven Bean

In this step you create the message-driven bean Statistics.

Step 11: Update the Recording Bean

In this step you update the Recording bean to store the statistics generated by the Statistics bean.

Step 12: Update the Music Bean

In this step you change the Music Bean to send a message that will be processed by the Statistics bean, and to make rating information stored in the Recording bean available to the client application.

Step 13: Run a Web Application

In this step you will test the EJBs by running a page flow.

Note. As an alternative to updating the Music bean, WebLogic also offers the JMS control to handle JMS messages. For instance, if for some reason it were impossible to modify the Music bean, you could create a custom control instead to encapsulate the business logic implemented in step 12. This custom control, which would be called by a client application, would call the Music bean to add a recording and subsequently call a JMS control to send a JMS message to be processed by the Statistics bean.

Related Topics

Developing Enterprise JavaBeans

Working with Java Controls

JMS Control

Click one of the following arrows to navigate through the tutorial: