Python oslo_messaging.get_rpc_server() Examples

The following are 23 code examples of oslo_messaging.get_rpc_server(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module oslo_messaging , or try the search function .
Example #1
Source File: messaging.py    From cloudkitty with Apache License 2.0 5 votes vote down vote up
def get_server(target=None, endpoints=None):
    access_policy = dispatcher.DefaultRPCAccessPolicy
    transport = get_transport()
    if not target:
        target = get_target()
    return oslo_messaging.get_rpc_server(transport, target,
                                         endpoints, executor='threading',
                                         access_policy=access_policy) 
Example #2
Source File: rpc.py    From neutron-lib with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    """Get a new RPC server reference.

    :param target: The target for the new RPC server.
    :param endpoints: The endpoints for the RPC server.
    :param serializer: The optional serialize to use for the RPC server.
    :returns: A new RPC server reference.
    """
    if TRANSPORT is None:
        raise AssertionError(_("'TRANSPORT' must not be None"))
    serializer = RequestContextSerializer(serializer)
    access_policy = dispatcher.DefaultRPCAccessPolicy
    return oslo_messaging.get_rpc_server(TRANSPORT, target, endpoints,
                                         'eventlet', serializer,
                                         access_policy=access_policy) 
Example #3
Source File: rpc.py    From karbor with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    serializer = RequestContextSerializer(serializer)
    access_policy = dispatcher.DefaultRPCAccessPolicy
    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
Example #4
Source File: service.py    From qinling with Apache License 2.0 5 votes vote down vote up
def run(self):
        qinling_endpoint = keystone_utils.get_qinling_endpoint()
        orchestrator = orchestra_base.load_orchestrator(CONF, qinling_endpoint)
        db_api.setup_db()

        topic = CONF.engine.topic
        server = CONF.engine.host
        transport = messaging.get_rpc_transport(CONF)
        target = messaging.Target(topic=topic, server=server, fanout=False)
        endpoint = engine.DefaultEngine(orchestrator, qinling_endpoint)
        access_policy = dispatcher.DefaultRPCAccessPolicy
        self.server = messaging.get_rpc_server(
            transport,
            target,
            [endpoint],
            executor='threading',
            access_policy=access_policy,
            serializer=rpc.ContextSerializer(
                messaging.serializer.JsonPayloadSerializer())
        )

        LOG.info('Starting function mapping periodic task...')
        periodics.start_function_mapping_handler(endpoint)

        LOG.info('Starting engine...')
        self.server.start() 
Example #5
Source File: rpc.py    From ironic-inspector with Apache License 2.0 5 votes vote down vote up
def get_server(endpoints):
    """Get a RPC server instance."""

    assert TRANSPORT is not None
    target = messaging.Target(topic=manager.MANAGER_TOPIC, server=CONF.host,
                              version='1.3')
    return messaging.get_rpc_server(
        TRANSPORT, target, endpoints, executor='eventlet',
        access_policy=dispatcher.DefaultRPCAccessPolicy) 
Example #6
Source File: rpc.py    From cyborg with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    access_policy = dispatcher.DefaultRPCAccessPolicy
    serializer = RequestContextSerializer(serializer)
    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
Example #7
Source File: rpc.py    From coriolis with GNU Affero General Public License v3.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    serializer = RequestContextSerializer(serializer)
    return messaging.get_rpc_server(_get_transport(), target, endpoints,
                                    executor='eventlet',
                                    serializer=serializer) 
Example #8
Source File: messaging.py    From senlin with Apache License 2.0 5 votes vote down vote up
def get_rpc_server(target, endpoint, serializer=None):
    """Return a configured oslo_messaging rpc server."""
    if serializer is None:
        serializer = JsonPayloadSerializer()
    serializer = RequestContextSerializer(serializer)
    return messaging.get_rpc_server(TRANSPORT, target, [endpoint],
                                    executor='eventlet',
                                    serializer=serializer) 
Example #9
Source File: __init__.py    From barbican with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    access_policy = dispatcher.DefaultRPCAccessPolicy
    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
Example #10
Source File: service.py    From watcher with Apache License 2.0 5 votes vote down vote up
def build_topic_handler(self, topic_name, endpoints=()):
        access_policy = dispatcher.DefaultRPCAccessPolicy
        serializer = rpc.RequestContextSerializer(rpc.JsonPayloadSerializer())
        target = om.Target(
            topic=topic_name,
            # For compatibility, we can override it with 'host' opt
            server=CONF.host or socket.gethostname(),
            version=self.api_version,
        )
        return om.get_rpc_server(
            self.transport, target, endpoints,
            executor='eventlet', serializer=serializer,
            access_policy=access_policy) 
Example #11
Source File: rpc.py    From watcher with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    access_policy = dispatcher.DefaultRPCAccessPolicy
    serializer = RequestContextSerializer(serializer)
    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
Example #12
Source File: rpc.py    From tacker with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    serializer = RequestContextSerializer(serializer)
    access_policy = dispatcher.DefaultRPCAccessPolicy
    return oslo_messaging.get_rpc_server(TRANSPORT, target, endpoints,
                                         'eventlet', serializer,
                                         access_policy=access_policy) 
Example #13
Source File: rpc_service.py    From zun with Apache License 2.0 5 votes vote down vote up
def __init__(self, topic, server, endpoints, binary):
        super(Service, self).__init__()
        serializer = _init_serializer()
        transport = messaging.get_rpc_transport(CONF)
        access_policy = dispatcher.DefaultRPCAccessPolicy
        # TODO(asalkeld) add support for version='x.y'
        target = messaging.Target(topic=topic, server=server)
        self.endpoints = endpoints
        self._server = messaging.get_rpc_server(transport, target, endpoints,
                                                executor='eventlet',
                                                serializer=serializer,
                                                access_policy=access_policy)
        self.binary = binary
        profiler.setup(binary, CONF.host) 
Example #14
Source File: rpc.py    From vitrage with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, transport, serializer=None):
    assert transport is not None

    if profiler:
        LOG.debug('profiler enabled for RPC server')
        serializer = ProfilerContextSerializer(serializer=serializer)

    access_policy = dispatcher.DefaultRPCAccessPolicy
    return messaging.get_rpc_server(transport,
                                    target,
                                    endpoints,
                                    serializer=serializer,
                                    access_policy=access_policy) 
