且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Rabbitmq实现AMQP协议

更新时间:2022-10-15 17:29:23

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


对不精确的问题深表歉意;我只是出于兴趣点链接文档:)


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 :)