subspace_farmer::cluster::nats_client

Trait GenericStreamRequest

source
pub trait GenericStreamRequest:
    Encode
    + Decode
    + Debug
    + Send
    + Sync
    + 'static {
    type Response: Encode + Decode + Debug + Send + Sync + 'static;

    const SUBJECT: &'static str;
}
Expand description

Generic stream request where response is streamed using NatsClient::stream_request_responder.

Used for cases where a large payload that doesn’t fit into NATS message needs to be sent or there is a very large number of messages to send. For simple request/response patten GenericRequest can be used instead.

Required Associated Constants§

source

const SUBJECT: &'static str

Request subject with optional * in place of application instance to receive the request

Required Associated Types§

source

type Response: Encode + Decode + Debug + Send + Sync + 'static

Response type that corresponds to this stream request.

These responses are send as a stream of messages, each message must fit into NATS message, NatsClient::approximate_max_message_size() can be used to estimate appropriate message size in case chunking is needed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§