未找到 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");
}
我的侦听器 bean:
@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 对于 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)
感谢帮助
类似于 ,您似乎正试图使用来自 ActiveMQ 5.x JCA 资源适配器的管理对象来配置 JMS 队列管理对象,但是您正在使用ActiveMQ Artemis 客户端使用该队列。 ActiveMQ 5.x 和 ActiveMQ Artemis 是完全不同的 client/server 实现。你不能那样混合它们。
您不需要配置与 ActiveMQ 5.x JCA 资源适配器相关的任何内容。只需在 Wildfly 的 messaging
子系统中定义您的队列并创建指向远程代理的连接工厂。
我有一个带外部 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");
}
我的侦听器 bean:
@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 对于 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)
感谢帮助
类似于
您不需要配置与 ActiveMQ 5.x JCA 资源适配器相关的任何内容。只需在 Wildfly 的 messaging
子系统中定义您的队列并创建指向远程代理的连接工厂。