Java 在Thorntail中使用ActiveMQ配置JMS

Java 在Thorntail中使用ActiveMQ配置JMS,java,jakarta-ee,jms,wildfly,thorntail,Java,Jakarta Ee,Jms,Wildfly,Thorntail,关于在Thorntail上配置JMS,我有一个小问题。在我的开发项目中,我使用Wildfly,但对于远程服务器,我们使用(我的团队)IBMPortal。我将本地服务器从Wildfly升级到Thorntail,在我想在本地(使用maven)启动我的应用程序后,它崩溃了。我查看了日志,发现它提供了我的: 2019-12-04 10:49:50,957 ERROR [org.jboss.as.controller.management-operation] (main) WFLYCTL0013: Op

关于在Thorntail上配置JMS,我有一个小问题。在我的开发项目中,我使用Wildfly,但对于远程服务器,我们使用(我的团队)IBMPortal。我将本地服务器从Wildfly升级到Thorntail,在我想在本地(使用maven)启动我的应用程序后,它崩溃了。我查看了日志,发现它提供了我的:

2019-12-04 10:49:50,957 ERROR [org.jboss.as.controller.management-operation] (main) WFLYCTL0013: Operation ("add") failed - address: (("deployment" => "myproject.war")) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.myproject.env.jms.notification"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.naming.context.java.module.myproject.env.\"myproject.notifications.service.impl.JmsNotificationServiceImpl\".connectionFactory is missing [jboss.naming.context.java.module.myproject.env.jms.notification]",
        "jboss.naming.context.java.module.myproject.env.\"myproject.notifications.service.impl.JmsNotificationServiceImpl\".topic is missing [jboss.naming.context.java.module.myproject.env.jms.notification]"
    ]
}
2019-12-04 10:49:50,994 ERROR [org.jboss.as.server] (main) WFLYSRV0021: Deploy of deployment "myproject.war" was rolled back with the following failure message: 
{
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.module.myproject.env.jms.notification"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.naming.context.java.module.myproject.env.\"myproject.notifications.service.impl.JmsNotificationServiceImpl\".connectionFactory is missing [jboss.naming.context.java.module.myproject.env.jms.notification]",
        "jboss.naming.context.java.module.myproject.env.\"myproject.notifications.service.impl.JmsNotificationServiceImpl\".topic is missing [jboss.naming.context.java.module.myproject.env.jms.notification]"
    ]
}
在我们的本地环境中,我们没有为JMS目的配置任何队列,因为我们的主队列机制位于远程服务器(IBMPortal)上。 我们正在使用一些代码:

public class JmsNotificationServiceImpl implements JmsNotificationService {

    @Resource(lookup = "jms/notificationCF")
    private ConnectionFactory connectionFactory;

    @Resource(lookup = "jms/topic/notification")
    private Topic topic;

    @Override
    public void send(String string) throws Exception {
        Connection connection = null;
        try {
            connection = connectionFactory.createConnection();
            Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageProducer producer = session.createProducer(topic);

            log.info("Sending JMS message to topic...");
            producer.send(session.createObjectMessage(string));
            log.info("Message sent succesfull.");
        } catch (JMSException e) {
            throw new Exception("Error while creation or sending jms message", e);
        }
    }

}

我发现Thorntail中的ActiveMQ中有一个构建,但我真的不知道如何在ActiveMQ中配置ConnectionFactory和Topic。有人能帮我了解一下配置的位置和配置方法吗?

Minimalistic project-defaults.yml,它允许您的thorntail实例连接到远程Message Broker

swarm:
  network:
    socket-binding-groups:
      standard-sockets:
        outbound-socket-bindings:
          remote-activemq-socket-binding:
            remote-host: 127.0.0.1
            remote-port: 61616
  messaging-activemq:
    servers:
      default:
        remote-connectors:
          remote-activemq-connector:
            socket-binding: remote-activemq-socket-binding
        pooled-connection-factories:
          remote-connection-factory:
            user: myuser
            password: otherpassword
            connectors:
              - remote-activemq-connector
            entries:
              - 'java:/jms/remote-mq'
              - 'java:/DefaultJMSConnectionFactory'
        jms-queues:
          session-tracking-queue:
            entries:
              entry: 'java:/jms/queue/testQueue'
要求包含以下依赖项:

<dependency>
    <groupId>io.thorntail</groupId>
    <artifactId>messaging</artifactId>
</dependency>

木卫一
消息传递

您能否从WildFly共享
standalone.xml
配置的相关部分?将其转换为Thorntail
projectdefaults.yml
应该非常简单。尽管说实话,我认为与WildFly呆在一起会更好,因为它可能与目标环境非常接近。您能告诉我在哪里可以找到这个独立的.xml文件吗?我在github上的某个随机项目上发现,有一个project-defaults.yml,但我怎么能理解呢,它是用于Thorntail和ActiveMQ(例如remote)之间的通信,但我想在ActiveMQ中使用build。那么您知道如何在内置activeMQ中配置ConnectionFactory和主题吗?好的,那么在您的WildFly设置中,您不配置内置的Artemis服务器而使用远程消息服务器?但是在Thorntail设置中,您想使用内置的ActiveMQ Artemis消息服务器吗?这里有一个简单的测试用例,展示了绝对的基础知识:很明显,我没有使用任何特殊的配置来使用Artemis。我看到分数自动检测添加我自动按摩分数,这是。