Scala and ZeroMQ: Events beyond the JVM

  • 1,078 views
Uploaded on

Some slides demonstrating what ZeroMQ is and how it can be used from Scala, with the native Scala-ZeroMQ binding or the Akka-zeromq module. …

Some slides demonstrating what ZeroMQ is and how it can be used from Scala, with the native Scala-ZeroMQ binding or the Akka-zeromq module.
Acually, code examples are on a GitHub repository here: https://github.com/fanf/scala_zeromq.

The presentation was given on 2013-08-21 at the Paris Scala User Group.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,078
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
27
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Normation – CC-BY-SA normation.com 1 Scala and ZeroMQ Events beyond the JVM Scala and ZeroMQ  Events beyond the JVM François ARMAND Directeur R&D - Normation far@normation.com
  • 2. Normation – CC-BY-SA normation.com 2 Qui suis-je ? Scalaist since... q mid-2006 for personnal projects q Rudder : full time Scala since mid-2009 q Projet LaFoSec : sécurité des langages fonctionnels (in French) – Scala from the point of view of IT security – 2010 paper for the Agence Nationnal de la Sécurité de SI (ANSSI) – http://www.ssi.gouv.fr/fr/anssi/publications/publications-scientifiques/autres-publicati ons/lafosec-securite-et-langages-fonctionnels.html Co-founder Lead-architect far@normation.com @fanf42 François ARMAND
  • 3. Normation – CC-BY-SA normation.com 3 De quoi va-t-on parler ? q ZeroMQ presentation q Integration with Scala q Code, code, code, code...
  • 4. Normation – CC-BY-SA normation.com 4 Scala and ZeroMQ Events beyond the JVM ZeroMQ : Ounce upon a time, the quest for the GrailMOM François ARMAND Directeur R&D - Normation far@normation.com
  • 5. Normation – CC-BY-SA normation.com 5 MOM : Grail of IT integration q Message Oriented Middleware (and Architecture) q Grails of IT integration
  • 6. Normation – CC-BY-SA normation.com 6 ZeroMQ : history and presentation q In the '90s, messaging middlewares : q Banks / trading places: q Need for hight speed Events interchange queues q 2003 : Advanced Message Queuing Protocol « Toward a commodity (message oriented) middleware » – Message orientation – Queuing – Routing (including point-to-point and publish-and-subscribe), – Reliability – Security.
  • 7. Normation – CC-BY-SA normation.com 7 From AMQP to Nano q AMQP version 1.0 : October 2011 (!!!) q AMQP : Oasis Standard : October 2012 q RabbitMQ still refuses to implements v1.0 q 2004: iMatix, initiator of the project resigned and starts ZeroMQ Hi Folks, Here at iMatix we've participated since 2004 in AMQP but today we've decided to end that. We're going to be killing support for OpenAMQ and migrating our users to ZeroMQ, which is simpler, faster, and in our view a better bet for our users. We have serious, long lived, and unaddressed concerns with the AMQP development process and today our worst predictions seem to have come true: AMQP is a game for large firms, and ignores the needs of the majority of users and vendors. For us, that means failure. q 2012: iMatix, iniator of the ZeroMQ project and starts Crossroads.io q But it's dead because... q 2013: Martin Sustrik, original author of ZeroMQ and Crossroads.io, leaves to build Nano...
  • 8. Normation – CC-BY-SA normation.com 8 From AMQP to Nano q AMQP version 1.0 : October 2011 (!!!) q AMQP : Oasis Standard : October 2012 q RabbitMQ still refuses to implements v1.0 q 2004 : iMatix, initiator of the project resigned and starts ZeroMQ Hi Folks, Here at iMatix we've participated since 2004 in AMQP but today we've decided to end that. We're going to be killing support for OpenAMQ and migrating our users to ZeroMQ, which is simpler, faster, and in our view a better bet for our users. We have serious, long lived, and unaddressed concerns with the AMQP development process and today our worst predictions seem to have come true: AMQP is a game for large firms, and ignores the needs of the majority of users and vendors. For us, that means failure. q 2012 : iMatix, iniator of the ZeroMQ project and starts crossroads.io q But that dead because... q 2013 : Martin Sustrik, original author of ZeroMQ and Crossroads.io, leaves to build Nano...
  • 9. Normation – CC-BY-SA normation.com 9 ZeroMQ Ø Not a MOM (no broker, no queues, etc)    Ø Socket library that acts as a concurrency framework.  Ø 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.  Ø 40+ languages including C, C++, Java, .NET, Python.  Ø http://zguide.zeromq.org/
  • 10. Normation – CC-BY-SA normation.com 10 Scala and ZeroMQ Events beyond the JVM Sockets for this millenium François ARMAND Directeur R&D - Normation far@normation.com
  • 11. Normation – CC-BY-SA normation.com 11 ZeroMQ sockets q « It's sockets on steroids. It's like mailboxes with routing. It's fast! » q ZeroMQ patterns (and sockets) : q Request-reply – Connects a set of clients to a set of services. – This is a remote procedure call and task distribution pattern. q Pub-sub – Connects a set of publishers to a set of subscribers. – This is a data distribution pattern. q Pipelines – Connects nodes in a fan-out/fan-in pattern that can have multiple steps and loops. – This is a parallel task distribution and collection pattern. q Exclusive pair – Connects two sockets exclusively. – This is a pattern for connecting two threads in a process – Not to be confused with "normal" pairs of sockets.
  • 12. Normation – CC-BY-SA normation.com 12 ZeroMQ sockets q « It's sockets on steroids. It's like mailboxes with routing. It's fast! » q ZeroMQ patterns (and sockets) : q Request-reply – Connects a set of clients to a set of services. – This is a remote procedure call and task distribution pattern. q Pub-sub – Connects a set of publishers to a set of subscribers. – This is a data distribution pattern. q Pipelines – Connects nodes in a fan-out/fan-in pattern that can have multiple steps and loops. – This is a parallel task distribution and collection pattern. q Exclusive pair – Connects two sockets exclusively. – This is a pattern for connecting two threads in a process – Not to be confused with "normal" pairs of sockets.
  • 13. Normation – CC-BY-SA normation.com 13 Scala and ZeroMQ Events beyond the JVM Scala and ZeroMQ François ARMAND Directeur R&D - Normation far@normation.com
  • 14. Normation – CC-BY-SA normation.com 14 Scala and ZeroMQ q C-Scala native binding q http://zeromq.org/bindings:scala-binding q Uses JNA q Only supports libzmq v2.1 q Akka integration q Akka-zeromq module q http://doc.akka.io/docs/akka/2.2.0/scala/zeromq.html q Documentation and example are sparses
  • 15. Normation – CC-BY-SA normation.com 15 Scala and ZeroMQ - remarks q I'm still believing AKKA is Scala killer-app q It went a looooooooooooooooooong way since my last try 3 years ago q I'm believing ZeroMQ will be in all IT infrastructures soon q I'm still HATING AKKA untyped model q Next time, I'm going to try Typed Actor / Channel
  • 16. Normation – CC-BY-SA normation.com 16 Scala and ZeroMQ Events beyond the JVM Pub/Sub. Young people these days have got it easy François ARMAND Directeur R&D - Normation far@normation.com
  • 17. Normation – CC-BY-SA normation.com 17 ZeroMQ sockets : Pub / Sub q Publish / Subscribes sockets q It's just work, nothing to add
  • 18. Normation – CC-BY-SA normation.com 18 ZeroMQ sockets : Pub / Sub Code ! https://github.com/fanf/scala_zeromq/tree/master/src/main/scala/psug/zeromq/pubsub
  • 19. Normation – CC-BY-SA normation.com 19 Scala and ZeroMQ Events beyond the JVM Req/Rep. Because waiting for answer is hard. François ARMAND Directeur R&D - Normation far@normation.com
  • 20. Normation – CC-BY-SA normation.com 20 ZeroMQ sockets : Req / Rep q Request / Reply sockets q Statefull request ↔ reply cycles
  • 21. Normation – CC-BY-SA normation.com 21 ZeroMQ sockets : Req / Rep Code ! https://github.com/fanf/scala_zeromq/tree/master/src/main/scala/psug/zeromq/reqrep
  • 22. Normation – CC-BY-SA normation.com 22 Scala and ZeroMQ Events beyond the JVM Questions ? François ARMAND Directeur R&D - Normation far@normation.com