SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
Message Brokers and
      Python
Python Ireland Meetup - Jun/2012



                            Fernando Ciciliati
                          ciciliati@gmail.com
Contents
    What sort of problems are we trying to solve?
    Messaging concepts
    A solution based on ActiveMQ
    ActiveMQ + Python: STOMP and Stomp.py
    ActiveMQ Queues and Topics
    Other ActiveMQ concepts
    Alternatives to ActiveMQ
        AMQP
        RabbitMQ
        ZeroMQ
        Others
Problems
   Time decoupling
   Scalability / Architecture flexibility
   Technology mix
Concepts
   Producer
   Consumer
   Message
     Control x Data x Hybrid
     Small x Large
     Durability

   Queue
   Message Broker
Apache ActiveMQ
               Disclaimer: Each broker has its own view of the world!

    Apache Project
    Written in Java
    Designed for high performance
    Flexible storage layer
    Multiple communication protocols
    Clustering capabilities
    Very active community -> constant evolution ->
    ... bugs
Apache ActiveMQ
   Web console on port 8161
      let's have a look at it...

   STOMP is not enabled by default
   Configuration: activemq.xml
   Running? Check it with netstat -ltn
ActiveMQ and Python
   Easiest way (IMHO): STOMP
   Libraries
      stomp.py
      stompy
      twisted + stomper/stompest
   Our choice
      stomp.py
STOMP
   Simple (or Streaming) Text Orientated Messaging Protocol.
   in-band (like HTTP or SMTP)
   Headers + body
   Text, not binary
   Simple
       Let's telnet...
stomp.py
   Created by Jason Briggs
   Currently at version 3.x
   Supports Python 2 and Python 3
   Has a CLI !
    let's have a look at it...
More ActiveMQ
   Persistence
   Producer: Receipt
   Consumer: Ack/NoAck
   Exclusive Consumers
   Selectors
   Queues X Topics
   Prefetch
A simple Python producer
   def sendJMS(message, host, queue, port=61613, user='', password='', persistent=True):
       # Size of a buffer for storing MQServer STOMP answers to commands.
       bufsize = 200

      # Establish a TCP connection
      t = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      t.connect ((host, port))

      # Establish a STOMP connection
      frame = 'CONNECTnnx00'
      t.sendall(frame)
      resp = t.recv(bufsize)
      if resp[0:9] != 'CONNECTED':
          print ('sendJMS: Failed to connect to MQ server')
          return 1

      # Send the message
      if persistent:
          persist="true"
      else:
          persist="false"
      frame = 'SENDndestination:%snpersistent:%snn%sx00' % (queue,persist,message)
      t.sendall(frame)

      # Disconnect STOMP
      frame = 'DISCONNECTnnx00'
      t.sendall(frame)

      # Disconnect TCP
      t.close()
      del(t)
      return 0
A simple stomp.py producer
   import time
   import sys

   import stomp

   USAGE = """

      producer.py <destination> <message>

         <destination> should start by /queue or /topic
         <message> is the text to be sent as message body (blank spaces accepted).

   """

   if len(sys.argv) < 3:
       print USAGE
   else:
       conn = stomp.Connection() # with default parameters
       conn.start()
       conn.connect()
       conn.send(' '.join(sys.argv[2:]), destination=sys.argv[1])
       time.sleep(2)
       conn.disconnect()
A simple stomp.py consumer
   import sys
   import time
   import stomp

   class MyListener(object):
       def on_error(self, headers, message):
           print '*** received an error:n%sn***' % message

      def on_message(self, headers, message):
          print '*** received a message:n%sn***' % message


   conn = stomp.Connection()
   conn.set_listener('', MyListener())
   conn.start()
   conn.connect()

   conn.subscribe(destination=sys.argv[1], ack='auto')

   try:
       while True:
            time.sleep(1)
   except KeyboardInterrupt:
       pass
   finally:
       print "nDisconnecting..."
       conn.disconnect()
AMQP
   """
   OUR VISION:

         To become the standard protocol for
         interoperability between all messaging
         middleware
   """

   OASIS working group
RabbitMQ
   Message broker written in Erlang
   Supports AMQP
   Concepts:
     Producers
       Messages
          Exchanges
             Queues
               Consumers
