Py学习  »  MQ

找不到Wildfly 15外部Artemis ActiveMQ目标

auryn31 • 4 年前 • 1069 次点击  

我有一个带有外部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);
        }
    }
}

pom.xml for beans包含:

<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)

谢谢你的帮助

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/43676
 
1069 次点击  
文章 [ 1 ]  |  最新文章 4 年前
Justin Bertram
Reply   •   1 楼
Justin Bertram    5 年前

类似 your other question on this subject ,似乎您正试图使用activemq 5.x jca资源适配器中的管理对象来配置jms队列管理对象,但随后使用activemq artemis客户端来处理该队列。activemq 5.x和activemq artemis是完全不同的客户机/服务器实现。你不能把它们混在一起。

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