Crate jetstream_macros

Crate jetstream_macros 

Source
Expand description

§JetStream Derive

This crate provides macros for JetStream.

§service

The service macro is used to define a JetStream service.

§Basic Usage

#[service]
pub trait Echo {
    async fn ping(&mut self, message: String) -> Result<String, Error>;
}

§Tracing Support

Add distributed tracing to your services using the tracing crate:

#[service(tracing)]  // Auto-instrument all methods
pub trait Echo {
    // Custom instrumentation
    #[instrument(skip(self), fields(msg_len = message.len()))]
    async fn ping(&mut self, message: String) -> Result<String, Error>;
}

See the Tracing Guide for detailed documentation on tracing support.

§JetStreamWireFormat

The JetStreamWireFormat macro is used to derive the WireFormat trait for a struct.

Attribute Macros§

service
Service attribute macro for creating RPC services

Derive Macros§

JetStreamWireFormat
Derives wire format encoding for structs