Skip to content

本页为英文技术参考;字段、编号与支持状态直接来自同一契约源。中文学习路线见 开发文档。

Events ​

Publish typed events and subscribe with explicit delivery and resumption behavior. Event payloads describe observations; the Host supplies trusted origin and invocation identity.

Contract: nexa.events/100. API index.

Typical sequence ​

Define the event contract, subscribe during the permitted registration stage, and publish only with the declared schema and scope. Keep the returned subscription identity for cleanup.

Behavior and limits ​

Callbacks may repeat under at-least-once delivery. Handle resynchronization after gaps and retention loss. Use the matching subscription-based unsubscribe operation instead of reinterpreting a subscription as a registration.

The recorded Host maps 7 of 7 operations in this group. A mapping is subject to permission, phase, scope, platform and business preconditions. Host snapshot identifies the source revision; negotiate against the actual installed Host.

Operations ​

Describe · Subscribe · Define · Publish · Unsubscribe · UnsubscribeSubscription · RegisterSubscription

Describe ​

QualifiedRequest → EventDescriptor

PropertyContract
Local SDK method ID6
KindQuery
Permissionnexa.events.read
Legal phasesInitialize, PostInitialize, Checkup, Finalize, Active
IdempotencyReadOnly
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
IdQualifiedIdIdentity in this model’s domain. Use the identity issued or declared for this object, not a display name or filesystem path.

Successful result

