Rabbitmq实现AMQP协议 [英] Rabbitmq implementation of AMQP protocol

查看:158
本文介绍了Rabbitmq实现AMQP协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一些问题,您可以帮我吗. Rabbitmq(AMQP协议的实现)线程中的AmqpTemplate类的实例安全吗,因此多个线程可以访问该实例.

示例:

 ConnectionFactory connectionFactory =  CachingConnectionFactory();

AmqpAdmin admin =  RabbitAdmin(connectionFactory);
admin.declareQueue(" );

AmqpTemplate template =  RabbitTemplate(connectionFactory); // 是模板模板线程安全的
template.convertAndSend(" "  foo");

字符串 foo = template.receiveAndConvert("  span>); 




这里是一些参考: http://static.springsource.org/spring-amqp/reference/html/#d0e63 [^ ]

解决方案

由于您具有文档的链接,也许您应该阅读它,以查看其是否声称是线程安全的.


<我已经阅读了该文档,并且与模板实例的(线程安全)属性无关.
对不精确的问题深表歉意;我只是出于兴趣点链接文档:)


Hello everyone, I have some problem so can you help me. Is instance of AmqpTemplate class from Rabbitmq ( implementation of AMQP protocol) thread safe, so can mulitple threads access that instance.

Example:

ConnectionFactory connectionFactory = new CachingConnectionFactory();

AmqpAdmin admin = new RabbitAdmin(connectionFactory);
admin.declareQueue("myqueue");

AmqpTemplate template = new RabbitTemplate(connectionFactory); // is tamplate instance thread safe
template.convertAndSend("myqueue", "foo"); 

String foo = template.receiveAndConvert("myqueue");




Here is some reference: http://static.springsource.org/spring-amqp/reference/html/#d0e63[^]

解决方案

Since you have the link to the documentation perhaps you should read it to see if it claims to be thread safe.


I read that documentation and there is nothing about (thread-safe) property of template instance.
Sorry for imprecision question; I linked documentation just for points of interests :)


这篇关于Rabbitmq实现AMQP协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