//#sub-socket
ActorRef listener = system.actorOf(Props.create(ListenerActor.class));
ActorRef subSocket = ZeroMQExtension.get(system).newSubSocket(
new Connect("tcp://127.0.0.1:1233"),
new Listener(listener), Subscribe.all());
//#sub-socket
//#sub-topic-socket
ActorRef subTopicSocket = ZeroMQExtension.get(system).newSubSocket(
new Connect("tcp://127.0.0.1:1233"),
new Listener(listener), new Subscribe("foo.bar"));
//#sub-topic-socket
//#unsub-topic-socket
subTopicSocket.tell(new Unsubscribe("foo.bar"), ActorRef.noSender());
//#unsub-topic-socket
byte[] payload = new byte[0];
//#pub-topic
pubSocket.tell(ZMQMessage.withFrames(ByteString.fromString("foo.bar"),
ByteString.fromArray(payload)), ActorRef.noSender());
//#pub-topic
system.stop(subSocket);
system.stop(subTopicSocket);
//#high-watermark
ActorRef highWatermarkSocket = ZeroMQExtension.get(system).newRouterSocket(
new SocketOption[] { new Listener(listener),
new Bind("tcp://127.0.0.1:1233"), new HighWatermark(50000) });
//#high-watermark
}