SlideShare a Scribd company logo
Introduc6on to Ac6veMQ Apollo 




Bosanac Dejan
May 2011 




                                                                                                                                      A Progress So3ware Company 
       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.     FuseSource Confiden6al      A Progress So3ware Company 
1 
About me  

  Bosanac Dejan 
  Senior So3ware Engineer at FUSESource ‐ hNp://fusesource.com  
  Apache Ac6veMQ commiNer and PMC member 
  Co‐author of Ac6veMQ in Ac6on 




                                                                                                                  A Progress So3ware Company 
 2    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
What we are going to cover? 




  Why Apollo? 
  HawtDispatch 
  Connec6vity 
      •  Stomp 1.1, MQTT, JMS, ... 
  LevelDB Store 
  Features 
      •  REST Based Management 
  Future 



                                                                                                                     A Progress So3ware Company 
 3       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Why Apollo? 




                                                                                                                                    A Progress So3ware Company 
     Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.     FuseSource Confiden6al      A Progress So3ware Company 
4 
Apache Apollo 


                                                                  Goal 
  An experiment to beNer u6lize high core counts on modern 
   processors 

                                                             Resulted
  A completely new broker core that is much more determinis6c, 
   stable, and scaleable 
  Branched as a new project and a chance for a clean start 




                                                                                                                  A Progress So3ware Company 
 5    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Apollo Architecture 




  Reactor Based Thread Model 
  Scala implementa6on 
  Protocol Agnos6c 
  REST Based Management 




                                                                                                                  A Progress So3ware Company 
 6    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
HawtDispatch 




                                                                                                                                    A Progress So3ware Company 
     Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.     FuseSource Confiden6al      A Progress So3ware Company 
7 
HawtDispatch ‐ Introduc6on 




  Small (less than 100k) thread pooling and NIO event no6fica6on 
   framework API 
  hNp://hawtdispatch.fusesource.org/ 
  Java clone of Grand Central Dispatch 
  Avoid explicit usage of threads and synchroniza6on points in 
   mul6threaded applica6ons 
  Applica6on developer submit tasks to dispatch queues 
  Fixed‐sized thread pool execute tasks 



                                                                                                                  A Progress So3ware Company 
 8    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
HawtDispatch ‐ Dispatch Queues 

  Global Dispatch Queue 
      •  3 global queues shared 
      •  Non determinis6c order 
      •  3 priori6es 

                               DispatchQueue queue = getGlobalQueue(HIGH);
                                


  Serial Dispatch Queue 
      •  Serial FIFO queues 
      •  Synchronize certain task execu6ons 

                           DispatchQueue queue = createQueue("My queue");
                            




                                                                                                                     A Progress So3ware Company 
 9       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
HawtDispatch ‐ Submijng Tasks 

  Java                                                             queue.execute(new Runnable(){
                                                                      public void run() {
                                                                         System.out.println("Hi!");
                                                                      }
                                                                    });
  Scala                                                             
                                                                       queue {
                                                                          System.out.println("Hi!");
                                                                       }
                                                                       // or
                                                                       queue.execute(^{
                                                                          System.out.println("Hi!");
  Tasks                                                               })
       •  non‐blocking                                                  
       •  lock‐free 
       •  wait‐free 



                                                                                                                      A Progress So3ware Company 
 10       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
HawtDispatch ‐ Dispatch Sources 

  Trigger a task execu6on based on external event 
  Ideal for dealing with NIO events 

      SelectableChannel channel = ...
      DispatchQueue queue = createQueue()
      DispatchSource source = createSource(channel, OP_READ, queue);
      source.setEventHandler(new Runnable(){
        public void run() {
           ByteBuffer buffer = ByteBuffer.allocate(1024);
           int count;
           while( (c=channel.read(buffer)) > 0 ) {
              // just dump it to the console
              System.out.write(buffer.array(), buffer.offset(), buffer.position());
           }
        }
      });
      source.resume();
       




                                                                                                                    A Progress So3ware Company 
11      Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
HawtDispatch ‐ conclusion 

  Ideal for developing highly concurrent applica6ons 
  Ideal for handling NIO events 
  Ideal for implemen6ng broker cores 
  Impressive performances 




  New development paradigm means it couldn t be fiNed into exis6ng 
   Ac6veMQ broker 



                                                                                                                   A Progress So3ware Company 
 12    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Connec6vity 




                                                                                                                                     A Progress So3ware Company 
      Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.     FuseSource Confiden6al      A Progress So3ware Company 
