|
Creating a message-driven bean using the wizard
You can use the Create Message-Driven Bean wizard
to create a message-driven bean in your EJB project.
The main difference between a message-driven bean and a session
bean is that a message-driven bean has no local or remote interface. Instead,
it has only a bean class. To create a message-driven bean within your EJB
project, follow these steps:
-
In the Java™ EE perspective, right-click your EJB Project, and
select . The Create Message-Driven
wizard appears.
-
In the Project field, ensure that your EJB
Project name appears.
-
In the Folder field, select the source folder
for the new bean.
-
In the Java package field, type the package
name for the new bean.
-
In the Class name field, type the name that you want to
assign to the session bean. By convention, bean names should begin with an
uppercase letter.
Note: You can use Unicode characters for the
bean name, but Unicode characters are not supported for enterprise bean packages
and classes associated with enterprise beans.
-
In the Superclass field, Browse to
find a Superclass to add to your Session bean.
-
In the Destination Name field, type the
name of your message destination.
-
In the JMS field, Select JMS if you want
to use Java Messaging Service, and in the Destination Type field,
select the type of destination.
-
Click Next.
-
On the Message-Driven Bean information page, you may change the
values of some of the Session bean elements:
-
Optional: In the EJB Name field, you can
change the value of your EJB name that you assigned in the previous page.
-
Optional: In the Transaction Type field,
select the type of Session bean you want to create (Container or Bean).
-
Optional: In the Interfaces field, you can
add or remove Business Interfaces that you created in the previous wizard
page.
-
Optional: In the Which method stubs would you like to
create? field, you can create one or both of these methods:
- Inherited abstract methods
- Constructors from superclass
-
Click Finish.
-
In the Java class editor, your new Message-driven bean appears,
with the @MessageDriven annotation and the required import statements.
|
|