0
  1. I want use ActiveMQ (Artemis) and IBM MQ at the same time.
  2. ActiveMQ built-in Wildfly Application Server where was deployed my application.
  3. I want use two resource adapters, first for ActiveMQ and second for IBM MQ, but I can not configure it.
  4. Here is my configuration for standalone-full.xml :
 <mdb>
        <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>
        <bean-instance-pool-ref pool-name="mdb-strict-max-pool" />
      </mdb>
<resource-adapters>

        <resource-adapter id="wmq.jmsra.rar">
          <archive>wmq.jmsra-9.1.2.0.rar</archive>
          <transaction-support>NoTransaction</transaction-support>
          <config-property name="startupRetryCount">1</config-property>
          <connection-definitions>
            <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/jms/ivt/IVTCF" enabled="true" use-java-context="true" pool-name="IVTCF">
              <config-property name="channel">A.CHANNEL01</config-property>
              <config-property name="hostName">any-host</config-property>
              <config-property name="transportType">1</config-property>
              <config-property name="queueManager">QMANAG</config-property>
              <config-property name="port">1415</config-property>
            </connection-definition>
          </connection-definitions>
          <admin-objects>
            <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/TEST.Q" pool-name="TEST.REQ">
              <config-property name="baseQueueName">TEST.Q</config-property>
              <config-property name="baseQueueManagerName">QMANAG</config-property>
            </admin-object>
          </admin-objects>
        </resource-adapter>
      </resource-adapters>
  1. How can I add second adapter here?
  2. If I replace:
<resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>

with

<resource-adapter-ref resource-adapter-name="wmq.jmsra.rar"/>

my mdb-bean for IBM MQ work well, but mdb-beans for ActiveMQ doesn`t work.

1
  • thanks! for your help
    – rgaponov
    May 7, 2019 at 12:09

1 Answer 1

0

The resource-adapter-ref that you're configuring is for the default resource adapter to be used by all MDBs which don't specify their own resource adapter configuration. Your MDBs can use whatever resource adapter they want, you just need to configure it, e.g.:

  1. At deployment descriptor level
<jboss xmlns="http://www.jboss.com/xml/ns/javaee"
    xmlns:jee="http://java.sun.com/xml/ns/javaee"
    xmlns:mdb="urn:resource-adapter-binding"
    xmlns:security="urn:security">

    <jee:assembly-descriptor>
        <mdb:resource-adapter-binding>
            <jee:ejb-name>SOCKET_MDB</jee:ejb-name>
            <mdb:resource-adapter-name>wmq.jmsra.rar</mdb:resource-adapter-name>
        </mdb:resource-adapter-binding>
    </jee:assembly-descriptor>
</jboss>

This is a sample jboss-ejb3.xml file which can be deployed along with your EJB.

  1. Annotate it in your MDB

Another option is by using the @ResourceAdapter annotation within your MDB:

@MessageDriven(
activationConfig = { 
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName="destination", propertyValue="foo")})
@ResourceAdapter(value="wmq.jmsra.rar")
public class MyMDB implements MessageListener {

    @Override
    public void onMessage(Message message) {        
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.