Struct nats::jetstream::JetStream

source ·
pub struct JetStream { /* private fields */ }
Expand description

A context for performing JetStream operations.

Implementations

Create a new JetStream context.

Publishes a message to JetStream

Publishes a message to JetStream with the given options.

Publishes a Message to JetStream.

Publishes a Message to JetStream with the given options.

Create an ephemeral push consumer subscription.

Example
let subscription = context.subscribe("ephemeral")?;
println!("Received message {:?}", subscription.next());

Creates a pull subscription.

Example
  context.publish("next", b"foo")?;
}
let consumer = context.pull_subscribe("next")?;

consumer.fetch_with_handler(10, |message| {
    println!("received message: {:?}", message);
    Ok(())
})?;

Creates a PullSubscription with options.

Creates a push consumer subscription with options.

If said consumer is named and already exists, this will attempt to bind this consumer to that one, else will attempt to create a new internally managed consumer resource.

Example
let sub = js.subscribe_with_options("foo", &SubscribeOptions::bind("existing_stream".to_string(), "existing_consumer".to_string()))?;

Creates a push-based consumer subscription with a queue group. The queue group will be used as the durable name.

Example
let subscription = context.queue_subscribe("queue", "queue_group")?;

Creates a push-based consumer subscription with a queue group and options.

If a durable name is not set within the options provided options then the queue group will be used as the durable name.

Create a JetStream stream.

Update a JetStream stream.

List all JetStream stream names. If you also want stream information, use the list_streams method instead.

List all JetStream streams.

List JetStream consumers for a stream.

Query JetStream stream information.

Purge JetStream stream messages.

Purge stream messages matching a subject.

Get a message from a stream.

Get the last message from a stream by subject

Delete message in a JetStream stream.

Delete JetStream stream.

Create a JetStream consumer.

Delete a JetStream consumer.

Query JetStream consumer information.

Query JetStream account information.

Available on crate feature unstable only.

Bind to an existing key-value store bucket.

Example
context.create_key_value(&Config {
  bucket: "key_value".to_string(),
  ..Default::default()
})?;

let key_value = context.key_value("key_value")?;
Available on crate feature unstable only.

Create a new key-value store bucket.

Examples
let bucket = context.create_key_value(&Config {
  bucket: "create_key_value".to_string(),
  ..Default::default()
})?;
Available on crate feature unstable only.

Delete the specified key value store bucket.

Example
use nats::kv::Config;

context.delete_key_value("delete_key_value")?;
Available on crate feature unstable only.

Creates a new object store bucket.

Example
let bucket = context.create_object_store(&Config {
  bucket: "create_object_store".to_string(),
  ..Default::default()
})?;
Available on crate feature unstable only.

Bind to an existing object store bucket.

Example
context.create_object_store(&Config {
  bucket: "object_store".to_string(),
  ..Default::default()
})?;

let bucket = context.object_store("object_store")?;
Available on crate feature unstable only.

Delete the underlying stream for the named object.

Example
use nats::object_store::Config;

context.delete_object_store("delete_object_store")?;

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.