ZeroMQ
  A "brokerless" approach to messaging

  "The Intelligent Transport Layer"
  ØMQ zeromq:
   Ø  The socket library that acts as a concurrency framework.
   Ø  Faster than TCP, for clustered products and supercomputing.
   Ø  Carries messages across inproc, IPC, TCP, and multicast.
   Ø  Connect N-to-N via fanout, pubsub, pipeline, request-reply.
   Ø  Asynch I/O for scalable multicore message-passing apps.
   Ø  Large and active open source community.
   Ø  30+ languages including C, C++, Java, .NET, Python.
   Ø  Most OSes including Linux, Windows, OS X.
   Ø  LGPL free software with full commercial support from iMatix.
  (text from http://www.zeromq.org)
Even more questions?
   :)

   Thanks!

Mais conteúdo relacionado

Mais procurados

ZeroMQ: Super Sockets - by J2 Labs
ZeroMQ: Super Sockets - by J2 LabsZeroMQ: Super Sockets - by J2 Labs
ZeroMQ: Super Sockets - by J2 LabsJames Dennis
 
Zeromq anatomy & jeromq
Zeromq anatomy & jeromqZeromq anatomy & jeromq
Zeromq anatomy & jeromqDongmin Yu
 
sshuttle VPN (2011-04)
sshuttle VPN (2011-04)sshuttle VPN (2011-04)
sshuttle VPN (2011-04)apenwarr
 
Introduction to ZeroMQ - eSpace TechTalk
Introduction to ZeroMQ - eSpace TechTalkIntroduction to ZeroMQ - eSpace TechTalk
Introduction to ZeroMQ - eSpace TechTalkMahmoud Said
 
Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...Jaap ter Woerds
 
GopherFest 2017 - Adding Context to NATS
GopherFest 2017 -  Adding Context to NATSGopherFest 2017 -  Adding Context to NATS
GopherFest 2017 - Adding Context to NATSwallyqs
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Eveguest91855c
 
OSMC 2018 | Handling messages and notifications from software and gadgets wit...
OSMC 2018 | Handling messages and notifications from software and gadgets wit...OSMC 2018 | Handling messages and notifications from software and gadgets wit...
OSMC 2018 | Handling messages and notifications from software and gadgets wit...NETWAYS
 
Netty: asynchronous data transfer
Netty: asynchronous data transferNetty: asynchronous data transfer
Netty: asynchronous data transferVictor Cherkassky
 
Python session.11 By Shanmugam
Python session.11 By ShanmugamPython session.11 By Shanmugam
Python session.11 By ShanmugamNavaneethan Naveen
 
Asynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with NettyAsynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with NettyErsin Er
 
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet Mens
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet MensOSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet Mens
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet MensNETWAYS
 

Mais procurados (20)

zeromq
zeromqzeromq
zeromq
 
ZeroMQ
ZeroMQZeroMQ
ZeroMQ
 
ZeroMQ: Super Sockets - by J2 Labs
ZeroMQ: Super Sockets - by J2 LabsZeroMQ: Super Sockets - by J2 Labs
ZeroMQ: Super Sockets - by J2 Labs
 
Zeromq anatomy & jeromq
Zeromq anatomy & jeromqZeromq anatomy & jeromq
Zeromq anatomy & jeromq
 
sshuttle VPN (2011-04)
sshuttle VPN (2011-04)sshuttle VPN (2011-04)
sshuttle VPN (2011-04)
 
