如何将远程 Spring Boot 应用程序连接到 Wildfly 上的 ActiveMQ?
我必须将新创建的应用程序连接到 WildFly 应用程序服务器内的 ActiveMQ。我不希望 Spring 应用程序位于 WildFly 服务器内。它将作为独立应用程序在嵌入式 Tomcat 上运行。 在 Spring 应用程序中,我添加了:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
现在我想像文档中那样进行连接:
spring.activemq.broker-url=tcp://localhost:9876
spring.activemq.user=admin
spring.activemq.password=admin
当然我知道用户、密码和 url 是错误的,但我真的不知道 java:jboss/DefaultJMSConnectionFactory 的默认值是什么,这不是明确的说无论如何。
在 standalone.xml
中,它看起来像这样:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:5.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>
<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>
<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>
我
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
希望我应该添加一个端口公开并启用一些?连接器?通过 tcp 到 activeMQ,以便我可以远程连接。你能给我一些建议吗?我该怎么办?
I have to connect newly created app to ActiveMQ which is inside WildFly app server. I don't want Spring App to be inside WildFly server. It will run as standalone app on embedded Tomcat.
In Spring App I have added:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
And now I want to connect like in documentation:
spring.activemq.broker-url=tcp://localhost:9876
spring.activemq.user=admin
spring.activemq.password=admin
Of course I know that user, password and url are wrong but I really don't know what default values of java:jboss/DefaultJMSConnectionFactory are, it's not explictly said anywere.
In standalone.xml
it looks like this:
<subsystem xmlns="urn:jboss:domain:messaging-activemq:5.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>
<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>
<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>
and
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
I expect that I should add a port expose and enable some ?connector? over tcp to activeMQ so that I can connect remotely. Could you give me some advice what should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先要注意的是,WildFly 中嵌入的 ActiveMQ 是 ActiveMQ Artemis< /a>.因此,您应该使用:
并且由于您直接连接到 ActiveMQ Artemis 的嵌入式实例,而不是在 JDNI 中查找 JMS
ConnectionFactory
,那么您可以使用http-acceptor
code> 已在端口8080
上公开,例如:最后,我建议您迁移到更新版本的 WildFly。版本 14 已发布近 4 年了。最新版本是26.0.1。
The first thing to note is that the ActiveMQ embedded within WildFly is ActiveMQ Artemis. Therefore, you should be using:
And since you're connecting directly to the embedded instance of ActiveMQ Artemis and not looking up the JMS
ConnectionFactory
in JDNI then you can use thehttp-acceptor
which is already exposed on port8080
, e.g.:Lastly, I recommend you move to a more recent version of WildFly. Version 14 was released almost 4 years ago now. The latest release is 26.0.1.