-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathdafka_towerd.c
58 lines (43 loc) · 1.63 KB
/
dafka_towerd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* =========================================================================
dafka_towerd - description
Copyright (c) the Contributors as noted in the AUTHORS file.
This file is part of CZMQ, the high-level C binding for 0MQ:
http://czmq.zeromq.org.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
=========================================================================
*/
/*
@header
dafka_towerd -
@discuss
TODO: actually use the port params
@end
*/
#include "dafka_classes.h"
int main (int argc, char** argv) {
zargs_t *args = zargs_new (argc, argv);
if (zargs_hasx (args, "--help", "-h", NULL)) {
puts ("Usage: dafka_towerd [-c config] [--pub tower-pub-address] [--sub tower-sub-address] [--verbose]");
return 0;
}
zconfig_t *config;
if (zargs_has (args, "-c"))
config = zconfig_load (zargs_get (args, "-c"));
else
config = zconfig_new ("root", NULL);
if (zargs_has (args, "--verbose"))
zconfig_put (config, "tower/verbose", "1");
if (zargs_has (args, "--pub"))
zconfig_put (config, "tower/pub_address", zargs_get (args, "--pub"));
if (zargs_has (args, "--sub"))
zconfig_put (config, "tower/sub_address", zargs_get (args, "--sub"));
zactor_t *tower = zactor_new (dafka_tower_actor, config);
char* command = zstr_recv (tower);
zstr_free (&command); // Interrupted
zconfig_destroy (&config);
zargs_destroy (&args);
zactor_destroy (&tower);
return 0;
}