Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

21.5. Configuring Message-Driven Beans

21.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 EAP 6 is hornetq-ra.

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

  1. Click on the Configuration tab at the top of the screen. Expand the Container menu and select EJB 3. Select the Container tab.
  2. Click Edit. The fields in the Details area can now be edited.
  3. Enter the name of the resource adapter to be used in the Default Resource Adapter text box.
  4. Click Save to finish.

Procedure 21.20. 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.4.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 21.15. 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 21.16. 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>