SlideShare ist ein Scribd-Unternehmen logo
1 von 71
Downloaden Sie, um offline zu lesen
ØMQ @ NodeJS
ØMQ: Small Pieces for Scalable Software
Fernando D. Alonso
1. Facts about ØMQ
[ ]
Facts about ØMQ
Low level messaging library
○ It is written in C++.
○ A thin layer between application and transport
layers.
○ Message-passing using in-memory queues.
○ Concise API which talks over the ZMTP protocol.
○ Works on top of TCP, IPC, in-memory, and
PGM/EPGM communication protocols.
○ Philosophy: horizontal scalability to reduce points
of failure.
○ Network topology aware. Point to point
communication reduce latencies.
○ Communication is reduced to a few patterns, which
combined are powerful.
○ No need to have a multitenant service.
Facts about ØMQ
A broker is not mandatory
Facts about ØMQ
Messaged oriented communication
○ Messages as first-class citizen. No need to fight
with framing or buffering.
○ You can send multipart messages.
○ Messages are atomic.
○ Asynchronous messaging. A single background I/O
thread does the job for ØMQ sockets.
"A ØMQ message is a discrete unit of data passed between
applications or components of the same application. ØMQ messages
have no internal structure and from the point of view of ØMQ itself
they are considered to be opaque binary data."
Facts about ØMQ
Fast for development
○ Interchangeable transports: e.g, scaling from one
IPC server to a bunch of TCP.
○ Automatic reconnections.
○ Multicore made easy.
○ Provides zmq_poll to read BSD sockets.
○ It doesn't provide message persistence.
○ It doesn't provide data serialization.
○ It doesn't provide data compression.
○ It doesn't provide message encryption.
○ It doesn't provide security mechanisms. Not in the
next version of the ZMTP protocol !
(*) ZTMP 3.0 draft protocol: http://hintjens.com/blog:39
Facts about ØMQ
Aims for simplicity
Facts about ØMQ
Platforms & Languages
○ Bindings for 30+ languages including NodeJS, Ruby,
Python, Java, C, C++, Scala, Erlang, Perl, PHP, .NET.
○ Linux & Windows.
○ Raspberry PI.
○ Android OS.
2. Install
[ , ]
Install
On Linux from source
sudo apt-get install build-essential libtool autoconf automake uuid-dev
wget http://download.zeromq.org/zeromq-3.2.3.tar.gz
tar xvzf zeromq-3.2.3.tar.gz
./configure
make
sudo make install
sudo ldconfig
NOTES:
(*) Check http://download.zeromq.org/ for more versions.
(**) Avoid 3.0.x, 3.1.x, 3.2.0, 3.2.1 versions. They lack backwards
compatibility.
(***) Check ./configure --help for more options on build.
(****) ./configure --with-pgm
Install
On Linux using packages
Libzmq 3.2:
● Debian Sid: sudo apt-get install libzmq3-dev
Libzmq 2.2:
● Debian Wheezy, Jessie, Sid: sudo apt-get install libzmq-dev
● Debian Squeeze backport: http://packages.debian.org/squeeze-
backports/libzmq1
Install
On Mac
brew install zmq
Install
NodeJS bindings
NPM Packages:
● zmq (https://github.com/JustinTulloss/zeromq.node) [RECOMMENDED]
● zmq-stream (https://github.com/Schoonology/zmq-stream)
npm install zmq
node
> var zmq = require('zmq');
Install
Bindings in other languages
Ruby: https://github.com/chuckremes/ffi-rzmq [RECOMMENDED]
Python: https://github.com/zeromq/pyzmq
Erlang: https://github.com/zeromq/erlzmq2
Java JZMQ (uses JNI): https://github.com/zeromq/jzmq
Java JeroMQ: https://github.com/zeromq/jeromq
Scala ZeroMQ: https://github.com/mDialog/scala-zeromq
Scala ZeroMQ (official): https://github.com/valotrading/zeromq-scala-binding
...
3. Sockets
Sockets
Creation
(*) http://api.zeromq.org/3-2:zmq-socket
ØMQ C API
NodeJS ZMQ
req ZMQ_REQ
rep ZMQ_REP
dealer ZMQ_DEALER
router ZMQ_ROUTER
push ZMQ_PUSH
pull ZMQ_PULL
ØMQ C APINodeJS ZMQ
pub ZMQ_PUB
sub ZMQ_SUB
xsub ZMQ_XSUB
xpub ZMQ_XPUB
var sock = zmq.socket
("<SOCKET_TYPE>");
zmq_socket(context, <SOCKET_TYPE>);
Request
Reply
Dealer (async Request)
Router (async Reply)
Push
Pull
Publisher
Subscriber
XSubscriber
XPublisher
Sockets
Bind & Connect
sock.bind("tcp://10.0.0.1:5555",
function(err) {
..
});
sock.connect("tcp://10.0.0.1:5555");
sock.close();
(*) http://api.zeromq.org/3-2:zmq-bind
(**) http://api.zeromq.org/3-2:zmq-connect
(***) http://api.zeromq.org/3-2:zmq-close
ØMQ C API
zmq_bind(socket, "tcp://10.0.0.1:5555");
zmq_connect(socket, "tcp://10.0.0.1:
5555");
zmq_close(socket);
NodeJS ZMQ
Bind
Connect
Close
Sockets
Bind & Connect
sock.bindSync("tcp://10.0.0.1:5555");
// This line gets executed once the socket
// is binded, but it breaks on error.
NodeJS ZMQ
BindSync
Sockets
Transports
TCP
● usage: tcp://<address>:<port>
sock.bind("tcp://192.168.1.100:5555");
sock.bind("tcp://eth0:5555");
// binds to the first eth0 interface
sock.bind("tcp://*:5555");
// binds to all interfaces
(*) http://api.zeromq.org/3-2:zmq-tcp
ØMQ C API
zmq_bind(socket, "tcp://192.168.1.100:
5555");
zmq_bind(socket, "tcp://eth0:5555");
zmq_bind(socket, "tcp://*:5555");
NodeJS ZMQ
Sockets
Transports
Inter-Process Communication (IPC)
● usage: ipc://<address>
● Requires RW permissions on the specified path.
(*) http://api.zeromq.org/3-2:zmq-ipc
sock.bind("ipc:///tmp/mysocket");
ØMQ C API
zmq_bind(socket, "ipc:///tmp/mysocket");
NodeJS ZMQ
Sockets
Transports
In-process Communication (in-memory)
● usage: inproc://<address>
● Requires to bind before connect.
● Max. address name length is 256.
(*) http://api.zeromq.org/3-2:zmq-inproc
(**) Buggy on node-zmq package.
sock.bind("inproc://queue");
ØMQ C API
zmq_bind(socket, "ipc://queue");
NodeJS ZMQ
Sockets
Transports
PGM (multicast)
● usage: pgm://<address>;<multicast_address>:<port>
● Requires sudo privileges to access raw IP sockets.
● Needs ØMQ built with PGM extension (./configure --with-pgm).
(*) http://api.zeromq.org/3-2:zmq-pgm
sock.bind(
"pgm://192.168.1.100;239.192.1.1:3055"
);
ØMQ C API
zmq_bind(socket, "pgm://192.168.1.100;
239.192.1.1:3055");
NodeJS ZMQ
Sockets
Transports
Encapsulated PGM (multicast)
● usage: epgm://<address>;<multicast_address>:<port>
● Needs ØMQ built with PGM extension (./configure --with-pgm).
(*) http://api.zeromq.org/3-2:zmq-pgm
sock.bind(
"epgm://192.168.1.100;239.192.1.1:3055"
);
ØMQ C API
zmq_bind(socket, "epgm://192.168.1.100;
239.192.1.1:3055");
NodeJS ZMQ
Sockets
Send & Receive
Send
sock.send("My message");
sock.on("message", function(msg) {
console.log(msg.toString());
});
(*) http://api.zeromq.org/3-2:zmq-send
(**) http://api.zeromq.org/3-2:zmq-recv
Receive
sock.on("message", function(msg) {
console.log("Received " + msg);
});
// <msg> is a Buffer object.
Sockets
Multipart messages
ØMQ Queue
zmq_send(socket, "Como", 4, ZMQ_SNDMORE);
Messages are atomic
A ØMQ message is composed of 1 or more
message parts.
zmq_send(socket, "andas", 5, 0);
4 ComoPart 1
5 andasPart 2
ØMQ ensures that peers receive either all message parts of a message or
none at all.
The total number of message parts is unlimited except by available memory.
Sockets
Multipart messages
sock.send("First part", zmq.ZMQ_SNDMORE);
sock.send("Second part");
sock.send(["First part", "Second part"]);
Send
var r = sock.send("Como", zmq.
ZMQ_SNDMORE);
console.log(r);
Check the outgoing buffer and socket state:
running this
will output ->
> { type: 'req',
_zmq: { state: 0, onReady:
[Function] },
_outgoing: [ [ <Buffer 43 6f
6d 6f>, 2 ] ],
_shouldFlush: true,
_events: { message: [Function]
} }
Sockets
Multipart messages
sock.on("message", function(first_part, second_part) {
console.log(first_part.toString());
console.log(second_part.toString());
});
sock.on("message", function() {
for(var key in arguments) {
console.log("Part " + key + ": " + arguments[key]);
};
});
Receive
sock.on("message", function() {
var messages = Array.prototype.slice.call(arguments);
messages.forEach(function(msg) {
console.log("Part:" + msg);
});
});
Sockets
Batched messaging
ØMQ Queue
3 Msg
"ØMQ batches messages in opportunistic manner. It sends all the
messages available at the moment in one go. Latency of subsequent
messages will be improved because sending single batch to the card
is faster then sending lot of small messages."
sock.send("Part A",
zmq.ZMQ_SNDMORE);
sock.send("Msg");
sock.send("Part
B");
6 Part A
6 Part B
ØMQ Socket
send
send
send
<write busy>
<write ready>
Client Thread ØMQ I/O Thread
send
batch
<write busy>
Patterns
Plugging multiple transports
Example
var zmq = require('zmq'),
pub = zmq.socket('pub');
pub.bindSync('tcp://127.0.0.1:5555');
pub.bindSync('ipc:///tmp/zmq.sock');
setInterval(function() {
pub.send("I am polyglot!");
}, 1000);
sub = zmq.socket('sub');
sub.connect('ipc:///tmp/zmq.sock');
sub.subscribe('');
sub.on('message', function(msg) {
console.log("Received: " + msg);
});
var zmq = require('zmq'),
sub = zmq.socket(sub');
sub.connect('tcp://127.0.0.1:5555');
sub.subscribe('');
sub.on('message', function(msg) {
console.log(Received: ' + msg);
});
Sockets
Setting Socket Options
(*) http://api.zeromq.org/3-2:zmq-setsockopt
Setsockopt
● usage (NodeJS ZMQ API): sock.setsockopt(<option>, <value>);
or sock.<option> = <value>;
sock.identity = 'monitor-1';
sock.setsockopt('identity', 'monitor-1');
Identity:
// value can be any string up to 255 length.
// identity is required on sockets
// connecting to a Router.
Sockets
Setting Socket Options
Setsockopt
subscriber.subscribe('MUSIC');
subscriber.setsockopt('subscribe',
'MUSIC');
Subscribe:
// sets a message filter for subscriber sockets.
subscriber.unsubscribe('MUSIC');
susbscriber.setsockopt('subscribe',
'POP');
Unsubscribe:
// sets off a message filter for subscriber
sockets.
4. Patterns
[ ]
Patterns
Request / Reply
Synchronous task distribution
Ø REP #1
Ø REP # 2
Ø REQ
< round robin >
...
< synchronous >
Used when each message needs to be matched with a response. Handles
only one message at time. Strict send-recv cycle.
Patterns
Request / Reply
Ø REP #1 Ø REP # 2Ø REQ
send
recv (wait response)
send
recv (dont wait response)
recv (dont wait response)
Patterns
Request / Reply
Ø REP #1 Ø REP # 2Ø REQ
send
recv
recv
send
send
-> REP #1 is down
FAILURE
REQ #1 will not recover !
Patterns
Request / Reply
Basic Request / Reply
var zmq = require('zmq');
reply = zmq.socket('rep');
reply.bind('tcp://127.0.0.1:5555',
function(err) {
if (err) throw err;
}
);
reply.on('message', function(msg) {
console.log('Received: ' + msg);
reply.send('Pong!');
});
var zmq = require('zmq');
request = zmq.socket('req');
request.connect('tcp://127.0.0.1:5555');
request.send('Ping');
request.on('message', function(msg) {
console.log('Response: ' + msg);
});
Patterns
Request / Reply
Dealer socket message delivery
Messages have to be multipart, consisting on: an empty delimiter header,
followed by the content body parts.
sock.send("Body");
Outgoing Queue
0
6 Body
sock.send(new Buffer([]), zmq.
ZMQ_SNDMORE);
send
send
Patterns
Request / Reply
Dealer socket message delivery
Outgoing messages are round-robined among all connected peers.
However, sending depends on the availability of the receiver.
sock.send(
["", "Msg"]);
Outgoing Queue
3 Msg
6 Part A
Peer Socket A Peer Socket B
sock.send(
["", "Bla");
sock.send(
["", "Msg2"]);
send
send
send
To A
To B
To A
send
<write
ready>
<write
busy>
<write
ready>
0
0
4 Msg2
0
Patterns
Request / Reply
Dealer socket message delivery
Reconnections are handled automatically: messages are asynchronously
delivered. Response time does not block sending more messages.
Outgoing Queue Peer Socket A Peer Socket B
send
-> Up again
sock.send(
["", "Msg"]);
3 Msg
sock.send(
["", "Msg2"]);
send
send
To A
To A
0
4 Msg2
0
Patterns
Request / Reply
Ø REP #1 Ø REP # 2Ø DEALER
enqueue < Msg A >
send < Msg B >
-> REP #1 is down
enqueue < Msg C >
send < Msg A, Msg C >
send < Msg D >
Dealer socket handles peer reconnection automatically. It will send
messages that queued for that peer once it has established connection.
Patterns
Request / Reply
> Response from: 5001
> Response from: 5001
> Response from: 5002
> Response from: 5001
> Response from: 5001
> Response from: 5002
> ...
Dealer example
var dealer = zmq.socket('dealer');
dealer.connect('tcp://127.0.0.1:5001');
dealer.connect('tcp://127.0.0.1:5002');
setInterval(function() {
dealer.send(["", "Msg"]);
}, 1000);
dealer.on('message', function(h, msg) {
console.log('Response from: ' + msg);
});
running this
'might' output
->
Patterns
Request / Reply
Router socket messaging
Messages have to be multipart, consisting on: an identity frame, an empty
delimiter frame, followed by the content body parts. This applies to both
incoming and outgoing messages.
sock.send("Body");
Outgoing Queue
0
6 Body
sock.send("", zmq.
ZMQ_SNDMORE);
send
send
sock.send(
"worker-1", zmq.
ZMQ_SNDMORE); 8 worker-1
send
Patterns
Request / Reply
Router is asynchronous
Incoming messages are fair-queued among all connected and available
peers.
Peer Socket A Peer Socket B
ØMQ Router
Incoming Queue
Socketsend
send
send
Patterns
Request / Reply
Router is asynchronous
Receiving depends on the availability of the sender.
Peer Socket A Peer Socket B
ØMQ Router
Incoming Queue
Socketsend
send
Patterns
Push / Pull
Unidirectional data distribution
The Push / Pull pattern fits well on pipelined communication, i.e., when no
response is required for a given message.
Ø
Ø
...
ØØ
Patterns
Push / Pull
Binding the Push socket
Outgoing messages are round-robined among all connected and available
peers.
push.send("Msg");
push.send("Part
B");
Outgoing Queue Peer Socket A Peer Socket B
push.send("Part A",
zmq.ZMQ_SNDMORE);
push.send("Msg2");
3 Msg
6 Part A
6 Part B
4 Msg2
send
send
send
send
Patterns
Push / Pull
Binding the Push socket
Outgoing messages are round-robined among all connected and available
peers.
Outgoing Queue Peer Socket A Peer Socket B
-> Down3 Msg
6 Part A
6 Part B
4 Msg2
send
send
send
push.send("Msg");
push.send("Part
B");
push.send("Part A",
zmq.ZMQ_SNDMORE);
push.send("Msg2");
send
send
send
send
Patterns
Push / Pull
Binding the Push socket
Disconnections and reconnections are handled automatically.
Outgoing Queue Peer Socket A Peer Socket B
4 More
6 Part 1
6 Part 2
5 Other
send
send
send
push.send("More"); send
push.send("Part
2");
push.send("Part 1",
zmq.ZMQ_SNDMORE);
send
send
push.send("Other");
send
Patterns
Push / Pull
Parallel task distribution
Ø PULL #1
Ø PULL # 2
Ø PUSH
< round robin >
...
Patterns
Push / Pull
Passive agents / Monitor
Ø PULLØ PUSH
...
Ø PUSH
Patterns
Push / Pull
Binding the Pull socket
Push's outgoing messages are round-robined among all connected peers.
push.send("Msg");
push.send("Part
B");
Outgoing Queue Peer Socket A Peer Socket B
push.send("Part A",
zmq.ZMQ_SNDMORE);
push.send("Msg2");
send
send
send
send
3 Msg
6 Part A
6 Part B
4 Msg2
To A
To B
To A
Patterns
Push / Pull
Binding the Pull socket
Push's outgoing messages are round-robined among all connected peers.
push.send("Msg");
push.send("Part
B");
Outgoing Queue Peer Socket A Peer Socket B
push.send("Part A",
zmq.ZMQ_SNDMORE);
push.send("Msg2");
send
send
send
send
send
send
send
3 Msg
6 Part A
6 Part B
4 Msg2
To A
To B
To A
Patterns
Push / Pull
Binding the Pull socket
Disconnections and reconnections are handled automatically.
Outgoing Queue Peer Socket A Peer Socket B
send
send
-> Down4 More
6 Part 1
6 Part 2
5 Other
To A
To A
To B
push.send("More"); send
push.send("Part
2");
push.send("Part 1",
zmq.ZMQ_SNDMORE);
send
send
push.send("Other");
send
Patterns
Push / Pull
Binding the Pull socket
Sending is asynchronous, it depends on the availability of the receiver.
Outgoing Queue Peer Socket A Peer Socket B
send
-> Up again
5 OtherTo B
push.send("More"); send
push.send("Part
2");
push.send("Part 1",
zmq.ZMQ_SNDMORE);
send
send
push.send("Other");
send
Patterns
Push / Pull
Ø PULLØ PUSH #1
...
Ø PUSH #2
Active agents / collector pattern
Patterns
Publish / Subscribe
Broadcast data distribution
Ø SUB #1
Ø PUB #1
...
Ø SUB #2
Ø SUB #2
Message distribution
Patterns
Publish / Subscribe
sock.send("Msg");
Outgoing Queue
3 Msg
Subscriber A
Subscriber B
send
send
Outgoing messages are send to each connected and available peers.
Subscriber C
Message distribution
Patterns
Publish / Subscribe
sock.send("Msg");
Outgoing Queue
3 Msg
Subscriber A
Subscriber B
send
send
Outgoing messages are send to each connected and available peers.
Subscriber C
5 Othersock.send("Other");
send
Subscribers can register to a specific topic.
Data filtering
Patterns
Publish / Subscribe
ØMQ Publisher
Subscriber A
Subscriber B
Subscriber C
Outgoing Queue
subscribe AR
subscribe VE
Socket
subscribe VE
Subscribers can register to a specific topic.
Data filtering
Patterns
Publish / Subscribe
ØMQ Publisher
Subscriber A
Subscriber B
Subscriber C
Outgoing Queue
subscribe AR
subscribe VE
Socket
subscribe VE
sock.send("AR
news");
send
7 AR news
send
Subscribers can register to a specific topic.
Data filtering
Patterns
Publish / Subscribe
ØMQ Publisher
Subscriber A
Subscriber B
Subscriber C
Outgoing Queue
subscribe AR
subscribe VE
Socket
subscribe VE
sock.send("VE
news");
send
7 VE news
sendsend
Patterns
Publish / Subscribe
Data filtering example
pub = zmq.socket('pub');
pub.bindSync("tcp://10.0.0.12:3055");
count = 0
setInterval(function() {
pub.send("TEST " + count++);
}, 1000);
sub = zmq.socket('sub');
sub.connect("tcp://10.0.0.12:3055");
sub.subscribe("TEST");
sub.on("message", function(msg) {
console.log("Received: " + msg);
});
// older messages won't be
// received
> TEST 6
> TEST 7
> TEST 8
> TEST 9
> TEST 10
running this
'might'
output ->
Patterns
Publish / Subscribe
Multicast example
var zmq = require('zmq'),
pub = zmq.socket('pub');
pub.bind(
"epgm://10.0.0.12;239.192.1.1:3055",
function(err) {
if(err) throw err;
}
)
setInterval(function() {
pub.send("From pid: " + process.pid);
}, 1000);
var zmq = require('zmq'),
sub = zmq.socket('sub');
sub.connect(
"epgm://10.0.0.13;239.192.1.1:3055"
);
sub.subscribe("");
sub.on('message', function(msg) {
console.log("Received " + msg);
});
(*) See running demo at http://youtu.be/NQrH0SATPk0
"XSUB and XPUB are exactly like SUB and PUB except they expose
subscriptions as special messages."
Data distribution proxy
Patterns
XSUB / XPUB
XSUB/XPUB Proxy
Subscriber A
Subscriber B
Subscriber C
XPUB Socket
XSUB Socket
Publisher A
Publisher B
Publisher C
subscribe
PY
forward
subscription
Messages are forwarded by the proxy to the registered subscribers.
Data distribution proxy
Patterns
XSUB / XPUB
XSUB/XPUB Proxy
Subscriber A
Subscriber B
Subscriber C
XPUB Socket
XSUB Socket
Publisher A
Publisher B
Publisher C
forward
message
send "PY<msg>"
send
5. Useful links
[ ]
Useful Links
Workshop examples
http://github.com/krakatoa/node_zmq_workshop
Useful Links
The Guide
http://zguide.zeromq.org/page:all
Useful Links
Pieter Hintjens personal blog
http://hintjens.com/
Useful Links
API References
http://api.zeromq.org/3-2:zmq-socket
http://api.zeromq.org/3-2:zmq-setsockopt
Preguntas ?
fedario@gmail.com
github.com/krakatoa
Fernando Dario Alonso
Gracias !

Weitere ähnliche Inhalte

Was ist angesagt?

Spanner移行について本気出して考えてみた
Spanner移行について本気出して考えてみたSpanner移行について本気出して考えてみた
Spanner移行について本気出して考えてみたtechgamecollege
 
Dockerと外部ルータを連携させる仕組みを作ってみた
Dockerと外部ルータを連携させる仕組みを作ってみたDockerと外部ルータを連携させる仕組みを作ってみた
Dockerと外部ルータを連携させる仕組みを作ってみたnpsg
 
CyberAgent における OSS の CI/CD 基盤開発 myshoes #CICD2021
CyberAgent における OSS の CI/CD 基盤開発 myshoes #CICD2021CyberAgent における OSS の CI/CD 基盤開発 myshoes #CICD2021
CyberAgent における OSS の CI/CD 基盤開発 myshoes #CICD2021whywaita
 
[DockerCon 2019] Hardening Docker daemon with Rootless mode
[DockerCon 2019] Hardening Docker daemon with Rootless mode[DockerCon 2019] Hardening Docker daemon with Rootless mode
[DockerCon 2019] Hardening Docker daemon with Rootless modeAkihiro Suda
 
MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法Tetsutaro Watanabe
 
Epoll - from the kernel side
Epoll -  from the kernel sideEpoll -  from the kernel side
Epoll - from the kernel sidellj098
 
ライブストリーミングの基礎知識その2
ライブストリーミングの基礎知識その2ライブストリーミングの基礎知識その2
ライブストリーミングの基礎知識その2kumaryu
 
Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidl_b__
 
関数型プログラミングのデザインパターンひとめぐり
関数型プログラミングのデザインパターンひとめぐり関数型プログラミングのデザインパターンひとめぐり
関数型プログラミングのデザインパターンひとめぐりKazuyuki TAKASE
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The AnswerIan Barber
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Akihiro Suda
 
OpenStackをさらに”使う”技術 概要と基礎操作
OpenStackをさらに”使う”技術 概要と基礎操作OpenStackをさらに”使う”技術 概要と基礎操作
OpenStackをさらに”使う”技術 概要と基礎操作irix_jp
 
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConAnatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConJérôme Petazzoni
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Kohei Tokunaga
 
[GKE & Spanner 勉強会] Cloud Spanner の技術概要
[GKE & Spanner 勉強会] Cloud Spanner の技術概要[GKE & Spanner 勉強会] Cloud Spanner の技術概要
[GKE & Spanner 勉強会] Cloud Spanner の技術概要Google Cloud Platform - Japan
 
Containerization & Docker - Under the Hood
Containerization & Docker - Under the HoodContainerization & Docker - Under the Hood
Containerization & Docker - Under the HoodImesha Sudasingha
 
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Etsuji Nakai
 
Working with Terraform on Azure
Working with Terraform on AzureWorking with Terraform on Azure
Working with Terraform on Azuretombuildsstuff
 

Was ist angesagt? (20)

Spanner移行について本気出して考えてみた
Spanner移行について本気出して考えてみたSpanner移行について本気出して考えてみた
Spanner移行について本気出して考えてみた
 
Dockerと外部ルータを連携させる仕組みを作ってみた
Dockerと外部ルータを連携させる仕組みを作ってみたDockerと外部ルータを連携させる仕組みを作ってみた
Dockerと外部ルータを連携させる仕組みを作ってみた
 
MySQL Binlog Events でストリーム処理してみた #MySQLUC15
MySQL Binlog Events でストリーム処理してみた #MySQLUC15MySQL Binlog Events でストリーム処理してみた #MySQLUC15
MySQL Binlog Events でストリーム処理してみた #MySQLUC15
 
CyberAgent における OSS の CI/CD 基盤開発 myshoes #CICD2021
CyberAgent における OSS の CI/CD 基盤開発 myshoes #CICD2021CyberAgent における OSS の CI/CD 基盤開発 myshoes #CICD2021
CyberAgent における OSS の CI/CD 基盤開発 myshoes #CICD2021
 
[DockerCon 2019] Hardening Docker daemon with Rootless mode
[DockerCon 2019] Hardening Docker daemon with Rootless mode[DockerCon 2019] Hardening Docker daemon with Rootless mode
[DockerCon 2019] Hardening Docker daemon with Rootless mode
 
MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法
 
Epoll - from the kernel side
Epoll -  from the kernel sideEpoll -  from the kernel side
Epoll - from the kernel side
 
ライブストリーミングの基礎知識その2
ライブストリーミングの基礎知識その2ライブストリーミングの基礎知識その2
ライブストリーミングの基礎知識その2
 
Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroid
 
関数型プログラミングのデザインパターンひとめぐり
関数型プログラミングのデザインパターンひとめぐり関数型プログラミングのデザインパターンひとめぐり
関数型プログラミングのデザインパターンひとめぐり
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行
 
OpenStackをさらに”使う”技術 概要と基礎操作
OpenStackをさらに”使う”技術 概要と基礎操作OpenStackをさらに”使う”技術 概要と基礎操作
OpenStackをさらに”使う”技術 概要と基礎操作
 
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxConAnatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行
 
[GKE & Spanner 勉強会] Cloud Spanner の技術概要
[GKE & Spanner 勉強会] Cloud Spanner の技術概要[GKE & Spanner 勉強会] Cloud Spanner の技術概要
[GKE & Spanner 勉強会] Cloud Spanner の技術概要
 
Containerization & Docker - Under the Hood
Containerization & Docker - Under the HoodContainerization & Docker - Under the Hood
Containerization & Docker - Under the Hood
 
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門
 
Working with Terraform on Azure
Working with Terraform on AzureWorking with Terraform on Azure
Working with Terraform on Azure
 
Concurrency With Go
Concurrency With GoConcurrency With Go
Concurrency With Go
 

Andere mochten auch

Ten Key Factors that Influence Successful Bilingualism and Multilingualism
Ten Key Factors that Influence Successful Bilingualism and MultilingualismTen Key Factors that Influence Successful Bilingualism and Multilingualism
Ten Key Factors that Influence Successful Bilingualism and MultilingualismSjoerd Heeringa
 
On-line book store presentation
On-line book store presentation On-line book store presentation
On-line book store presentation Smit Patel
 
Key Passages in Jane Eyre
Key Passages in Jane EyreKey Passages in Jane Eyre
Key Passages in Jane EyreJ Aragonite
 
4. heredity and evolution
4. heredity and evolution4. heredity and evolution
4. heredity and evolutionAbhay Goyal
 
Internet of Things (IOT) - Technology and Applications
Internet of Things (IOT) - Technology and ApplicationsInternet of Things (IOT) - Technology and Applications
Internet of Things (IOT) - Technology and ApplicationsDr. Mazlan Abbas
 
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...Probir Bidhan
 
Mathematics high school level quiz - Part I
Mathematics high school level quiz - Part IMathematics high school level quiz - Part I
Mathematics high school level quiz - Part IITfC-Edu-Team
 
61 Beautiful & Inspirational Timeline Cover on Facebook
61 Beautiful & Inspirational Timeline Cover on Facebook61 Beautiful & Inspirational Timeline Cover on Facebook
61 Beautiful & Inspirational Timeline Cover on FacebookConsonaute
 
Thai tech startup ecosystem report 2017
Thai tech startup ecosystem report 2017Thai tech startup ecosystem report 2017
Thai tech startup ecosystem report 2017Techsauce Media
 
Engaging Learners with Technology
Engaging Learners with TechnologyEngaging Learners with Technology
Engaging Learners with TechnologyDean Shareski
 
Vernacular Architecture (Case Study- H.P.)
Vernacular Architecture (Case Study- H.P.)Vernacular Architecture (Case Study- H.P.)
Vernacular Architecture (Case Study- H.P.)divya_binu
 
Principles and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at EtsyPrinciples and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at EtsyMike Brittain
 

Andere mochten auch (20)

Ten Key Factors that Influence Successful Bilingualism and Multilingualism
Ten Key Factors that Influence Successful Bilingualism and MultilingualismTen Key Factors that Influence Successful Bilingualism and Multilingualism
Ten Key Factors that Influence Successful Bilingualism and Multilingualism
 
On-line book store presentation
On-line book store presentation On-line book store presentation
On-line book store presentation
 
The Power of Color in Branding
The Power of Color in BrandingThe Power of Color in Branding
The Power of Color in Branding
 
Key Passages in Jane Eyre
Key Passages in Jane EyreKey Passages in Jane Eyre
Key Passages in Jane Eyre
 
Biofertilizer
BiofertilizerBiofertilizer
Biofertilizer
 
5000 Sat Words With Definitions
5000 Sat Words With Definitions5000 Sat Words With Definitions
5000 Sat Words With Definitions
 
4. heredity and evolution
4. heredity and evolution4. heredity and evolution
4. heredity and evolution
 
Internet of Things (IOT) - Technology and Applications
Internet of Things (IOT) - Technology and ApplicationsInternet of Things (IOT) - Technology and Applications
Internet of Things (IOT) - Technology and Applications
 
New Time Mgt
New Time MgtNew Time Mgt
New Time Mgt
 
BUSINESS QUIZ -Round 1
 BUSINESS QUIZ -Round 1 BUSINESS QUIZ -Round 1
BUSINESS QUIZ -Round 1
 
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
Environmental Impact Assessment (EIA) report on Rampal 1320MW coal-based powe...
 
Mathematics high school level quiz - Part I
Mathematics high school level quiz - Part IMathematics high school level quiz - Part I
Mathematics high school level quiz - Part I
 
61 Beautiful & Inspirational Timeline Cover on Facebook
61 Beautiful & Inspirational Timeline Cover on Facebook61 Beautiful & Inspirational Timeline Cover on Facebook
61 Beautiful & Inspirational Timeline Cover on Facebook
 
Thai tech startup ecosystem report 2017
Thai tech startup ecosystem report 2017Thai tech startup ecosystem report 2017
Thai tech startup ecosystem report 2017
 
Mri brain anatomy Dr Muhammad Bin Zulfiqar
Mri brain anatomy Dr Muhammad Bin ZulfiqarMri brain anatomy Dr Muhammad Bin Zulfiqar
Mri brain anatomy Dr Muhammad Bin Zulfiqar
 
Lean Manufacturing - Toyota Production System
Lean Manufacturing - Toyota Production SystemLean Manufacturing - Toyota Production System
Lean Manufacturing - Toyota Production System
 
Engaging Learners with Technology
Engaging Learners with TechnologyEngaging Learners with Technology
Engaging Learners with Technology
 
Vernacular Architecture (Case Study- H.P.)
Vernacular Architecture (Case Study- H.P.)Vernacular Architecture (Case Study- H.P.)
Vernacular Architecture (Case Study- H.P.)
 
Principles and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at EtsyPrinciples and Practices in Continuous Deployment at Etsy
Principles and Practices in Continuous Deployment at Etsy
 
BIOLOGICAL DIVERSITY
BIOLOGICAL DIVERSITYBIOLOGICAL DIVERSITY
BIOLOGICAL DIVERSITY
 

Ähnlich wie ZeroMQ with NodeJS

ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!Pedro Januário
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQICS
 
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
 
MQTT enabling the smallest things
MQTT enabling the smallest thingsMQTT enabling the smallest things
MQTT enabling the smallest thingsIan Craggs
 
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati Python Ireland
 
CurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious CharactersCurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious Characterspieterh
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSFernando Luiz Cola
 
Where is My Message
Where is My MessageWhere is My Message
Where is My MessageMatt Leming
 
Zmq in context of openstack
Zmq in context of openstackZmq in context of openstack
Zmq in context of openstackYatin Kumbhare
 
NUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioNUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioHajime Tazaki
 
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystemDCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystemrudndccn
 
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 FinalExploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Finalmasoodnt10
 
Attacks and their mitigations
Attacks and their mitigationsAttacks and their mitigations
Attacks and their mitigationsMukesh Chaudhari
 
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
 
Bar-BoF session about Simplemux at IETF93, Prague
Bar-BoF session about Simplemux at IETF93, PragueBar-BoF session about Simplemux at IETF93, Prague
Bar-BoF session about Simplemux at IETF93, PragueJose Saldana
 
Mom those things v1
Mom those things v1 Mom those things v1
Mom those things v1 von gosling
 
Where is my MQ message on z/OS?
Where is my MQ message on z/OS?Where is my MQ message on z/OS?
Where is my MQ message on z/OS?Matt Leming
 
øMQ Vortrag
øMQ VortragøMQ Vortrag
øMQ Vortragmirosso25
 

Ähnlich wie ZeroMQ with NodeJS (20)

ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!ZeroMQ - Sockets on steroids!
ZeroMQ - Sockets on steroids!
 
Network-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQNetwork-Connected Development with ZeroMQ
Network-Connected Development with ZeroMQ
 
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)
 
MQTT enabling the smallest things
MQTT enabling the smallest thingsMQTT enabling the smallest things
MQTT enabling the smallest things
 
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
 
CurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious CharactersCurveZMQ, ZMTP and other Dubious Characters
CurveZMQ, ZMTP and other Dubious Characters
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
 
Where is My Message
Where is My MessageWhere is My Message
Where is My Message
 
Zmq in context of openstack
Zmq in context of openstackZmq in context of openstack
Zmq in context of openstack
 
NUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osioNUSE (Network Stack in Userspace) at #osio
NUSE (Network Stack in Userspace) at #osio
 
mTCP使ってみた
mTCP使ってみたmTCP使ってみた
mTCP使ってみた
 
Tcpdump
TcpdumpTcpdump
Tcpdump
 
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystemDCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
DCCN 2016 - Tutorial 2 - 4G for SmartGrid ecosystem
 
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 FinalExploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
Exploiting Network Protocols To Exhaust Bandwidth Links 2008 Final
 
Attacks and their mitigations
Attacks and their mitigationsAttacks and their mitigations
Attacks and their mitigations
 
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)
 
Bar-BoF session about Simplemux at IETF93, Prague
Bar-BoF session about Simplemux at IETF93, PragueBar-BoF session about Simplemux at IETF93, Prague
Bar-BoF session about Simplemux at IETF93, Prague
 
Mom those things v1
Mom those things v1 Mom those things v1
Mom those things v1
 
Where is my MQ message on z/OS?
Where is my MQ message on z/OS?Where is my MQ message on z/OS?
Where is my MQ message on z/OS?
 
øMQ Vortrag
øMQ VortragøMQ Vortrag
øMQ Vortrag
 

Kürzlich hochgeladen

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Kürzlich hochgeladen (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

ZeroMQ with NodeJS

  • 1. ØMQ @ NodeJS ØMQ: Small Pieces for Scalable Software Fernando D. Alonso
  • 2. 1. Facts about ØMQ [ ]
  • 3. Facts about ØMQ Low level messaging library ○ It is written in C++. ○ A thin layer between application and transport layers. ○ Message-passing using in-memory queues. ○ Concise API which talks over the ZMTP protocol. ○ Works on top of TCP, IPC, in-memory, and PGM/EPGM communication protocols.
  • 4. ○ Philosophy: horizontal scalability to reduce points of failure. ○ Network topology aware. Point to point communication reduce latencies. ○ Communication is reduced to a few patterns, which combined are powerful. ○ No need to have a multitenant service. Facts about ØMQ A broker is not mandatory
  • 5. Facts about ØMQ Messaged oriented communication ○ Messages as first-class citizen. No need to fight with framing or buffering. ○ You can send multipart messages. ○ Messages are atomic. ○ Asynchronous messaging. A single background I/O thread does the job for ØMQ sockets. "A ØMQ message is a discrete unit of data passed between applications or components of the same application. ØMQ messages have no internal structure and from the point of view of ØMQ itself they are considered to be opaque binary data."
  • 6. Facts about ØMQ Fast for development ○ Interchangeable transports: e.g, scaling from one IPC server to a bunch of TCP. ○ Automatic reconnections. ○ Multicore made easy. ○ Provides zmq_poll to read BSD sockets.
  • 7. ○ It doesn't provide message persistence. ○ It doesn't provide data serialization. ○ It doesn't provide data compression. ○ It doesn't provide message encryption. ○ It doesn't provide security mechanisms. Not in the next version of the ZMTP protocol ! (*) ZTMP 3.0 draft protocol: http://hintjens.com/blog:39 Facts about ØMQ Aims for simplicity
  • 8. Facts about ØMQ Platforms & Languages ○ Bindings for 30+ languages including NodeJS, Ruby, Python, Java, C, C++, Scala, Erlang, Perl, PHP, .NET. ○ Linux & Windows. ○ Raspberry PI. ○ Android OS.
  • 10. Install On Linux from source sudo apt-get install build-essential libtool autoconf automake uuid-dev wget http://download.zeromq.org/zeromq-3.2.3.tar.gz tar xvzf zeromq-3.2.3.tar.gz ./configure make sudo make install sudo ldconfig NOTES: (*) Check http://download.zeromq.org/ for more versions. (**) Avoid 3.0.x, 3.1.x, 3.2.0, 3.2.1 versions. They lack backwards compatibility. (***) Check ./configure --help for more options on build. (****) ./configure --with-pgm
  • 11. Install On Linux using packages Libzmq 3.2: ● Debian Sid: sudo apt-get install libzmq3-dev Libzmq 2.2: ● Debian Wheezy, Jessie, Sid: sudo apt-get install libzmq-dev ● Debian Squeeze backport: http://packages.debian.org/squeeze- backports/libzmq1
  • 13. Install NodeJS bindings NPM Packages: ● zmq (https://github.com/JustinTulloss/zeromq.node) [RECOMMENDED] ● zmq-stream (https://github.com/Schoonology/zmq-stream) npm install zmq node > var zmq = require('zmq');
  • 14. Install Bindings in other languages Ruby: https://github.com/chuckremes/ffi-rzmq [RECOMMENDED] Python: https://github.com/zeromq/pyzmq Erlang: https://github.com/zeromq/erlzmq2 Java JZMQ (uses JNI): https://github.com/zeromq/jzmq Java JeroMQ: https://github.com/zeromq/jeromq Scala ZeroMQ: https://github.com/mDialog/scala-zeromq Scala ZeroMQ (official): https://github.com/valotrading/zeromq-scala-binding ...
  • 16. Sockets Creation (*) http://api.zeromq.org/3-2:zmq-socket ØMQ C API NodeJS ZMQ req ZMQ_REQ rep ZMQ_REP dealer ZMQ_DEALER router ZMQ_ROUTER push ZMQ_PUSH pull ZMQ_PULL ØMQ C APINodeJS ZMQ pub ZMQ_PUB sub ZMQ_SUB xsub ZMQ_XSUB xpub ZMQ_XPUB var sock = zmq.socket ("<SOCKET_TYPE>"); zmq_socket(context, <SOCKET_TYPE>); Request Reply Dealer (async Request) Router (async Reply) Push Pull Publisher Subscriber XSubscriber XPublisher
  • 17. Sockets Bind & Connect sock.bind("tcp://10.0.0.1:5555", function(err) { .. }); sock.connect("tcp://10.0.0.1:5555"); sock.close(); (*) http://api.zeromq.org/3-2:zmq-bind (**) http://api.zeromq.org/3-2:zmq-connect (***) http://api.zeromq.org/3-2:zmq-close ØMQ C API zmq_bind(socket, "tcp://10.0.0.1:5555"); zmq_connect(socket, "tcp://10.0.0.1: 5555"); zmq_close(socket); NodeJS ZMQ Bind Connect Close
  • 18. Sockets Bind & Connect sock.bindSync("tcp://10.0.0.1:5555"); // This line gets executed once the socket // is binded, but it breaks on error. NodeJS ZMQ BindSync
  • 19. Sockets Transports TCP ● usage: tcp://<address>:<port> sock.bind("tcp://192.168.1.100:5555"); sock.bind("tcp://eth0:5555"); // binds to the first eth0 interface sock.bind("tcp://*:5555"); // binds to all interfaces (*) http://api.zeromq.org/3-2:zmq-tcp ØMQ C API zmq_bind(socket, "tcp://192.168.1.100: 5555"); zmq_bind(socket, "tcp://eth0:5555"); zmq_bind(socket, "tcp://*:5555"); NodeJS ZMQ
  • 20. Sockets Transports Inter-Process Communication (IPC) ● usage: ipc://<address> ● Requires RW permissions on the specified path. (*) http://api.zeromq.org/3-2:zmq-ipc sock.bind("ipc:///tmp/mysocket"); ØMQ C API zmq_bind(socket, "ipc:///tmp/mysocket"); NodeJS ZMQ
  • 21. Sockets Transports In-process Communication (in-memory) ● usage: inproc://<address> ● Requires to bind before connect. ● Max. address name length is 256. (*) http://api.zeromq.org/3-2:zmq-inproc (**) Buggy on node-zmq package. sock.bind("inproc://queue"); ØMQ C API zmq_bind(socket, "ipc://queue"); NodeJS ZMQ
  • 22. Sockets Transports PGM (multicast) ● usage: pgm://<address>;<multicast_address>:<port> ● Requires sudo privileges to access raw IP sockets. ● Needs ØMQ built with PGM extension (./configure --with-pgm). (*) http://api.zeromq.org/3-2:zmq-pgm sock.bind( "pgm://192.168.1.100;239.192.1.1:3055" ); ØMQ C API zmq_bind(socket, "pgm://192.168.1.100; 239.192.1.1:3055"); NodeJS ZMQ
  • 23. Sockets Transports Encapsulated PGM (multicast) ● usage: epgm://<address>;<multicast_address>:<port> ● Needs ØMQ built with PGM extension (./configure --with-pgm). (*) http://api.zeromq.org/3-2:zmq-pgm sock.bind( "epgm://192.168.1.100;239.192.1.1:3055" ); ØMQ C API zmq_bind(socket, "epgm://192.168.1.100; 239.192.1.1:3055"); NodeJS ZMQ
  • 24. Sockets Send & Receive Send sock.send("My message"); sock.on("message", function(msg) { console.log(msg.toString()); }); (*) http://api.zeromq.org/3-2:zmq-send (**) http://api.zeromq.org/3-2:zmq-recv Receive sock.on("message", function(msg) { console.log("Received " + msg); }); // <msg> is a Buffer object.
  • 25. Sockets Multipart messages ØMQ Queue zmq_send(socket, "Como", 4, ZMQ_SNDMORE); Messages are atomic A ØMQ message is composed of 1 or more message parts. zmq_send(socket, "andas", 5, 0); 4 ComoPart 1 5 andasPart 2 ØMQ ensures that peers receive either all message parts of a message or none at all. The total number of message parts is unlimited except by available memory.
  • 26. Sockets Multipart messages sock.send("First part", zmq.ZMQ_SNDMORE); sock.send("Second part"); sock.send(["First part", "Second part"]); Send var r = sock.send("Como", zmq. ZMQ_SNDMORE); console.log(r); Check the outgoing buffer and socket state: running this will output -> > { type: 'req', _zmq: { state: 0, onReady: [Function] }, _outgoing: [ [ <Buffer 43 6f 6d 6f>, 2 ] ], _shouldFlush: true, _events: { message: [Function] } }
  • 27. Sockets Multipart messages sock.on("message", function(first_part, second_part) { console.log(first_part.toString()); console.log(second_part.toString()); }); sock.on("message", function() { for(var key in arguments) { console.log("Part " + key + ": " + arguments[key]); }; }); Receive sock.on("message", function() { var messages = Array.prototype.slice.call(arguments); messages.forEach(function(msg) { console.log("Part:" + msg); }); });
  • 28. Sockets Batched messaging ØMQ Queue 3 Msg "ØMQ batches messages in opportunistic manner. It sends all the messages available at the moment in one go. Latency of subsequent messages will be improved because sending single batch to the card is faster then sending lot of small messages." sock.send("Part A", zmq.ZMQ_SNDMORE); sock.send("Msg"); sock.send("Part B"); 6 Part A 6 Part B ØMQ Socket send send send <write busy> <write ready> Client Thread ØMQ I/O Thread send batch <write busy>
  • 29. Patterns Plugging multiple transports Example var zmq = require('zmq'), pub = zmq.socket('pub'); pub.bindSync('tcp://127.0.0.1:5555'); pub.bindSync('ipc:///tmp/zmq.sock'); setInterval(function() { pub.send("I am polyglot!"); }, 1000); sub = zmq.socket('sub'); sub.connect('ipc:///tmp/zmq.sock'); sub.subscribe(''); sub.on('message', function(msg) { console.log("Received: " + msg); }); var zmq = require('zmq'), sub = zmq.socket(sub'); sub.connect('tcp://127.0.0.1:5555'); sub.subscribe(''); sub.on('message', function(msg) { console.log(Received: ' + msg); });
  • 30. Sockets Setting Socket Options (*) http://api.zeromq.org/3-2:zmq-setsockopt Setsockopt ● usage (NodeJS ZMQ API): sock.setsockopt(<option>, <value>); or sock.<option> = <value>; sock.identity = 'monitor-1'; sock.setsockopt('identity', 'monitor-1'); Identity: // value can be any string up to 255 length. // identity is required on sockets // connecting to a Router.
  • 31. Sockets Setting Socket Options Setsockopt subscriber.subscribe('MUSIC'); subscriber.setsockopt('subscribe', 'MUSIC'); Subscribe: // sets a message filter for subscriber sockets. subscriber.unsubscribe('MUSIC'); susbscriber.setsockopt('subscribe', 'POP'); Unsubscribe: // sets off a message filter for subscriber sockets.
  • 33. Patterns Request / Reply Synchronous task distribution Ø REP #1 Ø REP # 2 Ø REQ < round robin > ... < synchronous > Used when each message needs to be matched with a response. Handles only one message at time. Strict send-recv cycle.
  • 34. Patterns Request / Reply Ø REP #1 Ø REP # 2Ø REQ send recv (wait response) send recv (dont wait response) recv (dont wait response)
  • 35. Patterns Request / Reply Ø REP #1 Ø REP # 2Ø REQ send recv recv send send -> REP #1 is down FAILURE REQ #1 will not recover !
  • 36. Patterns Request / Reply Basic Request / Reply var zmq = require('zmq'); reply = zmq.socket('rep'); reply.bind('tcp://127.0.0.1:5555', function(err) { if (err) throw err; } ); reply.on('message', function(msg) { console.log('Received: ' + msg); reply.send('Pong!'); }); var zmq = require('zmq'); request = zmq.socket('req'); request.connect('tcp://127.0.0.1:5555'); request.send('Ping'); request.on('message', function(msg) { console.log('Response: ' + msg); });
  • 37. Patterns Request / Reply Dealer socket message delivery Messages have to be multipart, consisting on: an empty delimiter header, followed by the content body parts. sock.send("Body"); Outgoing Queue 0 6 Body sock.send(new Buffer([]), zmq. ZMQ_SNDMORE); send send
  • 38. Patterns Request / Reply Dealer socket message delivery Outgoing messages are round-robined among all connected peers. However, sending depends on the availability of the receiver. sock.send( ["", "Msg"]); Outgoing Queue 3 Msg 6 Part A Peer Socket A Peer Socket B sock.send( ["", "Bla"); sock.send( ["", "Msg2"]); send send send To A To B To A send <write ready> <write busy> <write ready> 0 0 4 Msg2 0
  • 39. Patterns Request / Reply Dealer socket message delivery Reconnections are handled automatically: messages are asynchronously delivered. Response time does not block sending more messages. Outgoing Queue Peer Socket A Peer Socket B send -> Up again sock.send( ["", "Msg"]); 3 Msg sock.send( ["", "Msg2"]); send send To A To A 0 4 Msg2 0
  • 40. Patterns Request / Reply Ø REP #1 Ø REP # 2Ø DEALER enqueue < Msg A > send < Msg B > -> REP #1 is down enqueue < Msg C > send < Msg A, Msg C > send < Msg D > Dealer socket handles peer reconnection automatically. It will send messages that queued for that peer once it has established connection.
  • 41. Patterns Request / Reply > Response from: 5001 > Response from: 5001 > Response from: 5002 > Response from: 5001 > Response from: 5001 > Response from: 5002 > ... Dealer example var dealer = zmq.socket('dealer'); dealer.connect('tcp://127.0.0.1:5001'); dealer.connect('tcp://127.0.0.1:5002'); setInterval(function() { dealer.send(["", "Msg"]); }, 1000); dealer.on('message', function(h, msg) { console.log('Response from: ' + msg); }); running this 'might' output ->
  • 42. Patterns Request / Reply Router socket messaging Messages have to be multipart, consisting on: an identity frame, an empty delimiter frame, followed by the content body parts. This applies to both incoming and outgoing messages. sock.send("Body"); Outgoing Queue 0 6 Body sock.send("", zmq. ZMQ_SNDMORE); send send sock.send( "worker-1", zmq. ZMQ_SNDMORE); 8 worker-1 send
  • 43. Patterns Request / Reply Router is asynchronous Incoming messages are fair-queued among all connected and available peers. Peer Socket A Peer Socket B ØMQ Router Incoming Queue Socketsend send send
  • 44. Patterns Request / Reply Router is asynchronous Receiving depends on the availability of the sender. Peer Socket A Peer Socket B ØMQ Router Incoming Queue Socketsend send
  • 45. Patterns Push / Pull Unidirectional data distribution The Push / Pull pattern fits well on pipelined communication, i.e., when no response is required for a given message. Ø Ø ... ØØ
  • 46. Patterns Push / Pull Binding the Push socket Outgoing messages are round-robined among all connected and available peers. push.send("Msg"); push.send("Part B"); Outgoing Queue Peer Socket A Peer Socket B push.send("Part A", zmq.ZMQ_SNDMORE); push.send("Msg2"); 3 Msg 6 Part A 6 Part B 4 Msg2 send send send send
  • 47. Patterns Push / Pull Binding the Push socket Outgoing messages are round-robined among all connected and available peers. Outgoing Queue Peer Socket A Peer Socket B -> Down3 Msg 6 Part A 6 Part B 4 Msg2 send send send push.send("Msg"); push.send("Part B"); push.send("Part A", zmq.ZMQ_SNDMORE); push.send("Msg2"); send send send send
  • 48. Patterns Push / Pull Binding the Push socket Disconnections and reconnections are handled automatically. Outgoing Queue Peer Socket A Peer Socket B 4 More 6 Part 1 6 Part 2 5 Other send send send push.send("More"); send push.send("Part 2"); push.send("Part 1", zmq.ZMQ_SNDMORE); send send push.send("Other"); send
  • 49. Patterns Push / Pull Parallel task distribution Ø PULL #1 Ø PULL # 2 Ø PUSH < round robin > ...
  • 50. Patterns Push / Pull Passive agents / Monitor Ø PULLØ PUSH ... Ø PUSH
  • 51. Patterns Push / Pull Binding the Pull socket Push's outgoing messages are round-robined among all connected peers. push.send("Msg"); push.send("Part B"); Outgoing Queue Peer Socket A Peer Socket B push.send("Part A", zmq.ZMQ_SNDMORE); push.send("Msg2"); send send send send 3 Msg 6 Part A 6 Part B 4 Msg2 To A To B To A
  • 52. Patterns Push / Pull Binding the Pull socket Push's outgoing messages are round-robined among all connected peers. push.send("Msg"); push.send("Part B"); Outgoing Queue Peer Socket A Peer Socket B push.send("Part A", zmq.ZMQ_SNDMORE); push.send("Msg2"); send send send send send send send 3 Msg 6 Part A 6 Part B 4 Msg2 To A To B To A
  • 53. Patterns Push / Pull Binding the Pull socket Disconnections and reconnections are handled automatically. Outgoing Queue Peer Socket A Peer Socket B send send -> Down4 More 6 Part 1 6 Part 2 5 Other To A To A To B push.send("More"); send push.send("Part 2"); push.send("Part 1", zmq.ZMQ_SNDMORE); send send push.send("Other"); send
  • 54. Patterns Push / Pull Binding the Pull socket Sending is asynchronous, it depends on the availability of the receiver. Outgoing Queue Peer Socket A Peer Socket B send -> Up again 5 OtherTo B push.send("More"); send push.send("Part 2"); push.send("Part 1", zmq.ZMQ_SNDMORE); send send push.send("Other"); send
  • 55. Patterns Push / Pull Ø PULLØ PUSH #1 ... Ø PUSH #2 Active agents / collector pattern
  • 56. Patterns Publish / Subscribe Broadcast data distribution Ø SUB #1 Ø PUB #1 ... Ø SUB #2 Ø SUB #2
  • 57. Message distribution Patterns Publish / Subscribe sock.send("Msg"); Outgoing Queue 3 Msg Subscriber A Subscriber B send send Outgoing messages are send to each connected and available peers. Subscriber C
  • 58. Message distribution Patterns Publish / Subscribe sock.send("Msg"); Outgoing Queue 3 Msg Subscriber A Subscriber B send send Outgoing messages are send to each connected and available peers. Subscriber C 5 Othersock.send("Other"); send
  • 59. Subscribers can register to a specific topic. Data filtering Patterns Publish / Subscribe ØMQ Publisher Subscriber A Subscriber B Subscriber C Outgoing Queue subscribe AR subscribe VE Socket subscribe VE
  • 60. Subscribers can register to a specific topic. Data filtering Patterns Publish / Subscribe ØMQ Publisher Subscriber A Subscriber B Subscriber C Outgoing Queue subscribe AR subscribe VE Socket subscribe VE sock.send("AR news"); send 7 AR news send
  • 61. Subscribers can register to a specific topic. Data filtering Patterns Publish / Subscribe ØMQ Publisher Subscriber A Subscriber B Subscriber C Outgoing Queue subscribe AR subscribe VE Socket subscribe VE sock.send("VE news"); send 7 VE news sendsend
  • 62. Patterns Publish / Subscribe Data filtering example pub = zmq.socket('pub'); pub.bindSync("tcp://10.0.0.12:3055"); count = 0 setInterval(function() { pub.send("TEST " + count++); }, 1000); sub = zmq.socket('sub'); sub.connect("tcp://10.0.0.12:3055"); sub.subscribe("TEST"); sub.on("message", function(msg) { console.log("Received: " + msg); }); // older messages won't be // received > TEST 6 > TEST 7 > TEST 8 > TEST 9 > TEST 10 running this 'might' output ->
  • 63. Patterns Publish / Subscribe Multicast example var zmq = require('zmq'), pub = zmq.socket('pub'); pub.bind( "epgm://10.0.0.12;239.192.1.1:3055", function(err) { if(err) throw err; } ) setInterval(function() { pub.send("From pid: " + process.pid); }, 1000); var zmq = require('zmq'), sub = zmq.socket('sub'); sub.connect( "epgm://10.0.0.13;239.192.1.1:3055" ); sub.subscribe(""); sub.on('message', function(msg) { console.log("Received " + msg); }); (*) See running demo at http://youtu.be/NQrH0SATPk0
  • 64. "XSUB and XPUB are exactly like SUB and PUB except they expose subscriptions as special messages." Data distribution proxy Patterns XSUB / XPUB XSUB/XPUB Proxy Subscriber A Subscriber B Subscriber C XPUB Socket XSUB Socket Publisher A Publisher B Publisher C subscribe PY forward subscription
  • 65. Messages are forwarded by the proxy to the registered subscribers. Data distribution proxy Patterns XSUB / XPUB XSUB/XPUB Proxy Subscriber A Subscriber B Subscriber C XPUB Socket XSUB Socket Publisher A Publisher B Publisher C forward message send "PY<msg>" send
  • 69. Useful Links Pieter Hintjens personal blog http://hintjens.com/