Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用外部ActiveMQ代理的WildFly Swarm应用程序_Activemq_Wildfly Swarm - Fatal编程技术网

使用外部ActiveMQ代理的WildFly Swarm应用程序

使用外部ActiveMQ代理的WildFly Swarm应用程序,activemq,wildfly-swarm,Activemq,Wildfly Swarm,我很难让两个基于2017.9.5版本的WildFly swarm应用程序通过独立的ActiveMQ 5.14.3代理相互通信。所有这些都是使用YAML配置完成的,因为在我的例子中我没有main方法 在阅读了数百个过时的示例和不准确的文档页面后,我决定对生产者和消费者应用程序进行以下设置: swarm: messaging-activemq: servers: default: jms-topics: domain-events: {}

我很难让两个基于2017.9.5版本的WildFly swarm应用程序通过独立的ActiveMQ 5.14.3代理相互通信。所有这些都是使用YAML配置完成的,因为在我的例子中我没有main方法

在阅读了数百个过时的示例和不准确的文档页面后,我决定对生产者和消费者应用程序进行以下设置:

swarm:

  messaging-activemq:
    servers:
      default:
        jms-topics:
          domain-events: {}

  messaging:
    remote:
      name: remote-mq
      host: localhost
      port: 61616
      jndi-name: java:/jms/remote-mq

  remote: true
现在看来,在应用程序启动时,至少部分设置是正确的,但以下警告除外:

2017-09-16 14:20:04,385 WARN  [org.jboss.activemq.artemis.wildfly.integration.recovery] (MSC service thread 1-2) AMQ122018: Could not start recovery discovery on XARecoveryConfig [transportConfiguration=[TransportConfiguration(name=, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?port=61616&localAddress=::&host=localhost], discoveryConfiguration=null, username=null, password=****, JNDI_NAME=java:/jms/remote-mq], we will retry every recovery scan until the server is available
另外,当制作人尝试发送消息时,它只是超时,我在最后一部分遇到以下异常:

Caused by: javax.jms.JMSException: Failed to create session factory
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:727)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createXAConnection(ActiveMQConnectionFactory.java:304)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createXAConnection(ActiveMQConnectionFactory.java:300)
    at org.apache.activemq.artemis.ra.ActiveMQRAManagedConnection.setup(ActiveMQRAManagedConnection.java:785)
    ... 127 more
Caused by: ActiveMQConnectionTimedOutException[errorType=CONNECTION_TIMEDOUT message=AMQ119013: Timed out waiting to receive cluster topology. Group:null]
    at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:797)
    at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:724)
    ... 130 more
我怀疑问题在于ActiveMQ已启用安全性,但我找不到为swarm配置提供用户名和密码的位置

ActiveMQ实例正在使用Docker和以下compose文件运行:

version: '2'

services:

  activemq:
    image: webcenter/activemq
    environment:
      - ACTIVEMQ_NAME=amqp-srv1
      - ACTIVEMQ_REMOVE_DEFAULT_ACCOUNT=true
      - ACTIVEMQ_ADMIN_LOGIN=admin
      - ACTIVEMQ_ADMIN_PASSWORD=your_password
      - ACTIVEMQ_WRITE_LOGIN=producer_login
      - ACTIVEMQ_WRITE_PASSWORD=producer_password
      - ACTIVEMQ_READ_LOGIN=consumer_login
      - ACTIVEMQ_READ_PASSWORD=consumer_password
      - ACTIVEMQ_JMX_LOGIN=jmx_login
      - ACTIVEMQ_JMX_PASSWORD=jmx_password
      - ACTIVEMQ_MIN_MEMORY=1024
      - ACTIVEMQ_MAX_MEMORY=4096
      - ACTIVEMQ_ENABLED_SCHEDULER=true

    ports:
      - "1883:1883"
      - "5672:5672"
      - "8161:8161"
      - "61616:61616"
      - "61613:61613"
      - "61614:61614"

知道出了什么问题吗?

我也曾尝试过让它工作起来。以下YML解决了我的问题:

swarm:
  network:
    socket-binding-groups:
      standard-sockets:
        outbound-socket-bindings:
          myapp-socket-binding:
            remote-host: localhost
            remote-port: 61616
  messaging-activemq:
    servers:
      default:
        remote-connectors:
          myapp-connector:
            socket-binding: myapp-socket-binding
        pooled-connection-factories:
          myAppRemote:
            user: username
            password: password
            connectors:
              - myapp-connector
            entries:
              - 'java:/jms/remote-mq'

不确定这是否有效,我可能稍后再试一次。然而,我一般放弃使用YAML配置文件,因为它看起来非常脆弱,对我来说是一个实验性的特性。我转而创建自己的主配置,并且只读取可能从自己的文件更改的配置部分。请看这里:为了使用空心uberjar,我不得不切换回YAML配置,令人惊讶的是,这个配置工作正常。我不确定问题是否只是因为我将所有的套接字、连接器和连接工厂命名为相同的名称,或者这里定义为数组的连接器和条目,但这是有效的!