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 16 ■ Messaging with Your <strong>Spring</strong> Application<br />

The result of running Listing 16-11 will be the following output (the documents sent and received by the consumers):<br />

2014-03-27 22:46:21,328 DEBUG [main] Testing RabbitMQ Producer...<br />

2014-03-27 22:46:21,539 DEBUG [SimpleAsyncTaskExecutor-1] Web Document received: Document(id:<br />

431cddbf-f3c0-4076-8c1c-564e7dce16c9, name: Pro <strong>Spring</strong> Security, type: Type(id: 4980d2e4-a424-4ff4-<br />

a0b2-476039682f43, name: WEB, description: Web Link, extension: .url), location:<br />

http://www.apress.com/9781430248187, created: 2014-02-14, modified: 2014-02-20)<br />

2014-03-27 22:46:21,539 DEBUG [SimpleAsyncTaskExecutor-1] Text Document received: Document(id:<br />

3580f482-7f12-4787-bb60-c98023d47b6c, name: Clustering with RabbitMQ, type: Type(id: e8e5310b-6345-<br />

4d08-86b6-d5c3c299aa7f, name: NOTE, description: Text Notes, extension: .txt), location: /docs/<br />

isfbook/Documents/Random/Clustering with RabbitMQ.txt, created: 2014-02-18, modified: 2014-02-20)<br />

2014-03-27 22:46:21,539 DEBUG [SimpleAsyncTaskExecutor-1] PDF Document received: Document(id:<br />

1acbb68a-a859-49c9-ac88-d9e9322bac55, name: Book Template, type: Type(id: 41e2d211-6396-4f23-9690-<br />

77bc2820d84b, name: PDF, description: Portable Document Format, extension: .pdf), location: /docs/<br />

isfbook/Documents/Random/Book Template.pdf, created: 2014-02-24, modified: 2014-02-26)<br />

2014-03-27 22:46:21,607 DEBUG [SimpleAsyncTaskExecutor-1] Web Document received: Document(id:<br />

65c28c5a-ce8c-4446-84da-9e44e1525bd0, name: Bad Book, type: Type(id: 4980d2e4-a424-4ff4-a0b2-<br />

476039682f43, name: WEB, description: Web Link, extension: .url), location:<br />

http://bad.url.com/bad, created: 2014-02-14, modified: 2014-02-20)<br />

2014-03-27 22:46:21,609 DEBUG [SimpleAsyncTaskExecutor-1] Web Document received: Document(id:<br />

bb633530-20dc-4b46-b320-ff98dc5c3e49, name: Pro <strong>Spring</strong> 3, type: Type(id: 4980d2e4-a424-4ff4-a0b2-<br />

476039682f43, name: WEB, description: Web Link, extension: .url), location:<br />

http://www.apress.com/9781430241072, created: 2014-02-14, modified: 2014-02-20)<br />

2014-03-27 22:46:21,989 DEBUG [SimpleAsyncTaskExecutor-1] PDF Document received: Document(id:<br />

cf7fec3e-55bf-426d-8a6f-2ca752ae34ac, name: Sample Contract, type: Type(id: 41e2d211-6396-4f23-9690-<br />

77bc2820d84b, name: PDF, description: Portable Document Format, extension: .pdf), location: /docs/<br />

isfbook/Documents/Contracts/Sample Contract.pdf, created: 2014-02-24, modified: 2014-02-28)<br />

Summary<br />

In this chapter, you saw how the RabbitMQ works in detail, using exchanges, bindings, and queues. Also, you learned<br />

about RabbitMQ’s routing capabilities and the direct exchange to route based on the routing key to the desired queue,<br />

a one-to-one relationship.<br />

You also saw how to configure the <strong>Spring</strong> container so it can automatically create the exchanges, bindings, and<br />

queues in a declarative form. Now you are ready to do any type of messaging within your <strong>Spring</strong> application, such as<br />

adding messaging capabilities for users that only need to receive e-mail about the most recent books. Then you can<br />

create a specialized queue called a publish/subscribe scenario so your users can subscribe to it.<br />

In the next chapter, you are going to Tweet messages through the Twitter REST API using the <strong>Spring</strong> Social module.<br />

229

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

Saved successfully!

Ooh no, something went wrong!