我尝试应用适当的配置,以便能够通过 wildfly(以及其他环境成员)在 artemis 服务器上使用远程消息系统首先,我在本地(https://www.apache.org/ )上安装了一个独立的 artemis 服务器(2.0) dyn/closer.cgi?filename=activemq/activemq-artemis/2.0.0/apache-artemis-2.0.0-bin.zip&action=download)然后我在上面定义了一个示例队列。(exampleQueue)我根据https://docs.jboss.org/author/display/WFLY10/Connect+a+pooled-connection-factory+to+a+Remote+Artemis+Server上的信息更改了standalone.xml文件 所以,这里是套接字绑定组:
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
...
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
<outbound-socket-binding name="remote-artemis">
<remote-destination host="localhost" port="61616"/>
</outbound-socket-binding>
</socket-binding-group>
改编的消息传递子系统定义(之前包含嵌入式活动MQ定义和队列/主题)
<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
<server name="default">
<remote-connector name="remote-artemis" socket-binding="remote-artemis"/>
<in-vm-connector name="in-vm" server-id="0"/>
<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>
<pooled-connection-factory name="remote-artemis" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory java:/ConnectionFactory" connectors="remote-artemis" transaction="xa" user="s3artemisuser" password="s3artemispass"/>
</server>
</subsystem>
我还尝试包含基本上在远程 artemis 上定义的队列的 jndi 地址,以便能够通过注入 jndi 资源从 wildfly 访问。(关注此文档:https ://activemq.apache.org/artemis/docs/1.0.0/using-jms.html )
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<bindings>
<external-context name="java:global/jms" module="org.jboss.as.naming" class="javax.naming.directory.InitialDirContext" cache="true">
<environment>
<property name="java.naming.factory.initial" value="org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"/>
<property name="connectionFactory.ConnectionFactory" value="tcp://localhost:5445"/>
<property name="java.naming.security.principal" value="s3artemisuser"/>
<property name="java.naming.security.credentials" value="s3artemispass"/>
</environment>
</external-context>
</bindings>
<remote-naming/>
</subsystem>
我已将 jndi 注入的所有资源临时更改为 test- (用于生产者和消费者类),以不再引用远程队列/主题。
class MyProducer extends BaseProducer {
@Resource(mappedName = "java:/global/jms/exampleQueue")
private Queue aQueue;
...
public abstract class BaseProducer extends JpaService {
@Resource(mappedName = "java:/ConnectionFactory")
protected ConnectionFactory connectionFactory; ... }
当我使用这些配置启动 wildfly 时,服务没有正确部署。虽然我在我的部署文件夹下提供了 activemq-rar-5.14.0.rar 文件,但仍然出现同样的错误。我在这里缺少什么,适合我的情况的正确配置是什么?
10:19:13,701 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "my-module-using-jms-ear-2.0-SNAPSHOT.ear")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.ra.activemq-ra"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [