How to use the txzmq.ZmqREQConnection function in txZMQ

To help you get started, we’ve selected a few txZMQ examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github leapcode / bitmask_client / src / leap / bitmask / cli / command.py View on Github external
def __init__(self):
        color_init()
        zf = ZmqFactory()
        e = ZmqEndpoint(ZmqEndpointType.connect, ENDPOINT)
        self._conn = ZmqREQConnection(zf, e)

        self.data = []
        if self.service:
            self.data = [self.service]
github leapcode / bitmask-dev / src / leap / bitmask / cli / command.py View on Github external
def __init__(self, cfg, print_json=False):
        self.cfg = cfg

        color_init()
        zf = ZmqFactory()
        e = ZmqEndpoint(ZmqEndpointType.connect, ENDPOINT)
        self._conn = ZmqREQConnection(zf, e)

        self.data = []
        if self.service:
            self.data = [self.service]
        self.print_json = print_json
github leapcode / bitmask_client / src / leap / bitmask / cli / bitmask_cli.py View on Github external
def get_zmq_connection():
    zf = ZmqFactory()
    e = ZmqEndpoint(ZmqEndpointType.connect, ENDPOINT)
    return ZmqREQConnection(zf, e)
github MediaMath / qasino / lib / zmq_requestor.py View on Github external
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from txzmq import ZmqFactory, ZmqEndpoint, ZmqEndpointType, ZmqREQConnection

import logging

import json

from util import Identity

class ZmqRequestor(ZmqREQConnection):

    def __init__(self, remote_host, port, zmq_factory, data_manager=None):

        self.data_manager = data_manager

        self.remote_host = remote_host

        endpoint = ZmqEndpoint(ZmqEndpointType.connect, "tcp://%s:%d" % (remote_host, port))

        ZmqREQConnection.__init__(self, zmq_factory, endpoint)

    def request_metadata(self):
        msg = { "op" : "get_table_list", "identity" : Identity.get_identity() }
        #logging.info("ZmqRequestor: Requesting table list from %s.", self.remote_host)
        deferred = self.sendMsg(json.dumps(msg))
        deferred.callback = self.message_received