13 
Message protocols ‐ Overview 



  Broker Core is Protocol Agnos6c  
  Protocols are Plugins 
       •  STOMP 1.0/1.1 
       •  MQTT v3.1 
       •  Openwire 
  Transports are Pluggable too. 
       •  TCP, WebSockets etc. 
  Protocol detec6on (all protocols can use 1 port) 




                                                                                                                      A Progress So3ware Company 
 14       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Feature: Mul6ple Transports 




  TCP 
  SSL  
  WebSockets 
  Secure WebSockets 
  UDP 




                                                                                                                  A Progress So3ware Company 
15    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Stomp ‐ basics 




  hNp://stomp.github.com/ 
  Simple Text Orientated Messaging Protocol 
  HTTP for the messaging realm 
  Very simple, so it s easy to write clients and servers in prac6cally 
   any language 
  A lot of exis6ng clients in C, Ruby, Pyhton, JS, PHP, etc. 
  Provides a way to connect different plamorms in asynchronous way 
  Also Implemented by Ac6veMQ, RabbitMQ, HornetQ, and many 
   others. 


                                                                                                                   A Progress So3ware Company 
 16    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Stomp ‐ Nutshell 

  Based on text frames, similar to 
   HTTP ones                                                                                               MESSAGE
                                                                                                           subscription:0
  Can transport binary bodies                                                                             message-id:007
  Frame command for every                                                                                 destination:/queue/a
                                                                                                           content-type:text/plain
   messaging concept, like CONNECT, 
   MESSAGE, SUBSCRIBE, ACK, etc.                                                                           hello queue a^@
  New in version 1.1 
      •  Protocol nego6a6on 
      •  Heartbeats 
      •  NACK 
      •  Virtual hosts 




                                                                                                                             A Progress So3ware Company 
17       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Apollo and Stomp 

  Both 1.0 and 1.1 Supported 
                                                                                                          SEND
  Des6na6on Types                                                                                        destination:/queue/a
       •  Queues ‐ /queue/a                                                                               receipt:001
       •  Topics ‐ /topic/b	                                                                              persistent: true
       •  Durable Subscrip6ons ‐ /dsub/c 
                                                                                                          hello queue a
                                                                                                          ^@
  Reliable messaging 
                                                                                                          RECEIPT
                                                                                                          receipt-id:001

                                                                                                          ^@




                                                                                                                           A Progress So3ware Company 
 18        Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Apollo and Stomp 



  More messaging features 
      •  Message expira6on 
      •  Topic retained messages 
      •  Topic durable subscrip6ons 
      •  Queue browsing 
      •  Queue message sequences 
      •  Exclusive subscrip6ons 
      •  Temporary des6na6ons 
      •  Des6na6on wildcards 
      •  Composite des6na6ons 
      •  Message selectors 



                                                                                                                     A Progress So3ware Company 
19       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Connec6vity ‐ MQTT 

  Get at hNps://github.com/fusesource/fuse‐extra/ 
  Focused on: 
   •  low bandwidth networks 
   •  unreliable networks 
   •   Small footprint / Embedded Devices 
  3 QoS Op6ons 
  Also Implemented by  
   WebsphereMQ,  
   MosquiNo and  
   others. 
    



                                                                                                                   A Progress So3ware Company 
 20    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Connec6vity – JMS API 

  StompJMS is a JMS 1.1 client implemented using the STOMP 
   protocol. 
  Get it at hNps://github.com/fusesource/stompjms 
  Client implemented with HawtDispatch 
      •  Constant number of threads no maNer how many client connec6ons are 
         established. 

       import org.fusesource.stomp.jms.*;import javax.jms.*;	
       	
       StompJmsConnectionFactory factory = new
       StompJmsConnectionFactory();factory.setBrokerURI("tcp://localhost:
       61613 );	
       Connection connection = factory.createConnection( admin , password );	
       	
       Destination example = new StompJmsDestination( /queue/example );	




                                                                                                                     A Progress So3ware Company 
21       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Connec6vity – OpenWire 

  OpenWire is the na6ve binary protocol implemented by Ac6veMQ 
  API op6ons:  
      •  JMS 1.1 Client of Ac6veMQ 5.x 
      •  NMS Client for C# Apps 
      •  CMS Client for C++ Apps 
  Working Features 
      •  Queues, Topics, Durable Subscrip6ons 
      •  Temporary Des6na6ons 
      •  Transac6ons 
  Not Yet Supported 
      •  XA Transac6ons (distributed transac6ons) 
      •  Network of Brokers style clustering 
      •  0 sized consumer prefetches 

                                                                                                                     A Progress So3ware Company 
