def get_notification_listener(transport, targets, endpoints, executor='blocking', serializer=None, allow_requeue=False): """Construct a notification listener The executor parameter controls how incoming messages will be received and dispatched. By default, the most simple executor is used - the blocking executor. :param transport: the messaging transport :type transport: Transport :param targets: the exchanges and topics to listen on :type targets: list of Target :param endpoints: a list of endpoint objects :type endpoints: list :param executor: name of a message executor - e.g. 'eventlet', 'blocking' :type executor: str :param serializer: an optional entity serializer :type serializer: Serializer :param allow_requeue: whether NotificationResult.REQUEUE support is needed :type allow_requeue: bool :raises: NotImplementedError """ transport._require_driver_features(requeue=allow_requeue) dispatcher = notify_dispatcher.NotificationDispatcher( targets, endpoints, serializer, allow_requeue) return msg_server.MessageHandlingServer(transport, dispatcher, executor)
def get_rpc_server(transport, target, endpoints, executor='blocking', serializer=None): """Construct an RPC server. The executor parameter controls how incoming messages will be received and dispatched. By default, the most simple executor is used - the blocking executor. If the eventlet executor is used, the threading and time library need to be monkeypatched. :param transport: the messaging transport :type transport: Transport :param target: the exchange, topic and server to listen on :type target: Target :param endpoints: a list of endpoint objects :type endpoints: list :param executor: name of a message executor - for example 'eventlet', 'blocking' :type executor: str :param serializer: an optional entity serializer :type serializer: Serializer """ dispatcher = rpc_dispatcher.RPCDispatcher(target, endpoints, serializer) return msg_server.MessageHandlingServer(transport, dispatcher, executor)
def get_server(target, endpoints, serializer=None): assert TRANSPORT is not None if serializer is None: serializer = DesignateObjectSerializer() serializer = RequestContextSerializer(serializer) dispatcher = RPCDispatcher(target, endpoints, serializer) return msg_server.MessageHandlingServer(TRANSPORT, dispatcher, 'eventlet')