繁体   English   中英

带有独立 ActiveMQ 的 Wildfly 上的 ActiveMQ Artemis

[英]ActiveMQ Artemis on wildfly with standalone ActiveMQ

我正在尝试使用MDB连接使用内置 ActiveMQ Artemis 的 Wildfly 10 服务器连接到运行版本 5.13.3 的独立 ActiveMQ-Server。 似乎 Artemis 无法与任何受支持的 ActiveMQ 协议进行通信。


ActiveMQ 独立代理具有以下transportConnectors

<transportConnectors>
    <transportConnector name="auto" uri="auto://localhost:5671?protocolDetectionTimeOut=5000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="http" uri="http://0.0.0.0:8180?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600" />
    <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/> 
    <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
</transportConnectors>

Wildfly MessageBean具有以下Annotation

@MessageDriven(activationConfig =
{
        @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
        @ActivationConfigProperty(propertyName="destination", "TestDestination"),
        @ActivationConfigProperty(propertyName="clientID", propertyValue = "test"),
        @ActivationConfigProperty(propertyName="connectionParameters", propertyValue = "host=127.0.0.1;port=5671"),  
        @ActivationConfigProperty(propertyName="connectorClassName", propertyValue = "org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory"),
        @ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge")
}, mappedName = "TestDestination")
public class MessageProcessingBean implements MessageListener {

根据我选择连接的连接器,我在 ActiveMQ 服务器上收到不同的错误消息。

连接到auto端点会产生以下消息:

错误 | 无法接受连接:java.lang.IllegalStateException:无法检测到有线格式

野蝇方面没有错误。


连接到Openwire端点会产生以下消息:

警告 | 传输连接到:tcp://127.0.0.1:45000 失败:java.io.IOException:未知数据类型:77

这也会在野蝇方面产生错误:

17:04:23,384 错误 [org.apache.activemq.artemis.core.client] (Thread-16 (ActiveMQ-client-netty-threads-1716275972)) > AMQ214013:无法解码数据包:java.lang.IllegalArgumentException:AMQ11903 :无效类型:1 在 org.apache.activemq.artemis.core.protocol.core.impl.PacketDecoder.decode(PacketDecoder.java:413) 在 org.apache.activemq.artemis.core.protocol.ClientPacketDecoder.decode(ClientPacketDecoder .java:60) 在 org.apache.activemq.artemis.core.protocol.ClientPacketDecoder.decode(ClientPacketDecoder.java:39) 在 org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl) .java:324) 在 org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl$DelegatingBufferHandler.bufferReceived(ClientSessionFactoryImpl.java:1105) 在 org.apache.activemq.artemis.core.remoting.impl.netty.ActiveMQChannelHandler .channelRead(ActiveMQChannelHandler.java:68) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelH andlerContext.java:308) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265) at io.netty.channel.AbstractChannelHandlerContext .invokeChannelRead(AbstractChannelHandlerContext.java:308) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846) at io.netty.channel。 nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) 在 io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop) 468) 在 io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) 在 io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) 在 io.netty.util.concurrent.SingleThreadEventExecutor $2.run(罪 gleThreadEventExecutor.java:112) 在 java.lang.Thread.run(Thread.java:745)

我可以继续并在所有端点上接收错误消息。 结果实际上是 ActiveMQ-Artemis 以 ActiveMQ 不支持的数据格式发送。

必须采取哪些步骤才能将 ActiveMQ-Artemis 与独立的 ActiveMQ-Server 连接起来?

Wildfly 10 附带 ActiveMQ Artemis,默认情况下任何 MDB 都将使用 ActiveMQ Artemis JCA RA。 ActiveMQ Artemis JCA RA 使用只有 ActiveMQ Artemis 代理支持的core协议。 ActiveMQ 5.x 代理不能/不会理解这个协议。

因此,如果您希望在 Wildfly 10 上运行的 MDB 使用来自 ActiveMQ 5.x 代理的消息,那么您需要部署 ActiveMQ 5.x JCA RA(它使用 ActiveMQ 5.x 代理理解的OpenWire协议)并配置 MDB 以使用它(例如,通过激活配置属性)。

就其价值而言,ActiveMQ Artemis 代理确实支持OpenWire协议,因此旧版 ActiveMQ 5.x 客户端可以连接到 ActiveMQ Artemis 代理。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM