Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement an active & standby queue job-processing system in JeroMQ?

Using ZeroMQ .Context and .Socket instances, I am able to push/pull messages
for example below my code for a Queue like setup:

 ZMQ.Context context = ZMQ.context(1);

 //  Socket to send messages on
 ZMQ.Socket sender = context.socket(ZMQ.PUSH);
 sender.bind("tcp://*:5557");

 // Send messages
 sender.send("0", 0);

 ZMQ.Socket receiver = context.socket(ZMQ.PULL);
 receiver.connect("tcp://localhost:5557");

 // receive messages
 String string = new String(receiver.recv(0)).trim();

My questions are:

Q1: How to implement an active / standby mode in queues?

I mean there will be 2 queues, created for one host and port, if one queue ( the active ) fails, another ( i.e. the standby ) queue, will be started immediately to listen/pull messages.

Any example or guidance to implement it, will be more helpful.

Q2: Is there any built-in Class to do this type of task?

like image 738
Abhishek Nayak Avatar asked Dec 01 '16 11:12

Abhishek Nayak


People also ask

How do you implement active learning?

Active learning methods ask students to engage in their learning by thinking, discussing, investigating, and creating. In class, students practice skills, solve problems, struggle with complex questions, make decisions, propose solutions, and explain ideas in their own words through writing and discussion.

What are the techniques of active learning and their implications?

Active learning techniques cause students to engage with the subjects rather than passively take in information. Examples of active learning activities include brainstorming, discussing, teaching, journaling, group work, focused listening, formulating questions, notetaking, annotating, and roleplaying.


1 Answers

you may implement some kind of binary start pattern. your queues need a discovery service (on another pair of sockets) to know about each other's state. if i'm not mistaken, there is no standard feature to make such queues.

like image 86
DontPanic Avatar answered Sep 18 '22 18:09

DontPanic