Tôi đang tìm kiếm JMS bằng Spring và muốn tạo một số người tiêu dùng đồng thời của một hàng đợi cụ thể khi web MVC của tôi khởi động.Chú thích mùa xuân tương đương với jms: listener-container
Tôi đã nhìn thấy các cấu hình XML sau ở đâu đó trên SO (https://stackoverflow.com/a/6861144):
<jms:listener-container concurrency="10">
<jms:listener destination="some.queue" ref="fooService" method="handleNewFoo"/>
</jms:listener-container>
Tôi đang sử dụng cấu hình Spring trong Java như trái ngược với XML. Ai đó có thể xin giúp đỡ với cú pháp cho chú thích mùa xuân?
JmsConfiguration.java hiện của tôi trông giống như:
@Configuration
@ComponentScan(basePackages="net.domain.orders")
public class JmsConfiguration {
@Bean
public JmsTemplate jmsTemplate() {
JmsTemplate jmsTemplate = new JmsTemplate();
jmsTemplate.setDefaultDestination(new ActiveMQQueue("orders.queue"));
jmsTemplate.setConnectionFactory(connectionFactory());
return jmsTemplate;
}
@Bean
public ActiveMQConnectionFactory connectionFactory() {
ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory();
activeMQConnectionFactory.setBrokerURL("tcp://localhost:61616");
return activeMQConnectionFactory;
}
}
Tôi đã tìm kiếm rất nhiều ví dụ nhưng tất cả tôi đã tìm thấy cho đến nay là dựa trên XML.