ZeroMQ高级发布订阅模式
Clone server, Model Six (clonesrv6.c): main task setupint main (int argc, char *argv []){clonesrv_t *self = (clonesrv_t *) zmalloc (sizeof (clonesrv_t));if (argc == 2 && streq (argv [1], "-p")) {zclock_log ("I: primary active, waiting for backup (passive)");self->bstar = bstar_new (BSTAR_PRIMARY, "tcp://*:5003","tcp://localhost:5004");bstar_voter (self->bstar, "tcp://*:5556", ZMQ_ROUTER, s_snapshots, self);self->port = 5556;self->peer = 5566;self->primary = TRUE;}elseif (argc == 2 && streq (argv [1], "-b")) {zclock_log ("I: backup passive, waiting for primary (active)");self->bstar = bstar_new (BSTAR_BACKUP, "tcp://*:5004","tcp://localhost:5003");bstar_voter (self->bstar, "tcp://*:5566", ZMQ_ROUTER, s_snapshots, self);self->port = 5566;
- 2022-07-10 22:25:19下载
- 积分:1