从 Qpid JMS 客户端启用 AMQP 1.0 插件连接到 RabbitMQ 3.7.18 时出现错误匹配错误
Posted
技术标签:
【中文标题】从 Qpid JMS 客户端启用 AMQP 1.0 插件连接到 RabbitMQ 3.7.18 时出现错误匹配错误【英文标题】:Badmatch error when connecting to RabbitMQ 3.7.18 with AMQP 1.0 plugin enabled from Qpid JMS client 【发布时间】:2020-01-24 21:00:06 【问题描述】:我尝试从 Qpid JMS 客户端 0.45.0(支持 AMQP 1.0 和 JMS 2.0)连接到 RabbitMQ 3.7.18 代理 - 启用 AMQP 1.0 插件。
我将消息发送到“/queue/gruik”(即使用路由键“gruik”的默认交换,又名 gruik 队列)。队列是使用 javax.jms.Session#createQueue("/queue/gruik") 从客户端动态创建的。可以看到在 RabbitMQ 中已经很好的发起了连接,队列也创建好了。
但由于以下错误,我实际上无法发送消息:
在客户端:
javax.jms.JMSException: badmatch,empty,[],[],[amqp_channel,rpc_bottom_half,2,[file,[115,114,99,47,97,109,113,112,95,99,104,97,110,110,101,108,46,101,114,108],line,623],amqp_channel,handle_method_from_server1,3,[file,[115,114,99,47,97,109,113,112,95,99,104,97,110,110,101,108,46,101,114,108],line,800],gen_server,try_dispatch,4,[file,[103,101,110,95,115,101,114,118,101,114,46,101,114,108],line,637],gen_server,handle_msg,6,[file,[103,101,110,95,115,101,114,118,101,114,46,101,114,108],line,711],proc_lib,init_p_do_apply,3,[file,[112,114,111,99,95,108,105,98,46,101,114,108],line,249]] [condition = amqp:internal-error]
at org.apache.qpid.jms.provider.ProviderException.toJMSException(ProviderException.java:34)
at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:80)
at org.apache.qpid.jms.exceptions.JmsExceptionSupport.create(JmsExceptionSupport.java:112)
at org.apache.qpid.jms.JmsConnection.pull(JmsConnection.java:915)
at org.apache.qpid.jms.JmsConnection.pull(JmsConnection.java:899)
at org.apache.qpid.jms.JmsMessageConsumer.performPullIfRequired(JmsMessageConsumer.java:726)
at org.apache.qpid.jms.JmsMessageConsumer.dequeue(JmsMessageConsumer.java:332)
at org.apache.qpid.jms.JmsMessageConsumer.receive(JmsMessageConsumer.java:213)
at org.apache.activemq.artemis.jms.example.PerfBase.drainQueue(PerfBase.java:272)
at org.apache.activemq.artemis.jms.example.PerfBase.runSender(PerfBase.java:188)
at org.apache.activemq.artemis.jms.example.PerfSender.run(PerfSender.java:42)
at org.apache.activemq.artemis.jms.example.PerfSender.main(PerfSender.java:31)
Caused by: org.apache.qpid.jms.provider.ProviderException: badmatch,empty,[],[],[amqp_channel,rpc_bottom_half,2,[file,[115,114,99,47,97,109,113,112,95,99,104,97,110,110,101,108,46,101,114,108],line,623],amqp_channel,handle_method_from_server1,3,[file,[115,114,99,47,97,109,113,112,95,99,104,97,110,110,101,108,46,101,114,108],line,800],gen_server,try_dispatch,4,[file,[103,101,110,95,115,101,114,118,101,114,46,101,114,108],line,637],gen_server,handle_msg,6,[file,[103,101,110,95,115,101,114,118,101,114,46,101,114,108],line,711],proc_lib,init_p_do_apply,3,[file,[112,114,111,99,95,108,105,98,46,101,114,108],line,249]] [condition = amqp:internal-error]
at org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToNonFatalException(AmqpSupport.java:181)
at org.apache.qpid.jms.provider.amqp.AmqpAbstractResource.processRemoteClose(AmqpAbstractResource.java:266)
at org.apache.qpid.jms.provider.amqp.AmqpProvider.processUpdates(AmqpProvider.java:952)
at org.apache.qpid.jms.provider.amqp.AmqpProvider.onData(AmqpProvider.java:850)
at org.apache.qpid.jms.transports.netty.NettyTcpTransport$NettyTcpTransportHandler.channelRead0(NettyTcpTransport.java:542)
at org.apache.qpid.jms.transports.netty.NettyTcpTransport$NettyTcpTransportHandler.channelRead0(NettyTcpTransport.java:535)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:337)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:359)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:345)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:796)
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:427)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:328)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
at java.base/java.lang.Thread.run(Thread.java:834)
在经纪人方面:
2019-09-24 17:04:57.951 [info] <0.21922.0> accepting AMQP connection <0.21922.0> (80.13.79.15:59648 -> 10.132.0.29:5672)
2019-09-24 17:05:01.213 [error] <0.21985.0> ** Generic server <0.21985.0> terminating
** Last message in was send_command,'basic.credit_drained',<<99,116,97,103,45,0,0,0,0>>,1000
** When Server state == state,1,<0.21979.0>,<0.21984.0>,direct,[],[],false,<0.21988.0>,none,none,0,true,none,0,nil,0,nil,true,false
** Reason for termination ==
** badmatch,empty,[],[],[amqp_channel,rpc_bottom_half,2,[file,"src/amqp_channel.erl",line,623],amqp_channel,handle_method_from_server1,3,[file,"src/amqp_channel.erl",line,800],gen_server,try_dispatch,4,[file,"gen_server.erl",line,637],gen_server,handle_msg,6,[file,"gen_server.erl",line,711],proc_lib,init_p_do_apply,3,[file,"proc_lib.erl",line,249]]
2019-09-24 17:05:01.213 [warning] <0.21976.0> Closing session for connection <0.21922.0>:
badmatch,empty,[],[],[amqp_channel,rpc_bottom_half,2,[file,"src/amqp_channel.erl",line,623],amqp_channel,handle_method_from_server1,3,[file,"src/amqp_channel.erl",line,800],gen_server,try_dispatch,4,[file,"gen_server.erl",line,637],gen_server,handle_msg,6,[file,"gen_server.erl",line,711],proc_lib,init_p_do_apply,3,[file,"proc_lib.erl",line,249]]
2019-09-24 17:05:01.214 [error] <0.21985.0> CRASH REPORT Process <0.21985.0> with 0 neighbours crashed with reason: no match of right hand value empty,[],[] in amqp_channel:rpc_bottom_half/2 line 623
2019-09-24 17:05:01.214 [error] <0.21983.0> Supervisor <0.21983.0>,amqp_channel_sup had child channel started with amqp_channel:start_link(direct, <0.21979.0>, 1, <0.21984.0>, <<"80.13.79.15:59648 -> 10.132.0.29:5672">>,1) at <0.21985.0> exit with reason no match of right hand value empty,[],[] in amqp_channel:rpc_bottom_half/2 line 623 in context child_terminated
2019-09-24 17:05:01.214 [error] <0.21983.0> Supervisor <0.21983.0>,amqp_channel_sup had child channel started with amqp_channel:start_link(direct, <0.21979.0>, 1, <0.21984.0>, <<"80.13.79.15:59648 -> 10.132.0.29:5672">>,1) at <0.21985.0> exit with reason reached_max_restart_intensity in context shutdown
2019-09-24 17:05:01.215 [warning] <0.21979.0> Connection (<0.21979.0>) closing: internal error in channel (<0.21985.0>): badmatch,empty,[],[],[amqp_channel,rpc_bottom_half,2,[file,"src/amqp_channel.erl",line,623],amqp_channel,handle_method_from_server1,3,[file,"src/amqp_channel.erl",line,800],gen_server,try_dispatch,4,[file,"gen_server.erl",line,637],gen_server,handle_msg,6,[file,"gen_server.erl",line,711],proc_lib,init_p_do_apply,3,[file,"proc_lib.erl",line,249]]
2019-09-24 17:05:01.215 [error] <0.21988.0> ** Generic server <0.21988.0> terminating
** Last message in was 'EXIT',<0.21985.0>,badmatch,empty,[],[],[amqp_channel,rpc_bottom_half,2,[file,"src/amqp_channel.erl",line,623],amqp_channel,handle_method_from_server1,3,[file,"src/amqp_channel.erl",line,800],gen_server,try_dispatch,4,[file,"gen_server.erl",line,637],gen_server,handle_msg,6,[file,"gen_server.erl",line,711],proc_lib,init_p_do_apply,3,[file,"proc_lib.erl",line,249]]
** When Server state == ch,running,rabbit_framing_amqp_0_9_1,1,<0.21985.0>,<0.21985.0>,<0.21979.0>,<<"80.13.79.15:59648 -> 10.132.0.29:5672">>,rabbit_direct,lstate,<0.21987.0>,false,none,1,[],[],user,<<"guest">>,[administrator],[rabbit_auth_backend_internal,none],<<"/">>,<<>>,#<0.15405.0> => resource,<<"/">>,queue,<<"gruik">>,state,dict,1,16,16,8,80,48,[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[[<0.15405.0>|#Ref<0.4044318431.962330625.89090>]],[],[],[],[],[],[],erlang,#<<99,116,97,103,45,0,0,0,0>> => amqqueue,resource,<<"/">>,queue,<<"gruik">>,false,false,none,[],<0.15405.0>,[],[],[],undefined,undefined,[],[],live,0,[],<<"/">>,#user => <<"guest">>,false,65535,false,[<<"x-credit">>,table,[<<"credit">>,long,0,<<"drain">>,bool,false]],#<0.15405.0> => 1,<<99,116,97,103,45,0,0,0,0>>,nil,nil,set,1,16,16,8,80,48,[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[<0.15405.0>],[],[],[],[],[],[],<0.21982.0>,state,fine,5000,#Ref<0.4044318431.962330625.89278>,false,1,0,nil,0,nil,[],[],0,nil,0,nil,[<<"publisher_confirms">>,bool,true,<<"exchange_exchange_bindings">>,bool,true,<<"basic.nack">>,bool,true,<<"consumer_cancel_notify">>,bool,true,<<"connection.blocked">>,bool,true,<<"authentication_failure_close">>,bool,true],none,65535,none,flow,[]
** Reason for termination ==
** badmatch,empty,[],[],[amqp_channel,rpc_bottom_half,2,[file,"src/amqp_channel.erl",line,623],amqp_channel,handle_method_from_server1,3,[file,"src/amqp_channel.erl",line,800],gen_server,try_dispatch,4,[file,"gen_server.erl",line,637],gen_server,handle_msg,6,[file,"gen_server.erl",line,711],proc_lib,init_p_do_apply,3,[file,"proc_lib.erl",line,249]]
2019-09-24 17:05:01.215 [error] <0.21988.0> CRASH REPORT Process <0.21988.0> with 0 neighbours exited with reason: no match of right hand value empty,[],[] in amqp_channel:rpc_bottom_half/2 line 623 in gen_server2:terminate/3 line 1183
2019-09-24 17:05:01.215 [error] <0.21986.0> Supervisor <0.21986.0>,rabbit_channel_sup had child channel started with rabbit_channel:start_link(1, <0.21985.0>, <0.21985.0>, <0.21979.0>, <<"80.13.79.15:59648 -> 10.132.0.29:5672">>, rabbit_framing_amqp_0_9_1, user,<<"guest">>,[administrator],[rabbit_auth_backend_internal,none], <<"/">>, [<<"publisher_confirms">>,bool,true,<<"exchange_exchange_bindings">>,bool,true,<<"basic.nack">>,...,...], <0.21982.0>, <0.21987.0>) at <0.21988.0> exit with reason no match of right hand value empty,[],[] in amqp_channel:rpc_bottom_half/2 line 623 in context child_terminated
2019-09-24 17:05:01.216 [error] <0.21986.0> Supervisor <0.21986.0>,rabbit_channel_sup had child channel started with rabbit_channel:start_link(1, <0.21985.0>, <0.21985.0>, <0.21979.0>, <<"80.13.79.15:59648 -> 10.132.0.29:5672">>, rabbit_framing_amqp_0_9_1, user,<<"guest">>,[administrator],[rabbit_auth_backend_internal,none], <<"/">>, [<<"publisher_confirms">>,bool,true,<<"exchange_exchange_bindings">>,bool,true,<<"basic.nack">>,...,...], <0.21982.0>, <0.21987.0>) at <0.21988.0> exit with reason reached_max_restart_intensity in context shutdown
2019-09-24 17:05:01.286 [info] <0.21922.0> closing AMQP connection <0.21922.0> (80.13.79.15:59648 -> 10.132.0.29:5672)
你能告诉我发生了什么吗?
请注意,这可能不相关:我的请求未经身份验证,AMQP 1.0 插件会将它们作为“访客”用户连接到虚拟主机“/”。
【问题讨论】:
【参考方案1】:恐怕rabbitmq和qpid互不喜欢:
https://github.com/rabbitmq/rabbitmq-amqp1.0
QPid / Proton Java 客户端 [2] 我们无法让该客户端打开网络连接(针对 0.2 和 0.4 进行测试)。
【讨论】:
这种类型的答案应该在评论中。以上是关于从 Qpid JMS 客户端启用 AMQP 1.0 插件连接到 RabbitMQ 3.7.18 时出现错误匹配错误的主要内容,如果未能解决你的问题,请参考以下文章
使用 Qpid 通过 SSL 与 AMQP 1.0 代理通信
如何使用 qpid-jms-client 创建 RabbitMQ 持久队列?
如何使用 JMS 和 AMQP 1.0 设置 RabbitMQ?
向 prometheus 公开 spring 集成 amqp/jms 通道消息指标