22       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB Store 




                                                                                                                                     A Progress So3ware Company 
      Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.     FuseSource Confiden6al      A Progress So3ware Company 
23 
Message Store ‐ overview 

  Message Stores are Plugins 
  Ships with 2 Op6ons 
       •  LevelDB Store 
       •  BDB Store 
  Used to store 
       •  persistent messages 
       •  non‐persistent messages that needs to be swapped out of memory 
  Non‐persistent messages that get swapped out do not get dropped 
   on restart 
  Delayed Writes 




                                                                                                                      A Progress So3ware Company 
 24       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB ‐ Basics 




  What is LevelDB 
       •  LevelDB is a fast key‐value storage library  
       •  WriNen at Google  
       •  Provides an ordered mapping from string keys to string values 
       •  Based on SSTable and Log Structured Merge (LSM) Trees 




                                                                                                                      A Progress So3ware Company 
 25       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB ‐ Basics 




  Designed to efficiently store large numbers of key‐value pairs while 
   op6mizing for high throughput, sequen6al read/write workloads 
  Ideal for implemen6ng message store index 
  Much beNer performance over tradi6onal B‐Tree indexes (used in 
   KahaDB) 




                                                                                                                  A Progress So3ware Company 
26    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB ‐ Basics 




  It s a C++ library (no client‐server support) 
  Batching writes 
  Forward and backward itera6on over data 
  Uses Snappy compression 




                                                                                                                   A Progress So3ware Company 
 27    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB Store 




  Uses LevelDB to maintain indexes into log files holding the 
   messages 
  Uses a JNI driver on Linux and OS X, but falls back to a pure Java 
   version on other plamorms 
  Supports replica6on to get High Availability 
  Default store in Apollo. Available in Apache Ac6veMQ 5.6.0 




                                                                                                                   A Progress So3ware Company 
 28    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB vs KahaDB 




  It maintains fewer index entries per message than KahaDB which 
   means it has a higher persistent throughput. 
  Faster recovery when a broker restarts 
  LevelDB based index provide a much beNer performance than the 
   B‐Tree for sequen6al access 
  LevelDB indexes support concurrent read access 
  Pauseless data log file garbage collec6on cycles 




                                                                                                                  A Progress So3ware Company 
29    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB vs KahaDB 




  Uses fewer read IO opera6ons to load stored messages. 
  It will only journal the payload of the message once 
  Exposes it's status via JMX for monitoring 
  Supports replica6on to get High Availability 




                                                                                                                  A Progress So3ware Company 
30    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB store ‐ HA 




  HA version of store works with Hadoop based file systems 
  Message log is mirrored to HDFS 
  It can sync on HDFS file instead of local file system 
  LevelDB indexes are immutable on disk (SSTables) 
  On checkpoint .sst files are uploaded to HDFS 




                                                                                                                  A Progress So3ware Company 
31    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB store ‐ HA Recovery 




  On master failure, slave will download  
       •  message log 
       •  .sst files associated with the latest uploaded index 
  Con6nue with regular recovery process 




                                                                                                                      A Progress So3ware Company 
 32       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
