Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Messaging resources > Program to use asynchronous messaging > Program to use message-driven beans > Deploy an enterprise application to use message-driven beans with listener ports


Configure deployment attributes for a message-driven bean against a listener port

We can configure the message-driven beans deployment attributes for an enterprise bean, to override the deployment attributes defined within the application EAR file.

Listener ports are stabilized. For more information, read the article on stabilized features. You should only configure the application against a listener port for compatability with existing message-driven bean applications. Otherwise, you should configure the application against JCA 1.5-compliant resources.

If we have existing message-driven beans that use the WebSphere MQ messaging provider (or a compliant third-party JMS provider) with listener ports, and instead to use EJB 3 message-driven beans with listener ports, these new beans can continue to use the same messaging provider.

This task assumes that we have an EAR file that contains an enterprise application, developed as a message-driven bean, that can be deployed in WAS.

You configure the deployment attributes of a message-driven bean application by using an assembly tool. Detailed steps given in this task are for Rational Application Developer, but other tools have very similar steps.


Procedure

  1. Start your assembly tool.
  2. Edit the application EAR file. For example, use the Rational Application Developer import wizard to import the EAR file into the assembly tool.

    To start the import wizard:

    1. Click File > Import > EAR file .

    2. Click Next, then select the EAR file.

    3. Click Finish.

  3. Open the deployment attributes for editing. In the Java EE Hierarchy view, right-click the EJB module for the message-driven bean then click Open With > Deployment Descriptor Editor . A property dialog notebook for the message-driven bean is displayed in the property pane.

  4. Specify general deployment attributes.

    1. In the property pane, select the Bean tab.

    2. On the main panel, configure the Transaction type attribute.

      This attribute determines whether the message-driven bean manages its own transactions, or whether the container manages transactions on behalf of the bean.

      Bean

      The message-driven bean manages its own transactions.

      Container

      The container manages transactions on behalf of the bean.

  5. Under Activation Configuration, review the following attributes:

    For EJB 3 message-driven beans, you can instead use an EJB 3 annotation to configure the activation configuration properties. Do not use an EJB 3 annotation to change or replace what is specified in the bean deployment descriptor. If an activation configuration property is specified in both places, the value used is the one that is given in the deployment descriptor.

    acknowledgeMode

    This attribute determines how the session acknowledges any messages it receives.

    Auto Acknowledge

    The session automatically acknowledges delivery of each message.

    Dups OK Acknowledge

    The session lazily acknowledges the delivery of messages. This setting is likely to result in the delivery of some duplicate messages if JMS fails, so it should be used only by consumer applications that are tolerant of duplicate messages.

    destinationType

    This attribute determines whether the message-driven bean uses a queue or topic destination.

    Queue

    The message-driven bean uses a queue destination.

    Topic

    The message-driven bean uses a topic destination.

    subscriptionDurability

    This attribute determines whether a JMS topic subscription is durable or nondurable.

    Durable

    A subscriber registers a durable subscription with a unique identity that is retained by JMS. Subsequent subscriber objects with the same identity resume the subscription in the state it was left in by the earlier subscriber. If there is no active subscriber for a durable subscription, JMS retains the subscription messages until they are received by the subscription or until they expire.

    Nondurable

    Nondurable subscriptions last for the lifetime of their subscriber object. This means that a client sees the messages published on a topic only while its subscriber is active. If the subscriber is not active, the client is missing messages published on its topic.

    A nondurable subscriber can only be used in the same transactional context (for example, a global transaction or an unspecified transaction context) that existed when the subscriber was created.

    messageSelector

    This attribute determines the JMS message selector used to select which messages the message-driven bean receives. For example:
    JMSType='car' AND color='blue' AND weight>2500
    

    The selector string can refer to fields in the JMS message header and fields in the message properties. Message selectors cannot reference message body values.

  6. Specify the bindings deployment attribute.

    1. Under WebSphere Bindings, specify the following attribute:

      Listener port name

      Type the name of the listener port for this message-driven bean.

  7. Save your changes to the deployment descriptor:

    1. Close the deployment descriptor editor.

    2. When prompted, click Yes to indicate to save changes to the deployment descriptor.

  8. Verify the archive files.

  9. From the pop-up menu for the project, click Deploy to generate EJB deployment code.

  10. Optional: Test your completed module on a WAS installation.

    Right-click a module, click Run on Server, then follow the instructions in the displayed wizard.

    Restriction: Run on Server works on the Windows, Linux/Intel, and AIX operating systems only. We cannot deploy remotely to a WAS installation on a UNIX operating system such as Solaris.

    Use Run on Server for unit testing only. When an application is published remotely, the assembly tool overwrites the server configuration file for that server. Do not use on production servers.


What to do next

After assembling the application, use a systems management tool to deploy the EAR file onto the application server that will run the application; for example, use the admin console as described in Deploy and managing applications.
Message-driven beans - automatic message retrieval
Design an enterprise application to use JMS
Deploy an enterprise application to use message-driven beans with listener ports
Assembling applications
Rational Application Developer documentation

+

Search Tips   |   Advanced Search