Creates an instance of ArvoEvent with CloudEvent context, data, and optional extensions.
The CloudEvent context combined with required Arvo and OpenTelemetry extensions
The event data payload (must be JSON serializable)
Optionalextensions: TExtensionOptional additional custom extensions with lowercase alphanumeric keys
If datacontenttype is "application/cloudevents+json;charset=UTF-8;profile=arvo" but the 'to' field is not defined
const event = new ArvoEvent(
{
id: 'event-123',
source: 'https://example.com/service',
type: 'com.example.user.created',
subject: 'https://example.com/users/123',
time: new Date().toISOString(),
specversion: '1.0',
datacontenttype: 'application/cloudevents+json;charset=UTF-8;profile=arvo',
dataschema: null,
to: 'com.example.user.processor',
accesscontrol: 'role:admin;department:hr',
redirectto: null,
executionunits: 10,
parentid: 'parent-event-456',
domain: 'analytics',
traceparent: '00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01',
tracestate: 'vendor=trace-data'
},
{ userId: '123', name: 'John Doe' }
);
ReadonlydataThe event data payload as a JSON serializable object
ReadonlydatacontenttypeContent type of the data value following RFC 2046 format. Must contain 'application/cloudevents+json' or 'application/json'. Defaults to 'application/cloudevents+json;charset=UTF-8;profile=arvo'.
ReadonlydataschemaURI identifying the schema that the data adheres to. Must be a properly encoded URI if present, null otherwise.
ReadonlyidUnique identifier of the event
ReadonlysourceURI reference identifying the context in which the event happened. Must be a properly encoded URI representing the event producer.
ReadonlyspecversionThe version of the CloudEvents specification which the event uses. Must be '1.0' for this version of the specification.
ReadonlysubjectIdentifies the subject of the event in the context of the event producer. In Arvo, this must be the Process ID and must be a properly encoded URI.
ReadonlytimeTimestamp of when the occurrence happened in RFC 3339 format. If the actual occurrence time cannot be determined, this may be set to another time (such as current time) by the producer.
ReadonlytypeDescribes the type of event related to the originating occurrence. Must follow reverse-DNS naming convention (e.g., 'com.example.service.eventtype').
Gets the access control information for the event. Can contain:
Gets the CloudEvent-specified fields separated into default attributes and extensions.
An object containing:
default: Standard CloudEvent attributes (id, source, specversion, type, subject, datacontenttype, dataschema, data, time)extensions: All extension attributes including:
Gets the processing domain for event routing and workflow orchestration.
Gets the execution units representing the cost associated with generating this event. Used for tracking financial impact and resource utilization in cloud-based systems.
Gets only the custom extensions (TExtension) added to the ArvoEvent, excluding the standard Arvo and OpenTelemetry extensions.
The custom extensions object with Arvo and OpenTelemetry fields removed
Gets OpenTelemetry attributes derived from the ArvoEvent for distributed tracing.
An object containing OpenTelemetry semantic convention attributes:
The attributes follow the OpenTelemetry semantic conventions for CloudEvents as specified in the official documentation: https://opentelemetry.io/docs/specs/semconv/attributes-registry/cloudevents/
Gets the unique identifier of the event that directly triggered the creation of this event within the Arvo ecosystem. Establishes direct causal relationships for event lineage tracking. Null indicates an initiating event or generation outside direct causation.
Gets the alternative recipient or destination for dynamic routing. Enables complex workflows and conditional event routing.
Gets the target consumer machine for event routing.
Gets the OpenTelemetry traceparent header containing trace context information including trace ID, parent span ID, and trace flags for distributed tracing across services.
Gets the OpenTelemetry tracestate header containing vendor-specific trace information as key-value pairs propagated alongside traceparent in distributed tracing scenarios.
Converts the ArvoEvent to a JSON-serializable object by combining all CloudEvent default fields with all extensions into a single flat object.
A flat object containing all CloudEvent fields and extensions, suitable for JSON serialization and network transmission
Converts the ArvoEvent to a JSON string representation.
The number of spaces to use for indentation (default: 0 for compact output)
A JSON string representation of the complete ArvoEvent
Represents an ArvoEvent, which extends the CloudEvent specification with Arvo-specific extensions for event routing, access control, execution metrics, and OpenTelemetry distributed tracing support.