MEAP Edition
Manning Early Access Program
Copyright 2008 Manning Publications
For more information on this and other Manning titles go to
www.manning.com
Contents
Preface
Part I Introduction
Chapter 1 Understanding message-oriented middleware and JMS
Chapter 2 Introduction to Apache ActiveMQ
Part II Configuring ActiveMQ
Chapter 3 Understanding connectors
Chapter 4 Persisting messages
Chapter 5 Securing ActiveMQ
Part III Using ActiveMQ
Chapter 6 Creating Java applications with ActiveMQ
Chapter 7 Embedding ActiveMQ in Java containers
Chapter 8 Connecting to ActiveMQ with other languages
Part IV Advanced ActiveMQ
Chapter 9 Broker topologies
Chapter 10 Advanced Broker features
Chapter 11 Advanced client options
Chapter 12 Tuning ActiveMQ for performance
Chapter 13 Integration patterns with ActiveMQ and Camel
Chapter 14 Administering and managing ActiveMQ
Appendix Options for various ActiveMQ components
I. An Introduction to Messaging and ActiveMQ .............................................1
1. Understanding Message-Oriented Middleware and JMS .....................2
1.1. Introduction .................................................................................2
1.1.1. Introduction to Enterprise Messaging ...............................3
1.1.2. What is Message Oriented Middleware? ...........................6
1.1.3. What is the Java Message Service? ...................................8
2. Introduction to Apache ActiveMQ .....................................................38
2.1. Introduction ...............................................................................38
2.2. What is ActiveMQ? ................................................................... 38
2.2.1. ActiveMQ Features .........................................................39
2.2.2. Why Use ActiveMQ? ...................................................... 41
2.2.3. When and Where to Use ActiveMQ ................................44
2.3. Getting Started With ActiveMQ ............................................... 47
2.3.1. Downloading ActiveMQ ................................................. 47
2.3.2. Expanding the ActiveMQ Archive ..................................48
2.3.3. Examining the ActiveMQ Directory ............................... 48
2.3.4. Starting Up ActiveMQ ....................................................49
2.4. Understanding the Example Use Cases .....................................55
2.4.1. Prerequisites ....................................................................55
2.4.2. ActiveMQ In Action Examples .......................................59
2.5. Summary ................................................................................... 73
II. Configuring ActiveMQ .............................................................................74
3. Understanding Connectors .................................................................. 75
3.1. Understanding Connector URIs ................................................75
3.2. Configuring Transport Connectors ........................................... 78
3.2.1. Using Transport Connectors ............................................ 80
3.2.2. Using Network protocols ................................................ 83
3.2.3. Using Virtual Machine protocols ....................................98
3.3. Configuring Network Connectors ...........................................102
3.3.1. Understanding Discovery Agents .................................. 104
3.4. Summary ................................................................................. 117
4. Message Persistence ..........................................................................118
4.1. How are messages stored for Queues and Topics? .................118
ii
4.2. Configuring ActiveMQ Message Stores .................................120
4.3. Using The AMQ Message Store ............................................. 122
4.3.1. How the AMQ Message Store works ............................122
4.3.2. The AMQ Message Store directory structure ................124
4.3.3. Configuring the AMQ Message Store ...........................127
4.3.4. When to use the AMQ Message Store ..........................129
4.4. The JDBC Message Store ....................................................... 129
4.4.1. Databases supported by the JDBC Message Store ........129
4.4.2. How the JDBC Message Store tables are used ............. 130
4.4.3. Configuring the JDBC Message Store ..........................132
4.4.4. When to use the JDBC Message Store ..........................134
4.4.5. Using JDBC Message Store with the ActiveMQ Journal 134
4.4.6. When to use the JDBC Message Store and Journal ......135
4.5. The Kaha Message Store .........................................................135
4.5.1. Configuring the Kaha Store ........................................... 135
4.5.2. When to use the Kaha Store ..........................................136
4.6. The Memory Message Store ................................................... 136
4.6.1. Configuring the Memory Store .....................................137
4.6.2. When to use the Memory Message Store ......................137
4.7. Caching Messages in the Broker for Consumers ....................138
4.7.1. How Message Caching for Consumers Works ............. 138
4.7.2. The ActiveMQ subscriptionRecoveryPolicys ...............139
4.7.3. Configuring SubscriptionRecoveryPolicy for the Message
Broker ......................................................................................141
4.8. Summary ................................................................................. 142
5. Securing ActiveMQ ..........................................................................143
5.1. Introducing Basic Security Concepts ......................................143
5.2. Authenticating Clients .............................................................144
5.2.1. Configuring Simple Authentication Plugin ...................144
5.2.2. Configuring JAAS Plugin ............................................. 146
5.3. Authorizing Operations ........................................................... 148
5.4. Implementing Message Level Authorization ..........................150
5.5. Building Custom Security Plugin ............................................ 152
5.6. Summary ................................................................................. 155
ActiveMQ In Action
iii