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();
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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With