当前位置: 首页>>代码示例>>Python>>正文


Python oslo_messaging.JsonPayloadSerializer方法代码示例

本文整理汇总了Python中oslo_messaging.JsonPayloadSerializer方法的典型用法代码示例。如果您正苦于以下问题:Python oslo_messaging.JsonPayloadSerializer方法的具体用法?Python oslo_messaging.JsonPayloadSerializer怎么用?Python oslo_messaging.JsonPayloadSerializer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oslo_messaging的用法示例。


在下文中一共展示了oslo_messaging.JsonPayloadSerializer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
def init(conf):
    global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_rpc_transport(conf,
                                            allowed_remote_exmods=exmods)
    NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
        conf,
        allowed_remote_exmods=exmods)

    if utils.notifications_enabled(conf):
        json_serializer = messaging.JsonPayloadSerializer()
        serializer = RequestContextSerializer(json_serializer)
        NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
                                      serializer=serializer)
    else:
        NOTIFIER = utils.DO_NOTHING 
开发者ID:openstack,项目名称:manila,代码行数:18,代码来源:rpc.py

示例2: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
def init(conf):

    global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_rpc_transport(conf,
                                            allowed_remote_exmods=exmods)
    NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
        conf,
        allowed_remote_exmods=exmods)

    # get_notification_transport has loaded oslo_messaging_notifications config
    # group, so we can now check if notifications are actually enabled.
    if utils.notifications_enabled(conf):
        json_serializer = messaging.JsonPayloadSerializer()
        serializer = RequestContextSerializer(json_serializer)
        NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
                                      serializer=serializer)
    else:
        NOTIFIER = utils.DO_NOTHING 
开发者ID:openstack,项目名称:karbor,代码行数:21,代码来源:rpc.py

示例3: __init__

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
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) 
开发者ID:WiproOpenSource,项目名称:galaxia,代码行数:9,代码来源:broker.py

示例4: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
def init(conf):
    global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = oslo_messaging.get_rpc_transport(conf,
                                                 allowed_remote_exmods=exmods)
    NOTIFICATION_TRANSPORT = oslo_messaging.get_notification_transport(
        conf, allowed_remote_exmods=exmods)
    json_serializer = oslo_messaging.JsonPayloadSerializer()
    serializer = RequestContextSerializer(json_serializer)
    NOTIFIER = oslo_messaging.Notifier(NOTIFICATION_TRANSPORT,
                                       serializer=serializer) 
开发者ID:openstack,项目名称:tacker,代码行数:13,代码来源:rpc.py

示例5: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
def init(conf):
    global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_rpc_transport(
        conf, allowed_remote_exmods=exmods)
    NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
        conf, allowed_remote_exmods=exmods)

    serializer = RequestContextSerializer(JsonPayloadSerializer())
    if not conf.notification_level:
        NOTIFIER = messaging.Notifier(
            NOTIFICATION_TRANSPORT, serializer=serializer, driver='noop')
    else:
        NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
                                      serializer=serializer) 
开发者ID:openstack,项目名称:watcher,代码行数:17,代码来源:rpc.py

示例6: setup

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
def setup(url=None, optional=False):
    """Initialise the oslo_messaging layer."""
    global TRANSPORT, GLOBAL_TRANSPORT, NOTIFIER

    if url and url.startswith("fake://"):
        # NOTE: oslo_messaging fake driver uses time.sleep
        # for task switch, so we need to monkey_patch it
        eventlet.monkey_patch(time=True)

    messaging.set_transport_defaults('senlin')
    if not TRANSPORT:
        exmods = ['senlin.common.exception']
        try:
            TRANSPORT = messaging.get_rpc_transport(
                cfg.CONF, url, allowed_remote_exmods=exmods)
        except messaging.InvalidTransportURL as e:
            TRANSPORT = None
            if not optional or e.url:
                # NOTE: oslo_messaging is configured but unloadable
                # so reraise the exception
                raise

    if not NOTIFIER:
        exmods = ['senlin.common.exception']
        try:
            NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
                cfg.CONF, allowed_remote_exmods=exmods)
        except Exception:
            raise

        serializer = RequestContextSerializer(JsonPayloadSerializer())
        NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
                                      serializer=serializer,
                                      topics=cfg.CONF.notification_topics) 
开发者ID:openstack,项目名称:senlin,代码行数:36,代码来源:messaging.py

示例7: get_rpc_server

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
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) 
开发者ID:openstack,项目名称:senlin,代码行数:10,代码来源:messaging.py

示例8: get_rpc_client

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
def get_rpc_client(topic, server, serializer=None):
    """Return a configured oslo_messaging RPCClient."""
    target = messaging.Target(topic=topic, server=server,
                              version=consts.RPC_API_VERSION_BASE)
    if serializer is None:
        serializer = JsonPayloadSerializer()
    serializer = RequestContextSerializer(serializer)
    return messaging.RPCClient(TRANSPORT, target, serializer=serializer) 
开发者ID:openstack,项目名称:senlin,代码行数:10,代码来源:messaging.py

示例9: init

# 需要导入模块: import oslo_messaging [as 别名]
# 或者: from oslo_messaging import JsonPayloadSerializer [as 别名]
def init(conf):
    global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER
    exmods = get_allowed_exmods()
    TRANSPORT = messaging.get_rpc_transport(conf,
                                            allowed_remote_exmods=exmods)
    NOTIFICATION_TRANSPORT = messaging.get_notification_transport(
        conf,
        allowed_remote_exmods=exmods)
    serializer = RequestContextSerializer(messaging.JsonPayloadSerializer())
    NOTIFIER = messaging.Notifier(NOTIFICATION_TRANSPORT,
                                  serializer=serializer,
                                  topics=['notifications']) 
开发者ID:openstack,项目名称:cyborg,代码行数:14,代码来源:rpc.py


注:本文中的oslo_messaging.JsonPayloadSerializer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。