25.02.2015 Views

Introducing Spring Framework

Introducing Spring Framework

Introducing Spring Framework

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 20 ■ Your First <strong>Spring</strong> XD Application<br />

Figure 20-10. <strong>Spring</strong> XD Counter at http://localhost:9393/metrics/counters/pdfcount<br />

Figure 20-10 shows the result of sending the PDF messages. In this case, the counter’s value is 19.<br />

Now you can start sending as many documents as you want. Listing 20-1 shows a <strong>Spring</strong> Boot client that uses<br />

rabbitmq and uses a consumer, just to see how it will interact with your <strong>Spring</strong> application and the <strong>Spring</strong> XD.<br />

Listing 20-1. rabbitmqStream.groovy<br />

@Log<br />

@Configuration<br />

@EnableRabbitMessaging<br />

class MyDocumentsRabbitMQStream implements CommandLineRunner {<br />

@Autowired<br />

RabbitTemplate rabbitTemplate<br />

private String queueName = "docs-pdf"<br />

private String exchangeName = "mydocuments"<br />

private String routingKey = ".pdf"<br />

@Bean<br />

Queue queue() {<br />

new Queue(queueName, false)<br />

}<br />

285

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!