@SpringBootApplication
public class App implements ApplicationRunner {
public static void main(String[] args) throws IOException {
SpringApplication.run(App.class, args);
}
@Autowired
private JmsTemplate jmsTemplate;
@JmsListener(destination = "test1",selector = "q='a'")
public void aaa1(String message) {
System.out.println("1接收到: " + message);
}
@JmsListener(destination = "test1",selector = "q='b'")
public void aaa2(String message) {
System.out.println("2接收到: " + message);
}
@Override
public void run(ApplicationArguments args) throws Exception {
MessagePostProcessor postProcessor = new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws JMSException {
message.setStringProperty("q", "a");
return message;
}
};
for (int i = 0; i < 10; i++) {
jmsTemplate.convertAndSend("test1", "111111111", postProcessor);
}
}
}
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- pqdy.cn 版权所有 赣ICP备2024042791号-6
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务