简体   繁体   English

如何添加第二个资源适配器以同时使用ibm mq(WebSphere)和ActiveMQ(Artemis)?

[英]How can i add second resource adapter to work with ibm mq (WebSphere) and ActiveMQ (Artemis) at the same time?

  1. I want use ActiveMQ (Artemis) and IBM MQ at the same time. 我想同时使用ActiveMQ(Artemis)和IBM MQ。
  2. ActiveMQ built-in Wildfly Application Server where was deployed my application. ActiveMQ内置Wildfly Application Server,部署了我的应用程序。
  3. I want use two resource adapters, first for ActiveMQ and second for IBM MQ, but I can not configure it. 我想使用两个资源适配器,第一个用于ActiveMQ,第二个用于IBM MQ,但我无法配置它。
  4. Here is my configuration for standalone-full.xml : 这是我对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. 我的IBM MQ mdb-bean运行良好,但ActiveMQ的mdb-bean不起作用。

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. 您正在配置的resource-adapter-ref用于所有未指定其自己的资源适配器配置的MDB使用的默认资源适配器。 Your MDBs can use whatever resource adapter they want, you just need to configure it, eg: 您的MDB可以使用他们想要的任何资源适配器,您只需要配置它,例如:

  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. 这是一个示例jboss-ejb3.xml文件,可以与EJB一起部署。

  1. Annotate it in your MDB 在MDB中注释它

Another option is by using the @ResourceAdapter annotation within your MDB: 另一种选择是在MDB中使用@ResourceAdapter注释:

@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) {        
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM