Format source code
This commit is contained in:
parent
20b387c5dd
commit
2a8b557a3f
@ -27,16 +27,10 @@ public class AMQPHelloWorldMessageApp {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
// ApplicationContext context = new AnnotationConfigApplicationContext(HelloWorldConfiguration.class);
|
|
||||||
// AmqpTemplate amqpTemplate = context.getBean(AmqpTemplate.class);
|
|
||||||
//
|
|
||||||
// amqpTemplate.convertAndSend("Hello World");
|
|
||||||
// System.out.println("Sent: Hello World");
|
|
||||||
|
|
||||||
SpringApplication.run(AMQPHelloWorldMessageApp.class, args);
|
SpringApplication.run(AMQPHelloWorldMessageApp.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ConnectionFactory connectionFactory() {
|
public ConnectionFactory connectionFactory() {
|
||||||
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(MY_QUEUE_HOSTMANME);
|
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(MY_QUEUE_HOSTMANME);
|
||||||
connectionFactory.setUsername(MY_QUEUE_USERNAME);
|
connectionFactory.setUsername(MY_QUEUE_USERNAME);
|
||||||
@ -69,22 +63,20 @@ public class AMQPHelloWorldMessageApp {
|
|||||||
// return new Queue(MY_QUEUE_NAME, NON_DURABLE);
|
// return new Queue(MY_QUEUE_NAME, NON_DURABLE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ApplicationRunner runner(RabbitTemplate template) {
|
public ApplicationRunner runner(RabbitTemplate template) {
|
||||||
return args -> {
|
return args -> {
|
||||||
for (int i =0; i<1000; i++) {
|
for (int i = 0; i < 1000; i++) {
|
||||||
template.convertAndSend("Hello, world - OSSEZ.COM!"+ i);
|
template.convertAndSend("Hello, world - OSSEZ.COM!" + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RabbitListener(queues = MY_QUEUE_NAME)
|
@RabbitListener(queues = MY_QUEUE_NAME)
|
||||||
public void listen(String in) {
|
public void listen(String in) {
|
||||||
System.out.println("Message read from myQueue : " + in);
|
System.out.println("Message read from myQueue : " + in);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user