簡體   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