首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用外部WildFly代理的ActiveMQ集群应用程序

使用外部WildFly代理的ActiveMQ集群应用程序
EN

Stack Overflow用户
提问于 2017-09-16 12:09:42
回答 1查看 823关注 0票数 0

我很难让两个WildFly群应用程序(基于2017.9.5版本)通过一个独立的ActiveMQ 5.14.3代理进行通信。所有这些都是使用YAML配置完成的,因为在我的情况下,我不能有一个主方法。

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

代码语言:javascript
复制
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

现在看来,当应用程序启动时,该设置至少有一部分是正确的,除了以下警告:

代码语言:javascript
复制
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

此外,当生产者试图发送消息时,它只是超时,我得到以下异常(仅最后一部分):

代码语言:javascript
复制
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打开了安全性,但我没有找到提供用户名和密码的位置。

ActiveMQ实例正在使用Docker运行,并在以下撰写文件中运行:

代码语言:javascript
复制
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"

知道出什么问题了吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-26 20:21:46

我也有过困难的时候想让它起作用。下面的YML解决了我的问题:

代码语言:javascript
复制
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'
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46253739

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档