示例#1
0
    def __init__(self, conf, matchmaker=None, allowed_remote_exmods=None):

        default_publisher = zmq_dealer_publisher.DealerPublisher(
            conf, matchmaker)

        fanout_publisher = zmq_dealer_publisher.DealerPublisherLight(
            conf, matchmaker) if conf.use_pub_sub else default_publisher

        super(ZmqClient, self).__init__(
            conf,
            matchmaker,
            allowed_remote_exmods,
            publishers={
                zmq_names.CALL_TYPE:
                zmq_dealer_call_publisher.DealerCallPublisher(
                    conf, matchmaker),

                # Here use DealerPublisherLight for sending request to proxy
                # which finally uses PubPublisher to send fanout in case of
                # 'use_pub_sub' option configured.
                zmq_names.CAST_FANOUT_TYPE:
                fanout_publisher,
                zmq_names.NOTIFY_TYPE:
                fanout_publisher,
                "default":
                default_publisher
            })
示例#2
0
    def __init__(self, conf, matchmaker=None, allowed_remote_exmods=None):

        if conf.use_pub_sub or conf.use_router_proxy:
            raise WrongClientException()

        self.sockets_manager = zmq_publisher_base.SocketsManager(
            conf, matchmaker, zmq.ROUTER, zmq.DEALER)

        super(ZmqClientDirect, self).__init__(
            conf, matchmaker, allowed_remote_exmods,
            publishers={
                zmq_names.CALL_TYPE:
                    zmq_dealer_call_publisher.DealerCallPublisher(
                        conf, matchmaker, self.sockets_manager),

                "default": zmq_dealer_publisher.DealerPublisher(
                    conf, matchmaker)
            }
        )