2019-07-30 13:17:29 +00:00
|
|
|
from tfw.internals.networking import ZMQConnector, ZMQUplinkConnector
|
2019-06-04 11:58:03 +00:00
|
|
|
from tfw.config import TFWENV
|
|
|
|
|
|
|
|
|
2019-07-03 14:48:17 +00:00
|
|
|
class ConnAddrMixin:
|
|
|
|
@property
|
|
|
|
def uplink_conn_addr(self):
|
|
|
|
return f'tcp://localhost:{TFWENV.PULL_PORT}'
|
|
|
|
|
|
|
|
@property
|
|
|
|
def downlink_conn_addr(self):
|
|
|
|
return f'tcp://localhost:{TFWENV.PUB_PORT}'
|
|
|
|
|
|
|
|
|
2019-07-30 13:17:29 +00:00
|
|
|
class TFWUplinkConnector(ZMQUplinkConnector, ConnAddrMixin):
|
2019-07-03 14:48:17 +00:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__(self.uplink_conn_addr)
|
2019-06-04 11:58:03 +00:00
|
|
|
|
|
|
|
|
2019-07-30 13:17:29 +00:00
|
|
|
class TFWConnector(ZMQConnector, ConnAddrMixin):
|
2019-07-03 14:48:17 +00:00
|
|
|
def __init__(self):
|
|
|
|
super().__init__(
|
|
|
|
self.downlink_conn_addr,
|
|
|
|
self.uplink_conn_addr
|
|
|
|
)
|