16.5. Configuring Message-Driven Beans

16.5.1. Set Default Resource Adapter for Message-Driven Beans

JBoss Administrators can specify the default resource adapter used by message-driven beans. The default resource adapter can be specified using the Management Console and the CLI. The default resource adapter supplied with JBoss Enterprise Application Platform 6 is hornetq-ra.

Procedure 16.17. Set the Default Resource Adapter for Message-Driven Beans using the Management Console

  1. Click on Profile in the top right, expand the Container item in the Profile panel on the left and select EJB 3. Then select the Container tab from the main panel.
    EJB3 Container Configuration panel in the Management Console (Standalone Server)

    Figure 16.10. EJB3 Container Configuration panel in the Management Console (Standalone Server)

  2. Click the Edit button. The fields in the Details area are now editable.
  3. Enter the name of the resource adapter to be used in the Default Resource Adapter text box.
  4. Click the Save button to keep the changes, or click the Cancel link to discard them.
  5. The Details area will now be non-editable and display the correct resource adapter name.

Procedure 16.18. Set the Default Resource Adapter for Message-Driven Beans using the CLI

  1. Launch the CLI tool and connect to your server. Refer to Section 3.3.4, “Connect to a Managed Server Instance Using the Management CLI”.
  2. Use the write-attribute operation with the following syntax.
    /subsystem=ejb3:write-attribute(name="default-resource-adapter-name", value="RESOURCE-ADAPTER")
    Replace RESOURCE-ADAPTER with name of the resource adapter to be used.
  3. Use the read-resource operation to confirm the changes.
    /subsystem=ejb3:read-resource

Example 16.14. Set the Default Resource Adapter for Message-Driven Beans using the CLI

[standalone@localhost:9999 subsystem=ejb3] /subsystem=ejb3:write-attribute(name="default-resource-adapter-name", value="EDIS-RA")
{"outcome" => "success"}
[standalone@localhost:9999 subsystem=ejb3]

Example 16.15. XML Configuration Sample

<subsystem xmlns="urn:jboss:domain:ejb3:1.2">

   <mdb>
      <resource-adapter-ref resource-adapter-name="hornetq-ra"/>
      <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
   </mdb>


</subsystem>