forked from zeromq/jeromq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsgqueue.java
More file actions
31 lines (26 loc) · 793 Bytes
/
msgqueue.java
File metadata and controls
31 lines (26 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package guide;
import org.zeromq.SocketType;
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Socket;
import org.zeromq.ZContext;
/**
* Simple message queuing broker
* Same as request-reply broker but using QUEUE device.
*/
public class msgqueue
{
public static void main(String[] args)
{
// Prepare our context and sockets
try (ZContext context = new ZContext()) {
// Socket facing clients
Socket frontend = context.createSocket(SocketType.ROUTER);
frontend.bind("tcp://*:5559");
// Socket facing services
Socket backend = context.createSocket(SocketType.DEALER);
backend.bind("tcp://*:5560");
// Start the proxy
ZMQ.proxy(frontend, backend, null);
}
}
}