apache activemq intro - may-2012
TRANSCRIPT
ActiveMQ
introduction
What is ActiveMQ?
• Apache ActiveMQ ™ is the most popular and powerful open source messaging and Integration Patterns server.
• Apache ActiveMQ is fast, supports many Cross Language Clients and Protocols, comes with easy to use Enterprise Integration Patterns and many advanced features while fully supporting JMS 1.1 and J2EE 1.4. Apache ActiveMQ is released under the Apache 2.0 License
[From apache activemq’s website]
Enterprise Integration Patterns
[We are not going to cover Camel in this talk]
• ActiveMQ includes the Apache Camel (http://camel.apache.org/) framework as implementation of the book Enterprise Integration Patterns (http://www.enterpriseintegrationpatterns.com/toc.html)
• Camel empowers you to define routing and mediation rules in a variety of domain-specific languages, including a Java-based Fluent API, Spring or Blueprint XML Configuration files, and a Scala DSL.
• Camel has transports (http://camel.apache.org/transport.html) for many different kinds of protocols, messaging systems, etc.
– Amazon, AMQP, CXF, EJB, File, Gmail, HDFS, Http, JDBC, Jetty, Lucene, MongoDB, Netty, POP3, Quartz, RMI, SSH, Websocket, XMPP, etc
Java Camel DSL example: receiving a message from ActiveMQ and sending it to a file.
from(“activemq:test.queue").to("file://test.txt");
Camel is a framework included in the ActiveMQ distribution; it is up to you using it or not.
Cross Language Clients and ProtocolsYou can use ActiveMQ from virtually any
language, and of course from the TID techplan languages.
Protocols:
OpenWire, REST, Stomp, WS Notification, XMPP, AMQP, MQTT
Languages:
C++, Java, Python, JavaScript - Ajax or WebSockets, PHP, ActionScript 3, Ajax, C, C# and .Net, Delphi and Delphi/FreePascal, Erlang, Flash / ActionScript, Haskell, Perl, Pike, Ruby and Rails support via ActiveMessaging, Smalltalk, WebSockets
JMS 1.1 Features•Point to point [queues]: inmemory, persistent, transactional…
•Publish/subscribe [topics]: transient / durable (durable messages are non-persistent!!!)
•MessageTypes: text, stream, map, object…
pub
prod cons
subs1
subs2
subs3
order.insert
order.insert
order.*
order.>
Advanced features•Amq extensions to base JMS
– Exclusive consumer: assure messages arrive in order, when multiple consumers. Only one actively consuming. Consumer priorities.
– Message groups: ‘sticky load balancer’, during subscriber life or msg group closed.
– Composite & virtual destinations: ‘broker-based-routing’
prod
subs1
subs2
order.insert
order.>
Compositequeue.q Queue.b
cons
Deployment optionsSingle JVM
Embedded broker
Peer to peer
Client-server
Integration with java code:•Initialize by code•Spring•Start as external process
Failover & Fanout Transports
Networks of brokers & HABroker networks, messages not consumed locally are forwarded broker-to-broker and dispatched to remote clients.• Message can hop through multiple
brokers before consumed.• Each message is owned by a single
broker at any point in time.• Messages are load-balanced among
interested consumers.High availability: sharing data among brokers in a Master/Slave configuration• Fully-replicated Master/Slave
pairing• Shared file system (SAN)
Master/Slave• Shared database Master/Slave
Live examples
• Simple queue• Simple topic• Web mgmt• Monitoring with JMX (jconsole)
Some references• Apache ActiveMQ - http://activemq.apache.org/• What is ActiveMQ? - http://www.javacodegeeks.com/2012/04/what-is-activemq.html• JMS Development Fundamentals using Apache ActiveMQ -
http://www.javacodegeeks.com/2012/03/jms-development-fundamentals-using.html• ActiveMQ IS Ready For Prime Time -
http://www.javacodegeeks.com/2012/03/activemq-is-ready-for-prime-time.html • STOMP Messaging Benchmarks: ActiveMQ vs Apollo vs HornetQ vs RabbitMQ -
http://hiramchirino.com/blog/2011/12/stomp-messaging-benchmarks-activemq-vs-apollo-vs-hornetq-vs-rabbitmq/ • Maven plugin for Amq Performance - http://
activemq.apache.org/activemq-performance-module-users-manual.html
• Observations on ActiveMQs temp storage. - http://tmielke.blogspot.com.es/2011/02/observations-on-activemqs-temp-storage.html
• How to Use Automatic Failover In an ActiveMQ Network of Brokers - http://bsnyderblog.blogspot.com.es/2010/01/how-to-use-automatic-failover-in.html
• Using Apache Camel, ActiveMQ and Esper for Complex Event Processing - http://macstrac.blogspot.com.es/2008/02/using-apache-camel-activemq-and-esper.html
• Apache Apollo 1.0 Released - http://davsclaus.blogspot.com.es/2012/02/apache-apollo-10-released.html• Apache Apollo 1.0 Released! - http://hiramchirino.com/blog/2012/02/apache-apollo-1-0-released/