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


Python Publisher.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pyon.net.endpoint import Publisher [as 别名]
# 或者: from pyon.net.endpoint.Publisher import __init__ [as 别名]
    def __init__(self, xp=None, **kwargs):

        # generate a name
        xp = xp or get_events_exchange_point()
        name = (xp, None)

        Publisher.__init__(self, name=name, **kwargs)
开发者ID:blazetopher,项目名称:pyon,代码行数:9,代码来源:event.py

示例2: __init__

# 需要导入模块: from pyon.net.endpoint import Publisher [as 别名]
# 或者: from pyon.net.endpoint.Publisher import __init__ [as 别名]
    def __init__(self, event_type=None, xp=None, process=None, **kwargs):
        """
        Constructs a publisher of events for a specific type.

        @param  event_type  The name of the event type object
        @param  xp          Exchange (AMQP) name, can be none, will use events default.
        """

        self.event_type = event_type
        self.process = process
        self._events_xp = CFG.get_safe("exchange.core.events", DEFAULT_EVENTS_XP)

        if bootstrap.container_instance and getattr(bootstrap.container_instance, 'event_repository', None):
            self.event_repo = bootstrap.container_instance.event_repository
        else:
            self.event_repo = None

        # generate an exchange name to publish events to
        container = (hasattr(self, '_process') and hasattr(self._process, 'container') and self._process.container) or BaseEndpoint._get_container_instance()
        if container and container.has_capability(container.CCAP.EXCHANGE_MANAGER):   # might be too early in chain
            xp = xp or container.create_xp(self._events_xp)
            to_name = xp
        else:
            xp = xp or self.get_events_exchange_point()
            to_name = (xp, None)

        Publisher.__init__(self, to_name=to_name, **kwargs)
开发者ID:mkl-,项目名称:scioncc,代码行数:29,代码来源:event.py

示例3: __init__

# 需要导入模块: from pyon.net.endpoint import Publisher [as 别名]
# 或者: from pyon.net.endpoint.Publisher import __init__ [as 别名]
    def __init__(self, xp=None, event_repo=None, **kwargs):
        """
        Constructs a publisher of events.

        @param  xp          Exchange (AMQP) name, can be none, will use events default.
        @param  event_repo  An optional repository for published events. If None, will not store
                            published events. Use the Container.event_repository for this
                            parameter if you have one.
        """

        # generate a name
        xp = xp or get_events_exchange_point()
        name = (xp, None)

        self.event_repo = event_repo

        Publisher.__init__(self, to_name=name, **kwargs)
开发者ID:tgiguere,项目名称:pyon,代码行数:19,代码来源:event.py

示例4: __init__

# 需要导入模块: from pyon.net.endpoint import Publisher [as 别名]
# 或者: from pyon.net.endpoint.Publisher import __init__ [as 别名]
    def __init__(self, event_type=None, xp=None, **kwargs):
        """
        Constructs a publisher of events for a specific type.

        @param  event_type  The name of the event type object
        @param  xp          Exchange (AMQP) name, can be none, will use events default.
        """

        self.event_type = event_type

        if bootstrap.container_instance and getattr(bootstrap.container_instance, 'event_repository', None):
            self.event_repo = bootstrap.container_instance.event_repository
        else:
            self.event_repo = None

        # generate an exchange name to publish events to
        xp = xp or get_events_exchange_point()
        name = (xp, None)

        Publisher.__init__(self, to_name=name, **kwargs)
开发者ID:daf,项目名称:pyon,代码行数:22,代码来源:event.py

示例5: __init__

# 需要导入模块: from pyon.net.endpoint import Publisher [as 别名]
# 或者: from pyon.net.endpoint.Publisher import __init__ [as 别名]
    def __init__(self, process, stream, **kwargs):
        """
        Creates a StreamPublisher which publishes to the specified stream
        and is attached to the specified process.
        @param process   The IonProcess to attach to.
        @param stream    Name of the stream or StreamRoute object
        """
        super(StreamPublisher, self).__init__()
        if not isinstance(process, BaseService):
            raise BadRequest("No valid process provided.")
        if isinstance(stream, basestring):
            self.stream_route = StreamRoute(routing_key=stream)
        elif isinstance(stream, StreamRoute):
            self.stream_route = stream
        else:
            raise BadRequest("No valid stream information provided.")

        self.container = process.container
        self.xp_name = get_streaming_xp(self.stream_route.exchange_point)   # Fully qualified

        self.xp = self.container.ex_manager.create_xp(self.stream_route.exchange_point or DEFAULT_DATA_XP)
        self.xp_route = self.xp.create_route(self.stream_route.routing_key)

        Publisher.__init__(self, to_name=self.xp_route, **kwargs)
开发者ID:edwardhunter,项目名称:scioncc,代码行数:26,代码来源:stream.py

示例6: __init__

# 需要导入模块: from pyon.net.endpoint import Publisher [as 别名]
# 或者: from pyon.net.endpoint.Publisher import __init__ [as 别名]
 def __init__(self, process=None, **kwargs):
     self._process = process
     Publisher.__init__(self, **kwargs)
开发者ID:oldpatricka,项目名称:pyon,代码行数:5,代码来源:endpoint.py


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