跳转到正文

bus_registry API ​

完整接口目录 · 插件运行时用法 · 工具包下载

模块说明 ​

text
Annotation-derived staging registrations for the native read/service Bus.

BusError ​

python
class BusError(RuntimeError)

SDK 说明:

text
An explicit terminal Bus failure; callers never replay it automatically.

BusError.__init__ ​

python
def __init__(self, code)

另继承外部类型 RuntimeError;其通用方法不在本 SDK 目录中重复展开。

BusError.bus_code ​

python
self.bus_code

公开实例属性,在 __init__ 中设置。

BusError.code ​

python
self.code

公开实例属性,在 __init__ 中设置。

Identity ​

python
@dataclass(frozen=True)
class Identity

字段(包含继承字段):

Identity.installation ​

python
installation: str

数据类字段;声明于 bus_registry.Identity。

Identity.generation ​

python
generation: int

数据类字段;声明于 bus_registry.Identity。

Call ​

python
@dataclass(frozen=True)
class Call

SDK 说明:

text
Host-authenticated invocation metadata, separate from business data.

arguments_raw is a validated canonical tagged request in immutable UTF-8
bytes. It never supplies identity or authorization claims.

字段(包含继承字段):

Call.call_id ​

python
call_id: str

数据类字段;声明于 bus_registry.Call。

Call.caller ​

python
caller: Identity

数据类字段;声明于 bus_registry.Call。

Call.provider ​

python
provider: Identity

数据类字段;声明于 bus_registry.Call。

Call.accepted_at ​

python
accepted_at: datetime

数据类字段;声明于 bus_registry.Call。

Call.deadline ​

python
deadline: datetime

数据类字段;声明于 bus_registry.Call。

Call.member ​

python
member: str

数据类字段;声明于 bus_registry.Call。

Call.kind ​

python
kind: str

数据类字段;声明于 bus_registry.Call。

Call.major ​

python
major: int

数据类字段;声明于 bus_registry.Call。

Call.schema_digest ​

python
schema_digest: str

数据类字段;声明于 bus_registry.Call。

Call.arguments_raw ​

python
arguments_raw: bytes

数据类字段;声明于 bus_registry.Call。

Call.scope_id ​

python
scope_id: str | None = None

数据类字段;声明于 bus_registry.Call。

Call.session_id ​

python
session_id: str | None = None

数据类字段;声明于 bus_registry.Call。

Call.cancelled ​

python
@property
def cancelled(self)

EmptyRequest ​

python
@dataclass(frozen=True)
class EmptyRequest

SDK 说明:

text
Structural request type of a callable with no business arguments.

bus_service ​

python
def bus_service(name, *, major=1, shared=False)

SDK 说明:

text
Declare a Plugin method; context injection depends on the Call type.

bus_read ​

python
def bus_read(name, *, major=1, shared=False, candidate_readable=False)

Registration ​

python
class Registration

Registration.__init__ ​

python
def __init__(self, registry, key, handler, options)

Registration.descriptor ​

python
@property
def descriptor(self)

Registration.close ​

python
def close(self)

SDK 说明:

text
Remove a registration during on_init, before validation freezes it.

Registration.invoke ​

python
async def invoke(self, body, argument)

Registration.signature ​

python
self.signature

公开实例属性,在 __init__ 中设置。

Registration.request_type ​

python
self.request_type

公开实例属性,在 __init__ 中设置。

BusRegistry ​

python
class BusRegistry

BusRegistry.__init__ ​

python
def __init__(self)

BusRegistry.provide ​

python
def provide(
    self,
    handler,
    *,
    name,
    kind = 'service',
    major = 1,
    shared = False,
    candidate_readable = False,
)

BusRegistry.service ​

python
def service(self, name, *, major=1, shared=False)

BusRegistry.read ​

python
def read(self, name, *, major=1, shared=False, candidate_readable=False)

BusRegistry.publish ​

python
def publish(self, name, *, major=1, unique=True)

BusRegistry.on_bus_data ​

python
def on_bus_data(self, name, **options)

BusRegistry.on_bus_data_async ​

python
def on_bus_data_async(self, name, **options)

BusRegistry.on_packet ​

python
def on_packet(self, packet_type, **options)

BusRegistry.on_packet_async ​

python
def on_packet_async(self, packet_type, **options)

BusRegistry.freeze ​

python
def freeze(self)

BusRegistry.invoke ​

python
async def invoke(self, body, argument)

Neomega · 使用、开发与参考文档