Decode the exact output model after Success. Preserve its identities, revision and schema metadata for subsequent domain operations.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. A read-only classification does not bypass budgets or guarantee a failed request can be retried indefinitely. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Events_Describe(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Events_Describe_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Subscribe ​

EventSubscribeRequest → SubscriptionRef

PropertyContract
Local SDK method ID7
KindRegistration
Permissionnexa.events.write
Legal phasesInitialize
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
EventQualifiedIdIdentity or revision in this model’s domain; preserve ownership and exact spelling.
SchemaSchemaRefExact schema identity, version and fingerprint used to validate Value.
Cursorstring?Opaque continuation or observation cursor. Reuse only in the issuing query/scope; absence and invalidity are different. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.
HandlerulongCallback identifier registered by this plugin. A handler alone is not a public action or provider registration.
IgnoreSelfboolDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
DeduplicateboolDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
ScopeScopedTargetExplicit target scope. The Host checks that the caller is authorized for it.
LifetimeSubscriptionLifetimeUse an exact enum member listed in the reference. The Host can support a subset for a particular operation.
ReentryReentryPolicyUse an exact enum member listed in the reference. The Host can support a subset for a particular operation.
QueueLimitlongDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.

Successful result

Retain the subscription identity, consume bounded batches or callbacks as specified, handle gaps, and release it when no longer needed.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Events_Subscribe(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Events_Subscribe_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Define ​

EventDescriptor → RegistrationRef

PropertyContract
Local SDK method ID8
KindRegistration
Permissionnexa.events.write
Legal phasesInitialize
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
IdQualifiedIdIdentity in this model’s domain. Use the identity issued or declared for this object, not a display name or filesystem path.
SchemaSchemaRefExact schema identity, version and fingerprint used to validate Value.
OrderingPartitionstringDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
DeliveryDeliveryGuaranteeUse an exact enum member listed in the reference. The Host can support a subset for a particular operation.
DurableboolDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
QueueLimitlongDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.

Successful result

Retain the registration identity for the permitted update/release operation. Staged registrations become visible only at group activation.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Events_Define(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Events_Define_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Publish ​

EventEnvelope → Empty

PropertyContract
Local SDK method ID9
KindMutation
Permissionnexa.events.write
Legal phasesActive
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Request fields

FieldTypeMeaning
EventIdGuidDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
EventQualifiedIdIdentity or revision in this model’s domain; preserve ownership and exact spelling.
SchemaSchemaRefExact schema identity, version and fingerprint used to validate Value.
EntityEntityId?Identity or revision in this model’s domain; preserve ownership and exact spelling. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.
RevisionRevisionOpaque version token issued by the owner. Do not increment it or substitute another object’s revision.
OccurredAtDateTimeOffsetDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
CorrelationIdGuidDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
CausationIdGuid?Domain value named by this field; additional accepted values and bounds are determined by the operation and Host policy. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.
OriginstringDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
ScopeScopedTargetExplicit target scope. The Host checks that the caller is authorized for it.
PayloadAbiValueDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.

Successful result

There is no result payload beyond the encoded Empty model. Check Success; an empty failure value is not successful completion.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Events_Publish(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Events_Publish_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

Unsubscribe ​

RegistrationRequest → Empty

PropertyContract
Local SDK method ID10
KindMutation
Permissionnexa.events.write
Legal phasesActive, Stop
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

This historical current-catalog method accepts RegistrationRequest, not SubscriptionRef. Use UnsubscribeSubscription for a handle returned by Subscribe, or RegisterSubscription when both identities are needed. Never reinterpret one handle as the other.

Request fields

FieldTypeMeaning
RegistrationRegistrationRefStructured RegistrationRef value; follow its linked field contract.

Successful result

There is no result payload beyond the encoded Empty model. Check Success; an empty failure value is not successful completion.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Events_Unsubscribe(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Events_Unsubscribe_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

UnsubscribeSubscription ​

SubscriptionRef → Empty

PropertyContract
Local SDK method ID11
KindMutation
Permissionnexa.events.write
Legal phasesActive, Stop
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Accepts the actual SubscriptionRef returned by Subscribe. This additive operation resolves the historical mismatch between Subscribe and Unsubscribe.

Request fields

FieldTypeMeaning
TokenGuidOpaque Host-issued handle token. Keep it with its owner and resource type.
LoadInstanceIdGuidIdentity of the admitted load that owns this handle; it is not portable to a replacement load.
Cursorstring?Opaque continuation or observation cursor. Reuse only in the issuing query/scope; absence and invalidity are different. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.
ResyncRequiredboolDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.

Successful result

There is no result payload beyond the encoded Empty model. Check Success; an empty failure value is not successful completion.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Re-read after revision conflicts; cancellation does not prove rollback. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Events_UnsubscribeSubscription(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Events_UnsubscribeSubscription_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.

RegisterSubscription ​

EventSubscribeRequest → EventSubscriptionRegistration

PropertyContract
Local SDK method ID12
KindRegistration
Permissionnexa.events.write
Legal phasesInitialize
IdempotencyRequiredKey
Host statusMapped in recorded snapshot

Returns EventSubscriptionRegistration, carrying the subscription and registration identities explicitly. Retain the correct member for each cleanup API.

Request fields

FieldTypeMeaning
EventQualifiedIdIdentity or revision in this model’s domain; preserve ownership and exact spelling.
SchemaSchemaRefExact schema identity, version and fingerprint used to validate Value.
Cursorstring?Opaque continuation or observation cursor. Reuse only in the issuing query/scope; absence and invalidity are different. Nullable; omission is distinct from an empty value. No implicit default is promised by this type.
HandlerulongCallback identifier registered by this plugin. A handler alone is not a public action or provider registration.
IgnoreSelfboolDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
DeduplicateboolDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.
ScopeScopedTargetExplicit target scope. The Host checks that the caller is authorized for it.
LifetimeSubscriptionLifetimeUse an exact enum member listed in the reference. The Host can support a subset for a particular operation.
ReentryReentryPolicyUse an exact enum member listed in the reference. The Host can support a subset for a particular operation.
QueueLimitlongDomain value named by this field; additional accepted values and bounds are determined by the operation and Host policy.

Successful result

Decode the exact output model after Success. Preserve its identities, revision and schema metadata for subsequent domain operations.

Failure and retry

Unavailable capability, denied permission, wrong phase, malformed schema or foreign ownership fails the call. Supply a key for the intended effect and retain that key and inputs while resolving an uncertain reply. Do not retry with changed inputs under the same key. Preserve structured errors; see recovery guidance.

C binding (call fragment; the caller supplies the encoded request and buffers):

c
nx_Events_RegisterSubscription(&reply, request, &options);

The next resume receives the reply. Check nx_reply_success before nx_Events_RegisterSubscription_result. See the complete continuation example and Wasm ownership rules. This fragment is not a standalone guest.


来源: NexaCL-Plugin-SDK · Apache-2.0.

Site documentation: CC BY-SA 4.0. Imported SDK documents: Apache-2.0 as marked.