@Override
public void onReceive(Object message) throws Exception {
if (message.equals(TICK)) {
if (random.nextBoolean() == true) {
routerSocket.tell(new ZMQMessage(new Frame("A"), new Frame(
"This is the workload for A")));
} else {
routerSocket.tell(new ZMQMessage(new Frame("B"), new Frame(
"This is the workload for B")));
}
count++;
if (count == 10)
cancellable.cancel();
} else if (message instanceof ZMQMessage) {
ZMQMessage m = (ZMQMessage) message;
String replier = new String(m.payload(0));
String msg = new String(m.payload(1));
log.info("Received message from {} with mesg -> {}", replier, msg);
}
}