我正在尝试将Wildfly 13-实例连接到独立的Artemis ActiveMQ,以产生和使用其中的消息。因此,我遵循了Wildfly 13 Documentation和Artemis ActiveMQ Documentation的相关部分。此外,我尝试使用this教程,并使用JMS 2.0 Simplified-API对其进行了一些自定义。
当我向/ produce发送有效负载时,没有抛出异常。因此,我认为JNDI存在问题。我已经使用Wireshark监视了正在进行的网络活动,并且能够看到Wildfly和Artemis ActiveMQ之间的软件包交换。 Wildfly不断尝试访问远程队列,但以
结尾AMQ11901 7: Queue does not exist
到目前为止,我仍无法弄清为什么会发生这种情况。
这是我到目前为止所拥有的:
Wildfly配置(standalone-full-ha.xml)
//...
<outbound-socket-binding name="ImportantMessages-remote">
<remote-destination host="127.0.0.1" port="61616"/>
</outbound-socket-binding>
//...
<subsystem xmlns="urn:jboss:domain:messaging-activemq:3.0">
<server name="default">
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10" redistribution-delay="1000"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<remote-connector name="ImportantMessages-remote" socket-binding="ImportantMessages-remote"/>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
<pooled-connection-factory name="ImportantMessages-remote" entries="java:/jms/remoteIM" connectors="ImportantMessages-remote"/>
</server>
</subsystem>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<external-context name="java:global/remoteContext" module="org.apache.activemq.artemis" class="javax.naming.InitialContext">
<environment>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="java.naming.provider.url" value="tcp://127.0.0.1:61616"/>
<property name="queue.ImportantMessages" value="ImportantMessages"/>
</environment>
</external-context>
<lookup name="java:/ImportantMessages" lookup="java:global/remoteContext/ImportantMessages"/>
</bindings>
<remote-naming/>
</subsystem>
MessageProducerRessource
@Stateless
@Path("produce")
public class MessageProducerResource {
private static final Logger LOG = Logger.getLogger(MessageProducerResource.class.getName());
@Inject
@JMSConnectionFactory("java:/jms/remoteIM")
private JMSContext jmsContext;
@Resource(lookup = "java:global/remoteContext/ImportantMessages")
private Queue queue;
@POST
public void sendMessage(String txt) {
jmsContext.createProducer().send(queue, txt);
LOG.info("Sent message containing \"" + txt + "\" to " + queue);
}
}
我相信这些是相关的代码片段。如果您需要任何更多信息,请随时询问。有人遇到过类似的问题并且可以帮助我吗?
答案 0 :(得分:-1)
可能您需要在artemis代理上设置安全凭证,并将用户/密码添加到pooled-connection-factory。
<pooled-connection-factory name="ImportantMessages-remote" entries="java:/jms/remoteIM" connectors="ImportantMessages-remote" user="user123" password="Password123"/>