大家好,我有一些问题,所以你能帮助我。 AmqpTemplate类的实例,从RabbitMQ的(AMQP的协议执行)线程安全的,所以可以多张线程访问该实例。
例如:
下面是一些参考:]| ludababa |理查德MacCutchan:既然你的文档的链接,也许你应该看它,看它是否声称是线程安全的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");