Wildfly 11 连接到远程 Artemis ActiveMQ 服务器配置
Wildfly 11 connection to remote Artemis ActiveMQ server configuration
远程客户端的 netty 连接器似乎不满意!现在,我在本地机器上使用标准 616161 端口激活了我的 运行。
我按照 https://docs.jboss.org/author/display/WFLY/Connect+a+pooled-connection-factory+to+a+Remote+Artemis+Server
的指示进行操作
这里是错误:
12:18:50,707 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 68) AMQ221007: Server is now live
12:18:50,707 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 68) AMQ221001: Apache ActiveMQ Artemis Message Broker version 1.5.5.jbossorg-008 [default, nodeID=de747bb0-bf64-11e7-9132-887873d0243d]
12:18:50,707 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 68) AMQ221003: Deploying queue jms.queue.DLQ
12:18:50,739 WARN [org.apache.activemq.artemis.jms.server] (ServerService Thread Pool -- 71) AMQ122005: Invalid "host" value "0.0.0.0" detected for "http-connector" connector. Switching to " Demo-Laptop". If this new address is incorrect please manually configure the connector to use the proper one.
12:18:50,760 INFO [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 71) WFLYMSGAMQ0002: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
12:18:50,760 INFO [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 70) WFLYMSGAMQ0002: Bound messaging object to jndi name java:/ConnectionFactory
12:18:50,760 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 69) AMQ221003: Deploying queue jms.queue.ExpiryQueue
12:18:50,776 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-6) WFLYJCA0007: Registered connection factory java:/jms/remoteCF
12:18:50,776 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) WFLYJCA0007: Registered connection factory java:/JmsXA
12:18:50,823 INFO [org.apache.activemq.artemis.ra] (MSC service thread 1-3) Resource adaptor started
12:18:50,823 INFO [org.jboss.as.connector.services.resourceadapters.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-3) IJ020002: Deployed: file://RaActivatoractivemq-ra
12:18:50,823 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) WFLYJCA0002: Bound JCA ConnectionFactory [java:/JmsXA]
12:18:50,823 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-7) WFLYMSGAMQ0002: Bound messaging object to jndi name java:jboss/DefaultJMSConnectionFactory
12:18:51,077 ERROR [org.apache.activemq.artemis.core.client] (Thread-0 (ActiveMQ-client-netty-threads)) AMQ214013: Failed to decode packet: java.lang.IllegalArgumentException: AMQ119032: Invalid type: 1
at org.apache.activemq.artemis.core.protocol.core.impl.PacketDecoder.decode(PacketDecoder.java:424)
at org.apache.activemq.artemis.core.protocol.ClientPacketDecoder.decode(ClientPacketDecoder.java:60)
at org.apache.activemq.artemis.core.protocol.ClientPacketDecoder.decode(ClientPacketDecoder.java:39)
at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:355)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl$DelegatingBufferHandler.bufferReceived(ClientSessionFactoryImpl.java:1143)
at org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQChannelHandler.channelRead(ActiveMQChannelHandler.java:69)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:624)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:559)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:476)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:858)
at java.lang.Thread.run(Thread.java:748)
所有消息(发送和接收)都来自活动的 mq 服务器,因为 producer/consumer 消息是使用 ActiveMQ 的旧消息。
从标准full.xml
添加到我的xml配置副本
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
…
<outbound-socket-binding name="remote-artemis">
<remote-destination host="localhost" port="61616"/>
</outbound-socket-binding>
</socket-binding-group>
<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
<server name="default">
<remote-connector name="remote-artemis" socket-binding="remote-artemis"/>
……
<pooled-connection-factory name="remote-artemis" entries="java:/jms/remoteCF" connectors="remote-artemis" transaction="xa" user="admin" password="admin"/>
</server>
我使用池连接工厂,因为文档说“它本质上是 Artemis JCA 资源适配器的入站和出站连接器的配置外观。”
这正是我需要的。
我的发送代码如下:
@Resource(lookup =" java:/jms/remoteCF")//java:/JmsXA java:jboss/DefaultJMSConnectionFactory
static ConnectionFactory connectionFactory;
@Resource(lookup = "java:jboss/activemq/topic/POOPOITopic")
private static Topic pointsTopic;
try {
if (connectionFactory == null)
{
logger.severe("not finding java:/jms/remoteCF");
}
当我尝试发送时,我得到的 connectionFactory 为空!
我的 MDB 看起来像
@ResourceAdapter("remote-artemis")
//An MDB can be configured to use a pooled-connection-factory (e.g. using @ResourceAdapter).
// In this context, the MDB leverages the inbound connector of the Artemis JCA RA. Other kinds of clients
// can look up the pooled-connection-factory in JNDI (or inject it) and use it to send messages. In this context, such a client would leverage the outbound connector of the Artemis JCA RA.
@Inject
@JMSConnectionFactory("java:/jms/remoteCF")
private JMSContext context;
我错过了什么?非常感谢所有帮助。
我遇到了同样的问题(也遵循了 wildfly 文档),但这工作正常。
Context jndiContext = new InitialContext();
connectionFactory = (ConnectionFactory)jndiContext.lookup( "java:/jms/remoteCF" );
请注意,您在这里得到的不是 JMSContext,而是 ConnectionFactory。它可以做所有相同的事情,只是不同 API.
远程客户端的 netty 连接器似乎不满意!现在,我在本地机器上使用标准 616161 端口激活了我的 运行。 我按照 https://docs.jboss.org/author/display/WFLY/Connect+a+pooled-connection-factory+to+a+Remote+Artemis+Server
的指示进行操作这里是错误:
12:18:50,707 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 68) AMQ221007: Server is now live
12:18:50,707 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 68) AMQ221001: Apache ActiveMQ Artemis Message Broker version 1.5.5.jbossorg-008 [default, nodeID=de747bb0-bf64-11e7-9132-887873d0243d]
12:18:50,707 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 68) AMQ221003: Deploying queue jms.queue.DLQ
12:18:50,739 WARN [org.apache.activemq.artemis.jms.server] (ServerService Thread Pool -- 71) AMQ122005: Invalid "host" value "0.0.0.0" detected for "http-connector" connector. Switching to " Demo-Laptop". If this new address is incorrect please manually configure the connector to use the proper one.
12:18:50,760 INFO [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 71) WFLYMSGAMQ0002: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
12:18:50,760 INFO [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 70) WFLYMSGAMQ0002: Bound messaging object to jndi name java:/ConnectionFactory
12:18:50,760 INFO [org.apache.activemq.artemis.core.server] (ServerService Thread Pool -- 69) AMQ221003: Deploying queue jms.queue.ExpiryQueue
12:18:50,776 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-6) WFLYJCA0007: Registered connection factory java:/jms/remoteCF
12:18:50,776 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) WFLYJCA0007: Registered connection factory java:/JmsXA
12:18:50,823 INFO [org.apache.activemq.artemis.ra] (MSC service thread 1-3) Resource adaptor started
12:18:50,823 INFO [org.jboss.as.connector.services.resourceadapters.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-3) IJ020002: Deployed: file://RaActivatoractivemq-ra
12:18:50,823 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-3) WFLYJCA0002: Bound JCA ConnectionFactory [java:/JmsXA]
12:18:50,823 INFO [org.wildfly.extension.messaging-activemq] (MSC service thread 1-7) WFLYMSGAMQ0002: Bound messaging object to jndi name java:jboss/DefaultJMSConnectionFactory
12:18:51,077 ERROR [org.apache.activemq.artemis.core.client] (Thread-0 (ActiveMQ-client-netty-threads)) AMQ214013: Failed to decode packet: java.lang.IllegalArgumentException: AMQ119032: Invalid type: 1
at org.apache.activemq.artemis.core.protocol.core.impl.PacketDecoder.decode(PacketDecoder.java:424)
at org.apache.activemq.artemis.core.protocol.ClientPacketDecoder.decode(ClientPacketDecoder.java:60)
at org.apache.activemq.artemis.core.protocol.ClientPacketDecoder.decode(ClientPacketDecoder.java:39)
at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:355)
at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl$DelegatingBufferHandler.bufferReceived(ClientSessionFactoryImpl.java:1143)
at org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQChannelHandler.channelRead(ActiveMQChannelHandler.java:69)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:624)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:559)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:476)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438)
at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:858)
at java.lang.Thread.run(Thread.java:748)
所有消息(发送和接收)都来自活动的 mq 服务器,因为 producer/consumer 消息是使用 ActiveMQ 的旧消息。
从标准full.xml
添加到我的xml配置副本<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
…
<outbound-socket-binding name="remote-artemis">
<remote-destination host="localhost" port="61616"/>
</outbound-socket-binding>
</socket-binding-group>
<subsystem xmlns="urn:jboss:domain:messaging-activemq:2.0">
<server name="default">
<remote-connector name="remote-artemis" socket-binding="remote-artemis"/>
……
<pooled-connection-factory name="remote-artemis" entries="java:/jms/remoteCF" connectors="remote-artemis" transaction="xa" user="admin" password="admin"/>
</server>
我使用池连接工厂,因为文档说“它本质上是 Artemis JCA 资源适配器的入站和出站连接器的配置外观。” 这正是我需要的。
我的发送代码如下:
@Resource(lookup =" java:/jms/remoteCF")//java:/JmsXA java:jboss/DefaultJMSConnectionFactory
static ConnectionFactory connectionFactory;
@Resource(lookup = "java:jboss/activemq/topic/POOPOITopic")
private static Topic pointsTopic;
try {
if (connectionFactory == null)
{
logger.severe("not finding java:/jms/remoteCF");
}
当我尝试发送时,我得到的 connectionFactory 为空! 我的 MDB 看起来像
@ResourceAdapter("remote-artemis")
//An MDB can be configured to use a pooled-connection-factory (e.g. using @ResourceAdapter).
// In this context, the MDB leverages the inbound connector of the Artemis JCA RA. Other kinds of clients
// can look up the pooled-connection-factory in JNDI (or inject it) and use it to send messages. In this context, such a client would leverage the outbound connector of the Artemis JCA RA.
@Inject
@JMSConnectionFactory("java:/jms/remoteCF")
private JMSContext context;
我错过了什么?非常感谢所有帮助。
我遇到了同样的问题(也遵循了 wildfly 文档),但这工作正常。
Context jndiContext = new InitialContext();
connectionFactory = (ConnectionFactory)jndiContext.lookup( "java:/jms/remoteCF" );
请注意,您在这里得到的不是 JMSContext,而是 ConnectionFactory。它可以做所有相同的事情,只是不同 API.