I’m live blogging from “Message Driven Architecture with Spring” by Mark Fisher at TheServerSide Java Symposium. Mark talks about how Spring messaging involved with the idea simple POJOs, similar to JMS. Mark’s examples involve RabbitMQ, as one of the more recent and powerful messaging providers. Below are some notes for this talk.
Mark introduces Advanced Message Queuing Protocol, AMQP for short, protocol as an alternative to standard JMS messaging but with a richer feature set including an advancing system of binding for filtering/routing of messages. Also, AMQP templates are very similar to JMS templates. Mark presented a number of slides with code examples of AMQP using the templates.
Mark presents MailSender, which can be used to send simple mail massages.
3. Lifecycle Management
The Spring SmartLifeCycle has been created in Spring 3.0 to help facilitate auto-start and graceful shutdown of listeners with the rest of the application. This feature includes an optionaly isAutoStartup() attribute which can be used, for backwards compatibility and maintenance, to disable this feature. By graceful shutdown, the components are stopped in the reverse order of startup, as needed.
4. Task Execution
Create managed and pooled tasks that don’t need to be started manually (a big no-no)
Async was added in Spring 3.0 that uses the @Async annotation for executor framework.
6. Task Schedule
Built-in framework in Spring 3.0, no longer requires Quartz scheduling plugins and similar structures. Supports recurring and cancelable tasks. The @Scheduled(“*/5 * 9-17 * * ?”) annotation allows developers to build cron-like schedule tasks. There is also an alternative solution to externalize the schedule information in XML so it’s tied to the code and the code does not require import statements for the annotations. Finally, it supports meta-annotations that uses the @Scheduled annotation but points to XML reference in another location.
7. Message Publishing Interceptor
Send message a by-product of another event.
Mark covered a large variety of material in a very short time, so I wasn’t able to write all the important points from his slides. He did demonstrate a number of really useful features available in Spring 3.0 and showed how messaging in Spring has really grown to a more mature development platform. He presentation was especially good because he managed to include demonstrations of the code alongside the spec information.
Pingback: After The Server Side Java Symposium – live blog index | Down Home Country Coding With Scott Selikoff and Jeanne Boyarsky