After a short presentation of Message Oriented Middleware history and the birth of ZeroMQ in reaction to AMQP drift, these slides show how ZeroMQ and Scala can be used, either with a direct binding or trought an Akka layer, to make events propagate beyound the boundaries of a JVM system.
The final example
5. MOM : Grail of IT integration
▣
Message Oriented Middleware (and
Architecture)
■
5
Grails of IT integration
6. ZeroMQ : history and presentation
▣
In the '90s, messaging middlewares :
▣
Banks / trading places:
■
Need for hight speed Events interchange queues and EAI
■
2003 : Advanced Message Queuing Protocol
« Toward a commodity (message oriented) middleware »
□
□
Queuing
□
Routing (including point-to-point and publish-and-subscribe),
□
Reliability
□
6
Message orientation
Security.
7. From AMQP to Nano
▣
AMQP version 1.0 : October 2011 (!!!)
▣
AMQP : Oasis Standard : October 2012
■
▣
RabbitMQ still refuses to implements v1.0
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.
▣
2012: iMatix, founder of the ZeroMQ project and starts
Crossroads.io
■
▣
7
But it's dead because...
2013: Martin Sustrik, original author of ZeroMQ and
Crossroads.io, leaves to build Nano...
8. From AMQP to Nano
▣
AMQP version 1.0 : October 2011 (!!!)
▣
AMQP : Oasis Standard : October 2012
■
▣
RabbitMQ still refuses to implements v1.0
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.
▣
2012: iMatix, founder of the ZeroMQ project and starts
Crossroads.io
■
▣
8
But it's dead because...
2013: Martin Sustrik, original author of ZeroMQ and
Crossroads.io, leaves to build Nano...
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/
9
11. ZeroMQ sockets
▣
« It's sockets on steroids. It's like mailboxes with routing. It's fast! »
▣
ZeroMQ patterns (and sockets) :
■
Request-Reply
□
□
■
Connects a set of clients to a set of services.
This is a remote procedure call and task distribution pattern.
Pub-Sub
□
□
■
Connects a set of publishers to a set of subscribers.
This is a data distribution pattern.
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.
Exclusive pair
□
□
This is a pattern for connecting two threads in a process
□
11
Connects two sockets exclusively.
Not to be confused with "normal" pairs of sockets.
12. ZeroMQ sockets
▣
« It's sockets on steroids. It's like mailboxes with routing. It's fast! »
▣
ZeroMQ patterns (and sockets) :
■
Request-Reply
□
□
■
Connects a set of clients to a set of services.
This is a remote procedure call and task distribution pattern.
Pub-Sub
□
□
■
Connects a set of publishers to a set of subscribers.
This is a data distribution pattern.
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.
Exclusive pair
□
□
This is a pattern for connecting two threads in a process
□
12
Connects two sockets exclusively.
Not to be confused with "normal" pairs of sockets.
14. Scala and ZeroMQ
▣
C-Scala native binding
■
■
Uses JNA
■
▣
http://zeromq.org/bindings:scala-binding
Only supports libzmq v2.1
Akka integration
■
■
http://doc.akka.io/docs/akka/2.2.0/scala/zeromq.html
■
14
Akka-zeromq module
Documentation and examples are sparse
15. Scala and ZeroMQ - remarks
▣
I'm still believing AKKA is Scala killer-app
■
■
▣
▣
(if such a thing exists / is needed)
It went a looooooooong way since my last try 3 years ago
I'm believing ZeroMQ (or a successor) will be in
all IT infrastructures soon
I'm still HATING AKKA untyped model
■
■
Next time, I'm going to try Typed Actor / Channel
■
15
I want to be able to define SYSTEMS with BOUNDARIES
Or perhaps Clojure core.typed + core.async
27. Ask pattern with ZeroMQ
AKKA "ASK" Pattern build on top of ZeroMQ
■
Integrate non-JVM elements in your AKKA system
8/ Answer
Actor
ZmqClient
Actor
MessageCollector
1/ ASK
4/ Server get message
Server
2/ Send message
to ZMQ socket
ZMQ Socket
Actor (Req)
3/ Get query by
ZMQ socket
ZMQ Socket
(Rep)
5/ Server response
27
7/ Get response by
ZMQ socket
Outside the JVM
Into the wild
▣
6/ Send response
to ZMQ socket