Spring jms ListenerContainer与AMQP使用Qpid客户端在连接到Azure Service总线分区主题

时间:2017-05-26 22:01:05

标签: java azure jms amqp azureservicebus

我正在使用AMQP连接azure Service bus和java qpid客户端以及Spring JMS。

我将服务总线扩展到高级层,因为默认情况下主题是分区的,并且无法从我在SimpleMessageListenerContainer开头遇到的门户网站或Azure服务总线管理库中修改。

javax.jms.JMSException 无法为实体类型订阅者打开主题客户端。 TrackingId:74bcb8d5-5d05-4239-9dad-cb2133015c29_B19,SystemTracker:servicebus-topic:topic:dumb-pipe~127 | sink-alpha-test-processing-subscription,Timestamp:5/22/2017 2:40:45 PM TrackingId :f572fcfb24dc47bf9ef3968bdfa99666_G17,SystemTracker:gateway2,时间戳:5/22/2017 2:40:44 PM [condition = amqp:not-allowed ]

接着是: -

2017-05-22 16:40:44.772  INFO 14268 --- [windows.net:-1]] o.a.q.j.s.SaslMechanismFinder            : Best match for SASL auth was: SASL-PLAIN
2017-05-22 16:40:45.376  INFO 14268 --- [windows.net:-1]] o.a.q.j.JmsConnection                    : Connection ID:c27375bc-e3e2-41a9-90a4-8e1bb1e17f8a:1 connected to remote Broker: amqps://servicebus-topic.servicebus.windows.net?amqp.idleTimeout=500000

2017-05-22 16:40:45.377  INFO 14268 --- [           main] o.s.j.c.CachingConnectionFactory         : Established shared JMS Connection: org.apache.qpid.jms.JmsConnection@805849

2017-05-22 16:40:46.499  WARN 14268 --- [windows.net:-1]] o.a.q.j.p.a.b.AmqpResourceBuilder        : Open of resource:(JmsConsumerInfo: { ID:c27375bc-e3e2-41a9-90a4-8e1bb1e17f8a:1:1:1, destination = dumb-pipe }) failed: Cannot open a Topic client for entity type Subscriber. TrackingId:74bcb8d5-5d05-4239-9dad-cb2133015c29_B19, SystemTracker:servicebus-topic:topic:dumb-pipe~127|sink-alpha-test-processing-subscription, Timestamp:5/22/2017 2:40:45 PM TrackingId:f572fcfb24dc47bf9ef3968bdfa99666_G17, SystemTracker:gateway2, Timestamp:5/22/2017 2:40:44 PM [condition = amqp:not-allowed]

2017-05-22 16:40:46.520  WARN 14268 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'domainListenerContainer' defined in class path resource [ServiceBusConfig.class]: Invocation of init method failed; nested exception is org.springframework.jms.UncategorizedJmsException: Uncategorized exception occurred during JMS processing; nested exception is javax.jms.JMSException: Cannot open a Topic client for entity type Subscriber. TrackingId:74bcb8d5-5d05-4239-9dad-cb2133015c29_B19, SystemTracker:servicebus-topic:topic:dumb-pipe~127|sink-alpha-test-processing-subscription, Timestamp:5/22/2017 2:40:45 PM TrackingId:f572fcfb24dc47bf9ef3968bdfa99666_G17, SystemTracker:gateway2, Timestamp:5/22/2017 2:40:44 PM [condition = amqp:not-allowed]

请注意,使用未分区主题时,一切似乎都很好(制作人和消费者)。

我发现现在使用Azure服务总线check Latest added features from service bus documentation的AMQP协议支持分区实体。

2 个答案:

答案 0 :(得分:0)

How to use the Java Message Service (JMS) API with Service Bus and AMQP 1.0有一个Azure官方教程。我认为您可以尝试将教程中的示例代码(基于geronimo jms,JMS标准的实现)与Spring JMS集成,如果您非常熟悉spring-jms以连接Azure服务总线分区主题。

答案 1 :(得分:0)

您可能已使用主题创建的默认值,并且已启用“启用分区”。在关闭分区的情况下重新创建主题,一切正常。

您可以按照博客中提供的示例进行操作

http://ramblingstechnical.blogspot.in/p/using-azure-service-bus-with-spring-jms.html