本文整理汇总了Python中crossbar.router.session.RouterSessionFactory.remove方法的典型用法代码示例。如果您正苦于以下问题:Python RouterSessionFactory.remove方法的具体用法?Python RouterSessionFactory.remove怎么用?Python RouterSessionFactory.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类crossbar.router.session.RouterSessionFactory
的用法示例。
在下文中一共展示了RouterSessionFactory.remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RouterController
# 需要导入模块: from crossbar.router.session import RouterSessionFactory [as 别名]
# 或者: from crossbar.router.session.RouterSessionFactory import remove [as 别名]
#.........这里部分代码省略.........
topic = u'{}.on_realm_started'.format(self._uri_prefix)
event = rlm.marshal()
caller = details.caller if details else None
self.publish(topic, event, options=PublishOptions(exclude=caller))
self.log.info('Realm "{realm_id}" (name="{realm_name}") started', realm_id=realm_id, realm_name=rlm.session._realm)
return event
@wamp.register(None)
@inlineCallbacks
def stop_router_realm(self, realm_id, details=None):
"""
Stop a realm currently running on this router worker.
When a realm has stopped, no new session will be allowed to attach to the realm.
Optionally, close all sessions currently attached to the realm.
:param id: ID of the realm to stop.
:type id: str
:param details: Call details.
:type details: :class:`autobahn.wamp.types.CallDetails`
"""
self.log.info("{name}.stop_router_realm", name=self.__class__.__name__)
if realm_id not in self.realms:
raise ApplicationError(u"crossbar.error.no_such_object", "No realm with ID '{}'".format(realm_id))
rlm = self.realms[realm_id]
realm_name = rlm.config['name']
# stop the RouterServiceAgent living on the realm
yield rlm.session.leave()
self._router_session_factory.remove(rlm.session)
self.log.info('RouterServiceAgent stopped on realm "{realm_name}"', realm_name=realm_name)
detached_sessions = self._router_factory.stop_realm(realm_name)
del self.realms[realm_id]
del self.realm_to_id[realm_name]
realm_stopped = {
u'id': realm_id,
u'name': realm_name,
u'detached_sessions': sorted(detached_sessions)
}
self.publish(u'{}.on_realm_stopped'.format(self._uri_prefix), realm_id)
returnValue(realm_stopped)
@wamp.register(None)
def get_router_realm_roles(self, realm_id, details=None):
"""
Get roles currently running on a realm running on this router worker.
:param realm_id: The ID of the realm to list roles for.
:type realm_id: str
:param details: Call details.
:type details: :class:`autobahn.wamp.types.CallDetails`
:returns: A list of roles.
:rtype: list[dict]
"""
self.log.debug("{name}.get_router_realm_roles({realm_id})", name=self.__class__.__name__, realm_id=realm_id)