Introduction to ZeroMQ - eSpace TechTalk
Introduction to ZeroMQ - eSpace TechTalkIntroduction to ZeroMQ - eSpace TechTalk
Introduction to ZeroMQ - eSpace TechTalk
 
Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...Building scalable network applications with Netty (as presented on NLJUG JFal...
Building scalable network applications with Netty (as presented on NLJUG JFal...
 
GopherFest 2017 - Adding Context to NATS
GopherFest 2017 -  Adding Context to NATSGopherFest 2017 -  Adding Context to NATS
GopherFest 2017 - Adding Context to NATS
 
#2 (UDP)
#2 (UDP)#2 (UDP)
#2 (UDP)
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Eve
 
Building Netty Servers
Building Netty ServersBuilding Netty Servers
Building Netty Servers
 
OSMC 2018 | Handling messages and notifications from software and gadgets wit...
OSMC 2018 | Handling messages and notifications from software and gadgets wit...OSMC 2018 | Handling messages and notifications from software and gadgets wit...
OSMC 2018 | Handling messages and notifications from software and gadgets wit...
 
Netty: asynchronous data transfer
Netty: asynchronous data transferNetty: asynchronous data transfer
Netty: asynchronous data transfer
 
Python session.11 By Shanmugam
Python session.11 By ShanmugamPython session.11 By Shanmugam
Python session.11 By Shanmugam
 
Kickstart Kotlin
Kickstart KotlinKickstart Kotlin
Kickstart Kotlin
 
libpcap
libpcaplibpcap
libpcap
 
Asynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with NettyAsynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with Netty
 
Apachecon Eu 2008 Mina
Apachecon Eu 2008 MinaApachecon Eu 2008 Mina
Apachecon Eu 2008 Mina
 
Java Course Day 11
Java Course Day 11Java Course Day 11
Java Course Day 11
 
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet Mens
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet MensOSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet Mens
OSMC 2014: MQTT for monitoring (and for the lo t) | Jan-Piet Mens
 

Semelhante a Python Message Brokers and Messaging Concepts

Js remote conf
Js remote confJs remote conf
Js remote confBart Wood
 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageDamien Dallimore
 
Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Anil Madhavapeddy
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQICS
 
UCX-Python - A Flexible Communication Library for Python Applications
UCX-Python - A Flexible Communication Library for Python ApplicationsUCX-Python - A Flexible Communication Library for Python Applications
UCX-Python - A Flexible Communication Library for Python ApplicationsMatthew Rocklin
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Evel xf
 
Porting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustPorting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustEvan Chan
 
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Jakub Botwicz
 
import rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Pythonimport rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Pythongroveronline
 
Inter-Process/Task Communication With Message Queues
Inter-Process/Task Communication With Message QueuesInter-Process/Task Communication With Message Queues
Inter-Process/Task Communication With Message Queueswamcvey
 
quickguide-einnovator-3-rabbitmq
quickguide-einnovator-3-rabbitmqquickguide-einnovator-3-rabbitmq
quickguide-einnovator-3-rabbitmqjorgesimao71
 
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Emery Berger
 
Ngrep commands
Ngrep commandsNgrep commands
Ngrep commandsRishu Seth
 
MQTT enabling the smallest things
MQTT enabling the smallest thingsMQTT enabling the smallest things
MQTT enabling the smallest thingsIan Craggs
 
Introducing MQTT
Introducing MQTTIntroducing MQTT
Introducing MQTTAndy Piper
 

Semelhante a Python Message Brokers and Messaging Concepts (20)

Js remote conf
Js remote confJs remote conf
Js remote conf
 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
 
Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
 
UCX-Python - A Flexible Communication Library for Python Applications
UCX-Python - A Flexible Communication Library for Python ApplicationsUCX-Python - A Flexible Communication Library for Python Applications
UCX-Python - A Flexible Communication Library for Python Applications
 
mpi4py.pdf
mpi4py.pdfmpi4py.pdf
mpi4py.pdf
 
Stackless Python In Eve
Stackless Python In EveStackless Python In Eve
Stackless Python In Eve
 
ZeroMQ with NodeJS
ZeroMQ with NodeJSZeroMQ with NodeJS
ZeroMQ with NodeJS
 
Porting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to RustPorting a Streaming Pipeline from Scala to Rust
Porting a Streaming Pipeline from Scala to Rust
 
0mq
0mq0mq
0mq
 
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
 
import rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Pythonimport rdma: zero-copy networking with RDMA and Python
import rdma: zero-copy networking with RDMA and Python
 
Inter-Process/Task Communication With Message Queues
Inter-Process/Task Communication With Message QueuesInter-Process/Task Communication With Message Queues
Inter-Process/Task Communication With Message Queues
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
quickguide-einnovator-3-rabbitmq
quickguide-einnovator-3-rabbitmqquickguide-einnovator-3-rabbitmq
quickguide-einnovator-3-rabbitmq
 
Python networking
Python networkingPython networking
Python networking
 
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
Exploiting Multicore CPUs Now: Scalability and Reliability for Off-the-shelf ...
 
Ngrep commands
Ngrep commandsNgrep commands
Ngrep commands
 
MQTT enabling the smallest things
MQTT enabling the smallest thingsMQTT enabling the smallest things
MQTT enabling the smallest things
 
Introducing MQTT
Introducing MQTTIntroducing MQTT
Introducing MQTT
 

Mais de Python Ireland

Python Ireland - Who, how, what
Python Ireland - Who, how, whatPython Ireland - Who, how, what
Python Ireland - Who, how, whatPython Ireland
 
Object Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in PythonObject Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in PythonPython Ireland
 
What's the Scoop with Python 3?
What's the Scoop with Python 3?What's the Scoop with Python 3?
What's the Scoop with Python 3?Python Ireland
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Python Ireland
 
Introduction to Erlang for Python Programmers
Introduction to Erlang for Python ProgrammersIntroduction to Erlang for Python Programmers
Introduction to Erlang for Python ProgrammersPython Ireland
 
Web-service based Mobile Geospatial Application Development using Python
Web-service based Mobile Geospatial Application Development using PythonWeb-service based Mobile Geospatial Application Development using Python
Web-service based Mobile Geospatial Application Development using PythonPython Ireland
 
Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+Python Ireland
 
The Larch - a visual interactive programming environment
The Larch - a visual interactive programming environmentThe Larch - a visual interactive programming environment
The Larch - a visual interactive programming environmentPython Ireland
 
Python vs JLizard.... a python logging experience
Python vs JLizard.... a python logging experiencePython vs JLizard.... a python logging experience
Python vs JLizard.... a python logging experiencePython Ireland
 
Python Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - AppenginePython Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - AppenginePython Ireland
 
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...Python Ireland
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland
 
Python Ireland Nov 2010 - RESTing with Django
Python Ireland Nov 2010 - RESTing with DjangoPython Ireland Nov 2010 - RESTing with Django
Python Ireland Nov 2010 - RESTing with DjangoPython Ireland
 
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to PythonPython Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to PythonPython Ireland
 
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland Dec Talks - Windows Azure -- The Nuts and BoltsPython Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland Dec Talks - Windows Azure -- The Nuts and BoltsPython Ireland
 
Python for cloud computing
Python for cloud computingPython for cloud computing
Python for cloud computingPython Ireland
 
IPython: The awesome python shell
IPython: The awesome python shellIPython: The awesome python shell
IPython: The awesome python shellPython Ireland
 

Mais de Python Ireland (20)

Async I/O in Python
Async I/O in PythonAsync I/O in Python
Async I/O in Python
 
Python Ireland - Who, how, what
Python Ireland - Who, how, whatPython Ireland - Who, how, what
Python Ireland - Who, how, what
 
Object Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in PythonObject Orientation vs. Functional Programming in Python
Object Orientation vs. Functional Programming in Python
 
What's the Scoop with Python 3?
What's the Scoop with Python 3?What's the Scoop with Python 3?
What's the Scoop with Python 3?
 
Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)
 
Introduction to Erlang for Python Programmers
Introduction to Erlang for Python ProgrammersIntroduction to Erlang for Python Programmers
Introduction to Erlang for Python Programmers
 
Web-service based Mobile Geospatial Application Development using Python
Web-service based Mobile Geospatial Application Development using PythonWeb-service based Mobile Geospatial Application Development using Python
Web-service based Mobile Geospatial Application Development using Python
 
Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+Utopia Kingdoms scaling case. From 4 users to 50.000+
Utopia Kingdoms scaling case. From 4 users to 50.000+
 
The Larch - a visual interactive programming environment
The Larch - a visual interactive programming environmentThe Larch - a visual interactive programming environment
The Larch - a visual interactive programming environment
 
Python vs JLizard.... a python logging experience
Python vs JLizard.... a python logging experiencePython vs JLizard.... a python logging experience
Python vs JLizard.... a python logging experience
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
 
Python Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - AppenginePython Ireland Nov 2009 Talk - Appengine
Python Ireland Nov 2009 Talk - Appengine
 
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit Testing
 
Python Ireland Nov 2010 - RESTing with Django
Python Ireland Nov 2010 - RESTing with DjangoPython Ireland Nov 2010 - RESTing with Django
Python Ireland Nov 2010 - RESTing with Django
 
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to PythonPython Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to Python
 
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland Dec Talks - Windows Azure -- The Nuts and BoltsPython Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
 
Lambada
LambadaLambada
Lambada
 
Python for cloud computing
Python for cloud computingPython for cloud computing
Python for cloud computing
 
IPython: The awesome python shell
IPython: The awesome python shellIPython: The awesome python shell
IPython: The awesome python shell
 

Último

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Último (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

Python Message Brokers and Messaging Concepts

  • 1. Message Brokers and Python Python Ireland Meetup - Jun/2012 Fernando Ciciliati ciciliati@gmail.com
  • 2. Contents What sort of problems are we trying to solve? Messaging concepts A solution based on ActiveMQ ActiveMQ + Python: STOMP and Stomp.py ActiveMQ Queues and Topics Other ActiveMQ concepts Alternatives to ActiveMQ AMQP RabbitMQ ZeroMQ Others
  • 3. Problems Time decoupling Scalability / Architecture flexibility Technology mix
  • 4. Concepts Producer Consumer Message Control x Data x Hybrid Small x Large Durability Queue Message Broker
  • 5. Apache ActiveMQ Disclaimer: Each broker has its own view of the world! Apache Project Written in Java Designed for high performance Flexible storage layer Multiple communication protocols Clustering capabilities Very active community -> constant evolution -> ... bugs
  • 6. Apache ActiveMQ Web console on port 8161 let's have a look at it... STOMP is not enabled by default Configuration: activemq.xml Running? Check it with netstat -ltn
  • 7. ActiveMQ and Python Easiest way (IMHO): STOMP Libraries stomp.py stompy twisted + stomper/stompest Our choice stomp.py
  • 8. STOMP Simple (or Streaming) Text Orientated Messaging Protocol. in-band (like HTTP or SMTP) Headers + body Text, not binary Simple Let's telnet...
  • 9. stomp.py Created by Jason Briggs Currently at version 3.x Supports Python 2 and Python 3 Has a CLI ! let's have a look at it...
  • 10. More ActiveMQ Persistence Producer: Receipt Consumer: Ack/NoAck Exclusive Consumers Selectors Queues X Topics Prefetch
  • 11. A simple Python producer def sendJMS(message, host, queue, port=61613, user='', password='', persistent=True): # Size of a buffer for storing MQServer STOMP answers to commands. bufsize = 200 # Establish a TCP connection t = socket.socket(socket.AF_INET, socket.SOCK_STREAM) t.connect ((host, port)) # Establish a STOMP connection frame = 'CONNECTnnx00' t.sendall(frame) resp = t.recv(bufsize) if resp[0:9] != 'CONNECTED': print ('sendJMS: Failed to connect to MQ server') return 1 # Send the message if persistent: persist="true" else: persist="false" frame = 'SENDndestination:%snpersistent:%snn%sx00' % (queue,persist,message) t.sendall(frame) # Disconnect STOMP frame = 'DISCONNECTnnx00' t.sendall(frame) # Disconnect TCP t.close() del(t) return 0
  • 12. A simple stomp.py producer import time import sys import stomp USAGE = """ producer.py <destination> <message> <destination> should start by /queue or /topic <message> is the text to be sent as message body (blank spaces accepted). """ if len(sys.argv) < 3: print USAGE else: conn = stomp.Connection() # with default parameters conn.start() conn.connect() conn.send(' '.join(sys.argv[2:]), destination=sys.argv[1]) time.sleep(2) conn.disconnect()
  • 13. A simple stomp.py consumer import sys import time import stomp class MyListener(object): def on_error(self, headers, message): print '*** received an error:n%sn***' % message def on_message(self, headers, message): print '*** received a message:n%sn***' % message conn = stomp.Connection() conn.set_listener('', MyListener()) conn.start() conn.connect() conn.subscribe(destination=sys.argv[1], ack='auto') try: while True: time.sleep(1) except KeyboardInterrupt: pass finally: print "nDisconnecting..." conn.disconnect()
  • 14. AMQP """ OUR VISION: To become the standard protocol for interoperability between all messaging middleware """ OASIS working group
  • 15. RabbitMQ Message broker written in Erlang Supports AMQP Concepts: Producers Messages Exchanges Queues Consumers
  • 16. ZeroMQ A "brokerless" approach to messaging "The Intelligent Transport Layer" ØMQ zeromq:  Ø  The socket library that acts as a concurrency framework.  Ø  Faster than TCP, for clustered products and supercomputing.  Ø  Carries messages across inproc, IPC, TCP, and multicast.  Ø  Connect N-to-N via fanout, pubsub, pipeline, request-reply.  Ø  Asynch I/O for scalable multicore message-passing apps.  Ø  Large and active open source community.  Ø  30+ languages including C, C++, Java, .NET, Python.  Ø  Most OSes including Linux, Windows, OS X.  Ø  LGPL free software with full commercial support from iMatix. (text from http://www.zeromq.org)
  • 17. Even more questions? :) Thanks!