in discussion Hidden / Per page discussions » Broker vs. Brokerless
+1 year
Main
ØMQ Community
Development
+1 year
1
1
1
1
1
1
1
1
time flies, this has become my yearly check
You're busy for thirteen years!
Almost 12… drum rolls
Hi there,
I am new why zmq and this is my first time with independent processors.
I'm not sure I can do what I want with ZMQ, that's why I would like your opinion.
Here is my case:
- First process (1): it runs continuously, it contains traffic that changes over time.
- Second process (2): it is a solver that ensures that there is no conflict in my traffic.
Currently, I use files to communicate my two processes. (1) refreshes every 10 seconds a traffic file and (2) reads it if it exists when it starts a new algorithm generation (I skip the details).
(2) very regularly updates a solution file, which (1) will read every 10 seconds.
These reads/writes are asynchronous and my current version is probably not 100% stable because you have to constantly check that there is no write when one reads and vice versa… You see.
I wanted to know if a double PUSH - PULL operations could work here, in your opinion?
A small detail bothers me: my solution file can change before (1) reads it (because a better solution is found) and therefore I would have to be able to delete elements in the queue if they have not yet been read …
Thank you in advance for your comments/advice/opinions.
Sier
11 :)
hello all
I am new to zeromq, tried to compile/run the server/client example in C.
While i was able to compile I had issues executing the server, got a seg fault on the assert(rc ==0) (see code below), wanted to ask what the purpose of the assertion was ?
I was able to get the example to work when I comment out the assert command
On Ubuntu 20.04 LTS, using czmq
// Hello World server
#include <czmq.h>
int main (void)
{
// Socket to talk to clients
zsock_t *responder = zsock_new (ZMQ_REP);
int rc = zsock_bind (responder, "tcp://*:5555");
assert (rc == 0);
while (1) {
char *str = zstr_recv (responder);
printf ("Received Hello\n");
sleep (1); // Do some 'work'
zstr_send (responder, "World");
zstr_free (&str);
}
return 0;
}
10!
Yep, almost 9 years.
This is an amazing article, very well written covering lot of aspects. Many thanks for sharing.
Nine years!
For those interested, I figured out my issue. I forgot to add the identity and empty frames at the beginning of the reply message.
The identity frame is necessary for the DealerSocket to figure out which caller's ReceiveReady event to invoke, so without those frames it will not invoke ANY RecieveReady events, as if the message wasn't even received. I am a little surprised that this socket didn't raise an exception indicating that the socket received a reply message that did not match up with a previously sent message (via the identity value).
I'm pretty sure I had the identity frame and empty frame at the beginning of the reply message, but I was switching back and forth between the Request/Response and Dealer/Router patterns and along the way I removed them thinking I was simplifying the reply message and forgot that they were necessary.