zproto
zproto copied to clipboard
Server's engine does not notify server when a configuration has changed
It might be useful if server's engine generated with zproto_server_c.gsl could call a user defined function when one or more configuration parameter changes. Now it calls only functions internal to engine.
A nicer solution (IMO) would be to send a notification message through the callers pipe.
I am a bit unsure about the terminology here. zproto_server_cerver_c.gsl generates a generic server's engine which is to be included in the server code. The server code is written by the user and is problem specific. Engine can detect the configuration file has changed and apply the changes. What I need is somehow notify the server part (that problem specific, in case of malamute mlm_server.c) that the configuration has changed.
Or do you mean to exploit the server_method function?
The generated server is a czmq actor and thus owns a pipe to its caller. (see https://github.com/zeromq/zproto/blob/master/src/zproto_server_c.gsl#L275)
Through that pipe the user can enable verbose logging, set the binding endpoint, etc (see https://github.com/zeromq/zproto/blob/master/src/zproto_server_c.gsl#L875).
And through this pipe the server could notify the caller about configuration changes! I hope the clarifies it :)
Still confused, sorry. Let me explain through example. There is server_method function which engine calls (still referring to zproto_server_c.gsl). This function is to be implemented by programmer, and is part of server customization. What do you call that part of the server, which is implemented by programmer (as opposed to engine, which is generated)?
Okay, now I understand your problem. Server custom part vs server generated part is fine as terminology. To inform the server custom part from the server generated part (aka. server engine) a callback method would be useful indeed.
I though that you were trying to inform the user of the server (custom + generated). So forget about the pipe idea ;)