Interview and Book Excerpt: ActiveMQ in Action
ActiveMQ in Action book, authored by Bruce Snyder, Dejan Bosanac and Rob Davies, covers the features and use of ActiveMQ, an open source message-oriented middleware. The first section of the book introduces ActiveMQ, message-oriented middleware and the Java Message Service (JMS). After a brief introduction of the examples used throughout the book, the second section describes how to configure the standard ActiveMQ components including transport connectors, the persistent message store and various levels of security. Section three dives a bit deeper, covering such topics as creating Java applications with ActiveMQ, how to integrate ActiveMQ with application servers including Tomcat, Jetty, Geronimo and JBoss and developing messaging applications using languages like C++, .NET, PHP, Python, Ruby and more. Section four includes more advanced topics including high availability and scalability, more advanced broker and client features, performance tuning, administration and monitoring.
InfoQ spoke with Bruce Snyder, co-author of the book, about the main motivation for writing the book, transaction management and messaging security aspects in ActiveMQ container and emerging trends in the messaging space. We are also making an excerpt from the book (Writing JMS clients using Spring section in Chapter 7 - Creating Java applications with ActiveMQ) available for our readers. There is also a 40% discount available on the book price when you use the discount code infoq40.
InfoQ: What was the main motivation for writing the book?
Bruce Snyder: Inside of the ActiveMQ committer community, there is a lot of knowledge about message queuing, ActiveMQ and JMS. Although some of that info is available on the ActiveMQ website, it's poorly organized and oftentimes doesn't get to the level of detail that many users need. So we decided it would be a good idea to organize our knowledge and ideas into a book.
InfoQ: What is the current state of asynchronous messaging architecture and how does ActiveMQ compare with other message brokers (open source and commercial)?
Bruce: In recent years, the introduction of the STOMP protocol has had a big influence on the world of asynchronous messaging. STOMP is an acronym for Streaming Text Orientated Messaging Protocol. It is supported by numerous messaging solutions and client APIs not only in the Java community but also well beyond. The focus of the STOMP protocol is to develop an interoperable, text-only, wire format to allow a STOMP client written in any language to communicate with a STOMP message broker written in any language. Similar to HTTP, the STOMP protocol provides a set of verbs or commands for a client to interact with a message broker. Also, the Advanced Message Queuing Protocol (AMQP) spec has been maturing and beginning to have more influence. The AMQP spec aims to create a standardized wire level protocol for messaging that is as ubiquitous as HTTP is for delivering web content. Also, the JMS 2.0 JSR is just forming. JMS 1.0 was released in 1998 with a small update in 2002, so it will be interesting to see what proposals will be made and discussed.
InfoQ: Can you talk about the security aspect of messaging architecture when using ActiveMQ?
Bruce: ActiveMQ allows security at the broker level, the destination level and the message level. For broker level security, authentication is used and ActiveMQ offers two types of authentication: either simple authentication or a JAAS-based, pluggable authentication. For the simple authentication, ActiveMQ provides an implementation that utilizes plain users and groups that are configured via in the XML config file to determine access. For the JAAS-based authentication, ActiveMQ provides a JAAS login module that can utilize properties files, LDAP, or SSL certificates or you could implement your own JAAS login module. To manage the security of destinations, there are the three types of operations that are of concern: read, write and admin. ActiveMQ manages these three operations using authorization via the provided JAAS login module. Message level security is a very application-specific concern where only certain messages on a destination can be accessed. To achieve this level of security, you must implement your own custom message authorization policy. The thing to remember about this level of security is that it must be applied to every message on a destination. So you need to be careful not to cause the authorization to be too expensive.
InfoQ: What kind of transaction management support ActiveMQ provides, especially for the use cases that need two-phase (XA) transactions?
Bruce: ActiveMQ supports JTA and basic XA. But I'm not much of a fan of distributed transactions because they tend to lead to brittle apps and they degrade performance. Anyone interested in this topic should read Pat Helland's excellent paper on the topic named Life beyond Distributed Transactions: an Apostate's Opinion.
InfoQ: What new features would you like to see in JMS 2.0 and future versions of the JMS specification?
Bruce: I'd like to see some updates made to JMS to interact better with the web and other standards such as web sockets and AMQP. ActiveMQ certainly has many innovations beyond the JMS spec, but I'm not sure if any of those warrant inclusion in JMS.
InfoQ: What are the emerging trends, techniques and tools in the messaging space?
Bruce: There is so much integration that takes place in IT these days that the enterprise integration patterns have grown dramatically in popularity over the last several years. This is an exciting area that is being addressed by two widely used Java integration frameworks, Spring Integration and Apache Camel. Furthermore, there are a lot of folks out there who are just now discovering asynchronous messaging and event-driven architecture (EDA). There are some very large, very well known systems out there that are built using EDA as a central principal including Amazon, Twitter and Facebook just to name a few, even VMware's CloudFoundry is built using EDA.
InfoQ: Thanks for your time Bruce. Final question, what are your favorite IT and non-IT books?
Bruce: I tend to read quite a lot and I enjoy books on a wide variety of topics including business, IT, fiction, religion, classics, etc. The most compelling book that I have read in many years is Three Cups of Tea (as well as the follow-up book, Stones Into Schools). These books tell the story of American Greg Mortenson and his effort to build schools in remote regions of Afghanistan and Pakistan. I was even lucky enough to see Mortenson deliver a talk in northern Colorado last year. I recently read a business book that stuck with me called Rework. It's a book of short essays on business that eschews many traditional business notions. Rework focuses on disruptive ideas in the areas of progress, productivity, competition, hiring, culture and more. While the concepts in book are not altogether new, its style of questioning is compelling, edgy and thought-provoking but down to earth.
Regarding IT books, here are three I have read that I like and recommend:
- Java Concurrency in Practice
- Enterprise Integration Patterns
- Event Processing in Action
About the Book Author
Bruce Snyder is a veteran of enterprise software development and open source software. With over 15 years of experience, Bruce has fulfilled roles around software research and development using a wide range of technologies including Java EE, enterprise messaging and integration, service-oriented architecture and event-driven architecture. Bruce is a senior software engineer at SpringSource/VMware, a member of the Apache Software Foundation and a committer on numerous Apache projects including ActiveMQ. He is not only a published author of books on ActiveMQ, the Spring Framework, Maven and Geronimo, he is also a recognized international speaker at software conferences around the world and has helped to build communities around open source software. Bruce lives in beautiful Boulder, Colorado with his family where he enjoys cycling, hiking, running and anything outdoors.
For this excerpt usage only, I have comment as we are going to read just this section of book from above article link.
It would be helpful to add paragraph of all MQ related classes you use in the chapter and explain their role and usage with pseudo code (high level) and then add the complete examples. I felt reading through the examples was not easy to refer back and forth and was not getting entire picture.
Mike Amundsen May 29, 2015
Ben Linders May 28, 2015