File tree 3 files changed +15
-11
lines changed
3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 2
2
3
3
4
4
## Unreleased
5
+ ### Fixed
6
+ - zmq.asyncio has no attribute ` PUB ` (#128 )
7
+ - zmq plugin configuration collision between bind and connect (#126 )
5
8
6
9
7
10
## 1.4.2
Original file line number Diff line number Diff line change 1
1
Unreleased :
2
2
added : []
3
- fixed : []
3
+ fixed :
4
+ - ' zmq.asyncio has no attribute `PUB` (#128)'
5
+ - ' zmq plugin configuration collision between bind and connect (#126)'
4
6
changed : []
5
7
deprecated : []
6
8
removed : []
Original file line number Diff line number Diff line change 1
1
try :
2
+ from zmq import PUB
2
3
import zmq .asyncio as zmq
3
4
except ImportError :
4
5
zmq = None
10
11
11
12
12
13
class ZeroMQSchema (vaping .plugins .PluginConfigSchema ):
13
- bind = confu .schema .Str ()
14
- connect = confu .schema .Str ()
14
+ bind = confu .schema .Str (default = "" )
15
+ connect = confu .schema .Str (default = "" )
15
16
16
17
17
18
@vaping .plugin .register ("zeromq" )
@@ -41,22 +42,20 @@ def init(self):
41
42
self .ctx = zmq .Context ()
42
43
43
44
# sanity check config
44
- if "bind" in self .config :
45
- if "connect" in self .config :
45
+ if self .config . get ( "bind" ) :
46
+ if self .config . get ( "connect" ) :
46
47
msg = "bind and connect are mutually exclusive"
47
48
self .log .critical (msg )
48
49
raise ValueError (msg )
49
-
50
- elif "connect" not in self .config :
51
- msg = "missing bind or connect"
50
+ elif not self .config .get ("connect" ):
52
51
self .log .critical (msg )
53
52
raise ValueError (msg )
54
53
55
54
def on_start (self ):
56
- self .sock = self .ctx .socket (zmq . PUB )
57
- if "bind" in self .config :
55
+ self .sock = self .ctx .socket (PUB )
56
+ if self .config . get ( "bind" ) :
58
57
self .sock .bind (self .config ["bind" ])
59
- elif "connect" in self .config :
58
+ elif self .config . get ( "connect" ) :
60
59
self .sock .connect (self .config ["connect" ])
61
60
62
61
def on_stop (self ):
You can’t perform that action at this time.
0 commit comments