LevelDB store – HA locking 




  Master elec6on is done externally 
  Mul6ple brokers should never use the same HDFS path 
  Apache ZooKeeper good op6on for implemen6ng distributed 
   locking 
  FuseFabric (hNp://fuse.fusesource.org/fabric/) can be used as well 




                                                                                                                   A Progress So3ware Company 
 33    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
BDB store 



 Not ASL 2.0!  You have to Agree to the BDB 
  license & download from Oracle. 
 Pure Java implementa6on 
 Very robust 
 The BDB library supports advanced features like 
  replica6on (not yet exploited) 




                                                                                                                  A Progress So3ware Company 
34    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Features 




                                                                                                                                     A Progress So3ware Company 
      Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.     FuseSource Confiden6al      A Progress So3ware Company 
35 
Feature: JAAS Authen6ca6on 



 Use any 3rd party JAAS login module 
 Ships with security enabled by default 
  • Default id/password is admin/password 
 File based user and group configura6on 
 Supports IP address white and black lists. 
 X509 Cer6ficates 
 Op6onal guest login support 



                                                                                                                  A Progress So3ware Company 
36    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Feature: Authoriza6on rules 



 Fine grained control of who can 
  • admin, monitor, configure, connect, create, destroy,  
  • send, receive, consume 
 On broker resources like: 
  • broker, connector, virtual host, topic, queue or 
    durable subscrip6ons 
 <access_rule allow="bartenders" action="send,consume                                                                
              kind= queue topic id= BAR.* />
 <access_rule deny="guests" action="consume"/>
  
                                                                                                                  A Progress So3ware Company 
37    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Feature: Config Updates 




 All Configura6on files are watch and changes are applied at 
  run6me: 
  • Broker config: etc/apollo.xml 
  • JAAS config files like: etc/user.proper6es 
  • Logging config: etc/log4j.proper6es 
 No need to restart to apply config changes 




                                                                                                                  A Progress So3ware Company 
38    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Feature: Config Updates 




 All Configura6on files are watch and changes are applied at 
  run6me: 
  • Broker config: etc/apollo.xml 
  • JAAS config files like: etc/user.proper6es 
  • Logging config: etc/log4j.proper6es 
 No need to restart to apply config changes 




                                                                                                                  A Progress So3ware Company 
39    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Feature: REST Management 




 curl -u "admin:password"  

 http://localhost:61680/broker/virtual-hosts/default.json
  




                                                                                                                  A Progress So3ware Company 
40    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Where is it going? 




                                                                                                                                     A Progress So3ware Company 
      Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.     FuseSource Confiden6al      A Progress So3ware Company 
41 
Where has it been? 




                                                                                                                  A Progress So3ware Company 
42    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Feature diff vs Ac6veMQ 


      Missing in Apollo                                                                   Only in Apollo 
       Networks of Brokers                                                                REST Management API 
       Priority Support                                                                   Secure WebSockets 
       Message Groups                                                                     Message Sequences 
       Message Scheduling                                                                 Con6nuous Queue 
       XA Transac6ons                                                                    Browsing  
       JMX Management API                                                                 Run6me Config Updates 
                                                                                           Per Consumer Store 
                                                                                          Prefetch 
                                                                                           
                                                                                            

                                                                                                                      A Progress So3ware Company 
43        Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Future 




  Start integra6ng it in Ac6veMQ  
       •  Apollo should be a new broker engine for 6.0 
       •  We should try to port all exis6ng features (networks, priority queues, XA, etc.) 
  Tons of interes6ng work ahead of us ‐ Join us 




                                                                                                                      A Progress So3ware Company 
 44       Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
Ques6ons? 


  Links: 
    •  Apache Apollo hNp://ac6vemq.apache.org/apollo/ 
    •  STOMP Benchmarks hNp://hiramchirino.com/stomp‐benchmark/ 
    •  MQTT Protocol Plugin for Apollo hNps://github.com/fusesource/fuse‐extra 
    •  HawtDispatch hNp://hawtdispatch.fusesource.org/ 
    •  StompJMS hNps://github.com/fusesource/stompjms 

  Blog:  hNp://www.nighNale.net 


  TwiNer:  
   •  hNp://twiNer.com/dejanb 
   •  hNp://twiNer.com/fusenews 


                                                                                                                   A Progress So3ware Company 
 45    Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  

More Related Content

PPTX
Deploying FuseMQ with Fuse Fabric
PPT
Enterprise Integration Patterns with ActiveMQ
PPTX
IBM MQ vs Apache ActiveMQ
PDF
Connecting Applications Everywhere with ActiveMQ
PDF
Advanced messaging with Apache ActiveMQ
PPT
Implementing WebServices with Camel and CXF in ServiceMix
ODP
Red Hat Open Day JBoss Fuse
PPT
Web Server/App Server Connectivity
Deploying FuseMQ with Fuse Fabric
Enterprise Integration Patterns with ActiveMQ
IBM MQ vs Apache ActiveMQ
Connecting Applications Everywhere with ActiveMQ
Advanced messaging with Apache ActiveMQ
Implementing WebServices with Camel and CXF in ServiceMix
Red Hat Open Day JBoss Fuse
Web Server/App Server Connectivity

What's hot (20)

ODP
JMS and ActiveMQ - VuNV 201307
PPT
ServiceMix 4 -- Integrating OSGi with JBI
PPT
An Introduction to Apache ServiceMix 4 - FUSE ESB
PDF
JBoss Fuse - Fuse workshop EAP container
PDF
WebSockets in Enterprise Applications
ODP
Apache ActiveMQ and Apache Camel
PPTX
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
PPTX
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
PDF
Java EE 7 for WebLogic 12c Developers
DOCX
Web service through cxf
PDF
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
PDF
JavaOne 2014 BOF4241 What's Next for JSF?
PDF
Service Oriented Integration With ServiceMix
PPTX
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
PPT
Connecting applicationswitha mq
PDF
IBM WebSphere application server
PPT
Succeding with the Apache SOA stack
PPTX
Oracle WebLogic Server 12.2.1 Do More with Less
PDF
WebSphere Technical University: Top WebSphere Problem Determination Features
PDF
CON5898 What Servlet 4.0 Means To You
JMS and ActiveMQ - VuNV 201307
ServiceMix 4 -- Integrating OSGi with JBI
An Introduction to Apache ServiceMix 4 - FUSE ESB
JBoss Fuse - Fuse workshop EAP container
WebSockets in Enterprise Applications
Apache ActiveMQ and Apache Camel
Java EE 8: What Servlet 4.0 and HTTP/2 mean to you
WebSphere App Server vs JBoss vs WebLogic vs Tomcat (InterConnect 2016)
Java EE 7 for WebLogic 12c Developers
Web service through cxf
HTTP/2 Comes to Java - What Servlet 4.0 Means to You
JavaOne 2014 BOF4241 What's Next for JSF?
Service Oriented Integration With ServiceMix
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
Connecting applicationswitha mq
IBM WebSphere application server
Succeding with the Apache SOA stack
Oracle WebLogic Server 12.2.1 Do More with Less
WebSphere Technical University: Top WebSphere Problem Determination Features
CON5898 What Servlet 4.0 Means To You
Ad

Similar to Introduction to ActiveMQ Apollo (20)

PDF
Be jug 090611_apacheservicemix
PDF
Fusesource camel-persistence-part1-webinar-charles-moulliard
PDF
Enterprise Integration Patterns and DSL with Apache Camel
KEY
Apache Camel - JEEConf May 2011
PDF
Introducing Scalate, the Scala Template Engine
PDF
Preparing your code for Java 9
PDF
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
KEY
What Riding the Camel can do to make integration easier for you
PPTX
SWOFT a PHP Microservice Framework - 2020
PPTX
Apache Camel framework Presentation and selection of apache camel for various...
PDF
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
PDF
RESTful Services and Distributed OSGi - 04/2009
PDF
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
PDF
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
PPTX
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
PDF
Low Code Integration with Apache Camel.pdf
PDF
Apache Camel Introduction
PDF
Mysql repos testing.odp
PDF
Fusesource camel-persistence-part2-webinar-charles-moulliard
PDF
Shake Hooves With BeEF - OWASP AppSec APAC 2012
Be jug 090611_apacheservicemix
Fusesource camel-persistence-part1-webinar-charles-moulliard
Enterprise Integration Patterns and DSL with Apache Camel
Apache Camel - JEEConf May 2011
Introducing Scalate, the Scala Template Engine
Preparing your code for Java 9
ApacheCon NA 2010 - Developing Composite Apps for the Cloud with Apache Tuscany
What Riding the Camel can do to make integration easier for you
SWOFT a PHP Microservice Framework - 2020
Apache Camel framework Presentation and selection of apache camel for various...
Tweet4Beer (atualizada): Torneira de Chopp Controlada por Java, JavaFX, IoT ...
RESTful Services and Distributed OSGi - 04/2009
Java EE 7 et ensuite pourquoi pas JavaScript sur le serveur!
Project Avatar (Lyon JUG & Alpes JUG - March 2014)
Servlet 4.0 Adopt-a-JSR 10 Minute Infodeck
Low Code Integration with Apache Camel.pdf
Apache Camel Introduction
Mysql repos testing.odp
Fusesource camel-persistence-part2-webinar-charles-moulliard
Shake Hooves With BeEF - OWASP AppSec APAC 2012
Ad

More from dejanb (7)

PDF
How is this sausage made
PDF
Messaging for the cloud
PDF
Scaling out eclipse hono
PDF
Building Open Source IoT Cloud
PDF
Messaging for IoT
PPTX
Messaging for Web and Mobile with Apache ActiveMQ
PPT
Apache ActiveMQ - Enterprise messaging in action
How is this sausage made
Messaging for the cloud
Scaling out eclipse hono
Building Open Source IoT Cloud
Messaging for IoT
Messaging for Web and Mobile with Apache ActiveMQ
Apache ActiveMQ - Enterprise messaging in action

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Electronic commerce courselecture one. Pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Approach and Philosophy of On baking technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
Teaching material agriculture food technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Cloud computing and distributed systems.
Building Integrated photovoltaic BIPV_UPV.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Machine learning based COVID-19 study performance prediction
Electronic commerce courselecture one. Pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Spectral efficient network and resource selection model in 5G networks
Approach and Philosophy of On baking technology
Empathic Computing: Creating Shared Understanding
Mobile App Security Testing_ A Comprehensive Guide.pdf
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Network Security Unit 5.pdf for BCA BBA.
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Cloud computing and distributed systems.

Introduction to ActiveMQ Apollo

  • 1. Introduc6on to Ac6veMQ Apollo  Bosanac Dejan May 2011  A Progress So3ware Company  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.   FuseSource Confiden6al  A Progress So3ware Company  1 
  • 2. About me     Bosanac Dejan    Senior So3ware Engineer at FUSESource ‐ hNp://fusesource.com     Apache Ac6veMQ commiNer and PMC member    Co‐author of Ac6veMQ in Ac6on  A Progress So3ware Company  2  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 3. What we are going to cover?    Why Apollo?    HawtDispatch    Connec6vity  •  Stomp 1.1, MQTT, JMS, ...    LevelDB Store    Features  •  REST Based Management    Future  A Progress So3ware Company  3  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 4. Why Apollo?  A Progress So3ware Company  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.   FuseSource Confiden6al  A Progress So3ware Company  4 
  • 5. Apache Apollo  Goal    An experiment to beNer u6lize high core counts on modern  processors  Resulted   A completely new broker core that is much more determinis6c,  stable, and scaleable    Branched as a new project and a chance for a clean start  A Progress So3ware Company  5  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 6. Apollo Architecture    Reactor Based Thread Model    Scala implementa6on    Protocol Agnos6c    REST Based Management  A Progress So3ware Company  6  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 7. HawtDispatch  A Progress So3ware Company  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.   FuseSource Confiden6al  A Progress So3ware Company  7 
  • 8. HawtDispatch ‐ Introduc6on    Small (less than 100k) thread pooling and NIO event no6fica6on  framework API    hNp://hawtdispatch.fusesource.org/    Java clone of Grand Central Dispatch    Avoid explicit usage of threads and synchroniza6on points in  mul6threaded applica6ons    Applica6on developer submit tasks to dispatch queues    Fixed‐sized thread pool execute tasks  A Progress So3ware Company  8  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 9. HawtDispatch ‐ Dispatch Queues    Global Dispatch Queue  •  3 global queues shared  •  Non determinis6c order  •  3 priori6es  DispatchQueue queue = getGlobalQueue(HIGH);     Serial Dispatch Queue  •  Serial FIFO queues  •  Synchronize certain task execu6ons  DispatchQueue queue = createQueue("My queue");   A Progress So3ware Company  9  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 10. HawtDispatch ‐ Submijng Tasks    Java  queue.execute(new Runnable(){ public void run() { System.out.println("Hi!"); } });   Scala    queue { System.out.println("Hi!"); } // or queue.execute(^{ System.out.println("Hi!");   Tasks  }) •  non‐blocking    •  lock‐free  •  wait‐free  A Progress So3ware Company  10  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 11. HawtDispatch ‐ Dispatch Sources    Trigger a task execu6on based on external event    Ideal for dealing with NIO events  SelectableChannel channel = ... DispatchQueue queue = createQueue() DispatchSource source = createSource(channel, OP_READ, queue); source.setEventHandler(new Runnable(){ public void run() { ByteBuffer buffer = ByteBuffer.allocate(1024); int count; while( (c=channel.read(buffer)) > 0 ) { // just dump it to the console System.out.write(buffer.array(), buffer.offset(), buffer.position()); } } }); source.resume();   A Progress So3ware Company  11  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 12. HawtDispatch ‐ conclusion    Ideal for developing highly concurrent applica6ons    Ideal for handling NIO events    Ideal for implemen6ng broker cores    Impressive performances    New development paradigm means it couldn t be fiNed into exis6ng  Ac6veMQ broker  A Progress So3ware Company  12  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 13. Connec6vity  A Progress So3ware Company  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.   FuseSource Confiden6al  A Progress So3ware Company  13 
  • 14. Message protocols ‐ Overview    Broker Core is Protocol Agnos6c     Protocols are Plugins  •  STOMP 1.0/1.1  •  MQTT v3.1  •  Openwire    Transports are Pluggable too.  •  TCP, WebSockets etc.    Protocol detec6on (all protocols can use 1 port)  A Progress So3ware Company  14  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 15. Feature: Mul6ple Transports    TCP    SSL     WebSockets    Secure WebSockets    UDP  A Progress So3ware Company  15  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 16. Stomp ‐ basics    hNp://stomp.github.com/    Simple Text Orientated Messaging Protocol    HTTP for the messaging realm    Very simple, so it s easy to write clients and servers in prac6cally  any language    A lot of exis6ng clients in C, Ruby, Pyhton, JS, PHP, etc.    Provides a way to connect different plamorms in asynchronous way    Also Implemented by Ac6veMQ, RabbitMQ, HornetQ, and many  others.  A Progress So3ware Company  16  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 17. Stomp ‐ Nutshell    Based on text frames, similar to  HTTP ones  MESSAGE subscription:0   Can transport binary bodies  message-id:007   Frame command for every  destination:/queue/a content-type:text/plain messaging concept, like CONNECT,  MESSAGE, SUBSCRIBE, ACK, etc.  hello queue a^@   New in version 1.1  •  Protocol nego6a6on  •  Heartbeats  •  NACK  •  Virtual hosts  A Progress So3ware Company  17  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 18. Apollo and Stomp    Both 1.0 and 1.1 Supported  SEND   Des6na6on Types  destination:/queue/a •  Queues ‐ /queue/a  receipt:001 •  Topics ‐ /topic/b persistent: true •  Durable Subscrip6ons ‐ /dsub/c  hello queue a ^@   Reliable messaging  RECEIPT receipt-id:001 ^@ A Progress So3ware Company  18  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 19. Apollo and Stomp    More messaging features  •  Message expira6on  •  Topic retained messages  •  Topic durable subscrip6ons  •  Queue browsing  •  Queue message sequences  •  Exclusive subscrip6ons  •  Temporary des6na6ons  •  Des6na6on wildcards  •  Composite des6na6ons  •  Message selectors  A Progress So3ware Company  19  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 20. Connec6vity ‐ MQTT    Get at hNps://github.com/fusesource/fuse‐extra/    Focused on:  •  low bandwidth networks  •  unreliable networks  •   Small footprint / Embedded Devices    3 QoS Op6ons    Also Implemented by   WebsphereMQ,   MosquiNo and   others.    A Progress So3ware Company  20  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 21. Connec6vity – JMS API    StompJMS is a JMS 1.1 client implemented using the STOMP  protocol.    Get it at hNps://github.com/fusesource/stompjms    Client implemented with HawtDispatch  •  Constant number of threads no maNer how many client connec6ons are  established.  import org.fusesource.stomp.jms.*;import javax.jms.*; StompJmsConnectionFactory factory = new StompJmsConnectionFactory();factory.setBrokerURI("tcp://localhost: 61613 ); Connection connection = factory.createConnection( admin , password ); Destination example = new StompJmsDestination( /queue/example ); A Progress So3ware Company  21  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 22. Connec6vity – OpenWire    OpenWire is the na6ve binary protocol implemented by Ac6veMQ    API op6ons:   •  JMS 1.1 Client of Ac6veMQ 5.x  •  NMS Client for C# Apps  •  CMS Client for C++ Apps    Working Features  •  Queues, Topics, Durable Subscrip6ons  •  Temporary Des6na6ons  •  Transac6ons    Not Yet Supported  •  XA Transac6ons (distributed transac6ons)  •  Network of Brokers style clustering  •  0 sized consumer prefetches  A Progress So3ware Company  22  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 23. LevelDB Store  A Progress So3ware Company  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.   FuseSource Confiden6al  A Progress So3ware Company  23 
  • 24. Message Store ‐ overview    Message Stores are Plugins    Ships with 2 Op6ons  •  LevelDB Store  •  BDB Store    Used to store  •  persistent messages  •  non‐persistent messages that needs to be swapped out of memory    Non‐persistent messages that get swapped out do not get dropped  on restart    Delayed Writes  A Progress So3ware Company  24  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 25. LevelDB ‐ Basics    What is LevelDB  •  LevelDB is a fast key‐value storage library   •  WriNen at Google   •  Provides an ordered mapping from string keys to string values  •  Based on SSTable and Log Structured Merge (LSM) Trees  A Progress So3ware Company  25  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 26. LevelDB ‐ Basics    Designed to efficiently store large numbers of key‐value pairs while  op6mizing for high throughput, sequen6al read/write workloads    Ideal for implemen6ng message store index    Much beNer performance over tradi6onal B‐Tree indexes (used in  KahaDB)  A Progress So3ware Company  26  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 27. LevelDB ‐ Basics    It s a C++ library (no client‐server support)    Batching writes    Forward and backward itera6on over data    Uses Snappy compression  A Progress So3ware Company  27  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 28. LevelDB Store    Uses LevelDB to maintain indexes into log files holding the  messages    Uses a JNI driver on Linux and OS X, but falls back to a pure Java  version on other plamorms    Supports replica6on to get High Availability    Default store in Apollo. Available in Apache Ac6veMQ 5.6.0  A Progress So3ware Company  28  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 29. LevelDB vs KahaDB    It maintains fewer index entries per message than KahaDB which  means it has a higher persistent throughput.    Faster recovery when a broker restarts    LevelDB based index provide a much beNer performance than the  B‐Tree for sequen6al access    LevelDB indexes support concurrent read access    Pauseless data log file garbage collec6on cycles  A Progress So3ware Company  29  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 30. LevelDB vs KahaDB    Uses fewer read IO opera6ons to load stored messages.    It will only journal the payload of the message once    Exposes it's status via JMX for monitoring    Supports replica6on to get High Availability  A Progress So3ware Company  30  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 31. LevelDB store ‐ HA    HA version of store works with Hadoop based file systems    Message log is mirrored to HDFS    It can sync on HDFS file instead of local file system    LevelDB indexes are immutable on disk (SSTables)    On checkpoint .sst files are uploaded to HDFS  A Progress So3ware Company  31  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 32. LevelDB store ‐ HA Recovery    On master failure, slave will download   •  message log  •  .sst files associated with the latest uploaded index    Con6nue with regular recovery process  A Progress So3ware Company  32  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 33. LevelDB store – HA locking    Master elec6on is done externally    Mul6ple brokers should never use the same HDFS path    Apache ZooKeeper good op6on for implemen6ng distributed  locking    FuseFabric (hNp://fuse.fusesource.org/fabric/) can be used as well  A Progress So3ware Company  33  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 34. BDB store   Not ASL 2.0!  You have to Agree to the BDB  license & download from Oracle.   Pure Java implementa6on   Very robust   The BDB library supports advanced features like  replica6on (not yet exploited)  A Progress So3ware Company  34  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 35. Features  A Progress So3ware Company  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.   FuseSource Confiden6al  A Progress So3ware Company  35 
  • 37. Feature: Authoriza6on rules   Fine grained control of who can  • admin, monitor, configure, connect, create, destroy,   • send, receive, consume   On broker resources like:  • broker, connector, virtual host, topic, queue or  durable subscrip6ons  <access_rule allow="bartenders" action="send,consume kind= queue topic id= BAR.* /> <access_rule deny="guests" action="consume"/>   A Progress So3ware Company  37  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 38. Feature: Config Updates   All Configura6on files are watch and changes are applied at  run6me:  • Broker config: etc/apollo.xml  • JAAS config files like: etc/user.proper6es  • Logging config: etc/log4j.proper6es   No need to restart to apply config changes  A Progress So3ware Company  38  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 39. Feature: Config Updates   All Configura6on files are watch and changes are applied at  run6me:  • Broker config: etc/apollo.xml  • JAAS config files like: etc/user.proper6es  • Logging config: etc/log4j.proper6es   No need to restart to apply config changes  A Progress So3ware Company  39  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 40. Feature: REST Management  curl -u "admin:password" 
 http://localhost:61680/broker/virtual-hosts/default.json   A Progress So3ware Company  40  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 41. Where is it going?  A Progress So3ware Company  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.   FuseSource Confiden6al  A Progress So3ware Company  41 
  • 42. Where has it been?  A Progress So3ware Company  42  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 43. Feature diff vs Ac6veMQ  Missing in Apollo  Only in Apollo   Networks of Brokers   REST Management API   Priority Support   Secure WebSockets   Message Groups   Message Sequences   Message Scheduling   Con6nuous Queue   XA Transac6ons  Browsing    JMX Management API   Run6me Config Updates     Per Consumer Store  Prefetch       A Progress So3ware Company  43  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 44. Future    Start integra6ng it in Ac6veMQ   •  Apollo should be a new broker engine for 6.0  •  We should try to port all exis6ng features (networks, priority queues, XA, etc.)    Tons of interes6ng work ahead of us ‐ Join us  A Progress So3ware Company  44  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.  
  • 45. Ques6ons?    Links:  •  Apache Apollo hNp://ac6vemq.apache.org/apollo/  •  STOMP Benchmarks hNp://hiramchirino.com/stomp‐benchmark/  •  MQTT Protocol Plugin for Apollo hNps://github.com/fusesource/fuse‐extra  •  HawtDispatch hNp://hawtdispatch.fusesource.org/  •  StompJMS hNps://github.com/fusesource/stompjms    Blog:  hNp://www.nighNale.net    TwiNer:   •  hNp://twiNer.com/dejanb  •  hNp://twiNer.com/fusenews  A Progress So3ware Company  45  Copyright © 2011  Progress So3ware Corpora6on and/or its subsidiaries or affiliates. All rights reserved.