Example #15
Source File: __init__.py    From sgx-kms with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer) 
Example #16
Source File: rpc.py    From masakari with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    access_policy = dispatcher.DefaultRPCAccessPolicy
    serializer = RequestContextSerializer(serializer)
    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
Example #17
Source File: rpc.py    From manila with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    access_policy = dispatcher.DefaultRPCAccessPolicy
    serializer = RequestContextSerializer(serializer)
    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
Example #18
Source File: rpc_service.py    From magnum with Apache License 2.0 5 votes vote down vote up
def __init__(self, topic, server, handlers, binary):
        super(Service, self).__init__()
        serializer = _init_serializer()
        transport = messaging.get_rpc_transport(CONF)
        # TODO(asalkeld) add support for version='x.y'
        access_policy = dispatcher.DefaultRPCAccessPolicy
        target = messaging.Target(topic=topic, server=server)
        self._server = messaging.get_rpc_server(transport, target, handlers,
                                                executor='eventlet',
                                                serializer=serializer,
                                                access_policy=access_policy)
        self.binary = binary
        profiler.setup(binary, CONF.host) 
Example #19
Source File: rpc.py    From magnum with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    assert TRANSPORT is not None
    access_policy = dispatcher.DefaultRPCAccessPolicy
    if profiler:
        serializer = ProfilerRequestContextSerializer(serializer)
    else:
        serializer = RequestContextSerializer(serializer)

    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor='eventlet',
                                    serializer=serializer,
                                    access_policy=access_policy) 
Example #20
Source File: broker.py    From galaxia with Apache License 2.0 5 votes vote down vote up
def __init__(self, topic, host, handler):
        serializer = messaging.RequestContextSerializer(
                messaging.JsonPayloadSerializer())
        transport = messaging.get_transport(cfg.CONF)
        target = messaging.Target(topic=topic, server=host)
        self.rpc_server = messaging.get_rpc_server(transport, target, handler,
                                                   serializer=serializer) 
Example #21
Source File: rpc.py    From vdi-broker with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    serializer = RequestContextSerializer(serializer)
    return messaging.get_rpc_server(_get_transport(), target, endpoints,
                                    executor='eventlet',
                                    serializer=serializer) 
Example #22
Source File: rpc.py    From designate with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, serializer=None):
    if TRANSPORT is None:
        raise AssertionError("'TRANSPORT' must not be None")
    if serializer is None:
        serializer = DesignateObjectSerializer()
    serializer = RequestContextSerializer(serializer)
    access_policy = rpc_dispatcher.DefaultRPCAccessPolicy
    return messaging.get_rpc_server(
        TRANSPORT,
        target,
        endpoints,
        executor='eventlet',
        serializer=serializer,
        access_policy=access_policy
    ) 
Example #23
Source File: rpc.py    From octavia with Apache License 2.0 5 votes vote down vote up
def get_server(target, endpoints, executor='threading',
               access_policy=dispatcher.DefaultRPCAccessPolicy,
               serializer=None):
    if TRANSPORT is None:
        init()

    return messaging.get_rpc_server(TRANSPORT,
                                    target,
                                    endpoints,
                                    executor=executor,
                                    serializer=serializer,
                                    access_policy=access_policy)