Rationalize AMQP sample
This commit is contained in:
@@ -16,10 +16,6 @@
|
||||
|
||||
package sample.amqp;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.amqp.core.AmqpAdmin;
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -29,14 +25,6 @@ public class Sender {
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private AmqpAdmin amqpAdmin;
|
||||
|
||||
@PostConstruct
|
||||
public void setUpQueue() {
|
||||
this.amqpAdmin.declareQueue(new Queue("foo"));
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 1000L)
|
||||
public void send() {
|
||||
this.rabbitTemplate.convertAndSend("foo", "hello");
|
||||
|
||||
Reference in New Issue
Block a user