繁体   English   中英

未找到 Wildfly 15 外部 Artemis ActiveMQ 目标

[英]Wildfly 15 external Artemis ActiveMQ destination not found

我有一个带外部 ActiveMQ 的 wildfly 15 并使用资源适配器。 但是我无法连接到要写入的队列。

但我可以在队列中聆听。

这是我的配置:

ironjacamar.xml:

<admin-objects>
    <admin-object class-name="org.apache.activemq.command.ActiveMQQueue"
            jndi-name="java:jboss/activemq/queue/HELLOWORLDMDBQueue1234">
        <config-property name="PhysicalName">
                activemq/queue/HELLOWORLDMDBQueue
        </config-property>
    </admin-object>
</admin-objects>

ra.xml:

<adminobject>
    <adminobject-interface>javax.jms.Queue</adminobject-interface>
    <adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
    <config-property>
        <config-property-name>PhysicalName</config-property-name>
        <config-property-type>java.lang.String</config-property-type>
    </config-property>
</adminobject>

Bean.java:

@Resource(lookup = "java:jboss/activemq/queue/HELLOWORLDMDBQueue1234")
private Queue queue;
@Inject
private JMSContext context;
someFunction(){
    context.createProducer().send(queue, "hier ist eine nachricht");
}

我的听众豆:

@ResourceAdapter("activemq.rar")
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "activemq/queue/HELLOWORLDMDBQueue") })
public class RemoteActiveMQConsumer implements MessageListener {
    @Override
    public void onMessage(Message msg) {
        if (msg instanceof TextMessage) {
            try {
                final String text = ((TextMessage) msg).getText();
                System.out.println(text);
            } catch (final JMSException e) {
                throw new RuntimeException(e);
            }
        } else {
            System.out.println(msg);
        }
    }
}

Beans 的 pom.xml 包含:

<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-client</artifactId>
    <version>5.9.1</version>
    <scope>provided</scope>
</dependency>

这与资源适配器中的 jar 版本相同。

HELLOWORLDMDBQueue读取不是问题,但如果我尝试发送,我会得到以下输出:

错误:

Caused by: javax.jms.InvalidDestinationException: Foreign destination:queue://activemq/queue/HELLOWORLDMDBQueue
at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.checkDestination(ActiveMQMessageProducer.java:349)
at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:217)
at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:206)
at org.apache.activemq.artemis.ra.ActiveMQRAMessageProducer.send(ActiveMQRAMessageProducer.java:142)
at org.apache.activemq.artemis.jms.client.ActiveMQJMSProducer.send(ActiveMQJMSProducer.java:98)

感谢帮助

您关于此主题的其他问题类似,您似乎正在尝试使用 ActiveMQ 5.x JCA 资源适配器中的管理对象来配置 JMS 队列管理对象,但随后您正在使用 ActiveMQ Artemis 客户端工作与那个队列。 ActiveMQ 5.x 和 ActiveMQ Artemis 是完全不同的客户端/服务器实现。 你不能那样混合它们。

您不需要配置与 ActiveMQ 5.x JCA 资源适配器相关的任何内容。 只需在 Wildfly 的messaging子系统中定义您的队列,并创建指向远程代理的连接工厂。

暂无
暂无

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

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