Quarkus NATS Jetstream Client
This extension provides a reactive client for NATS JetStream inside a Quarkus App, in JVM and Native mode. It does not depend on Reactive Messaging.
The client and configuration were significantly reworked after version 3.38.0. If you are using 3.38.0
or earlier, see the
3.38.0 documentation
instead of this page.
|
Installation
Add the io.quarkiverse.reactivemessaging.nats-jetstream:quarkus-nats-jetstream-client extension to your build file.
For instance, with Maven, add the following dependency to your POM file:
<dependency>
<groupId>io.quarkiverse.reactivemessaging.nats-jetstream</groupId>
<artifactId>quarkus-nats-jetstream-client</artifactId>
<version>4.0.0.Beta2</version>
</dependency>
To consume and publish through SmallRye Reactive Messaging channels, use the quarkus-messaging-nats-jetstream extension instead, which builds on this one.
Injecting the JetStream Client
Each configured datasource (see the "Datasources" section below) is exposed as an @ApplicationScoped CDI bean of
type io.quarkiverse.reactive.messaging.nats.jetstream.client.Client. The extension creates and registers these
beans itself - there is nothing to produce or configure - and closes them automatically on application shutdown.
You can inject a Client wherever you need direct access to the NATS JetStream API, for example to reach the
Key/Value or Object store (see below) or to publish/subscribe.
For the default (unnamed) datasource, inject it directly with a plain, unqualified Client:
@Inject Client client;
For an additional, named datasource configured under quarkus.messaging.nats.data-sources.[datasource-name],
qualify the injection point with @Identifier("[datasource-name]"):
import io.smallrye.common.annotation.Identifier;
@Inject
@Identifier("orders-db")
Client client;
If the datasource to use is only known at runtime, inject @Any Instance<Client> clients and resolve it by name
yourself, for instance with SmallRye’s CDIUtils.getInstanceById(clients, datasourceName).
Using NATS Key/Value store
If you want to use the Key/Value store in NATS, then configure your application as follows:
quarkus.messaging.nats.connection.servers=nats://localhost:4242 quarkus.messaging.nats.connection.username=guest quarkus.messaging.nats.connection.password=guest # Creates a "test" bucket stored in memory. This part is optional. If you already have created a bucket on NATS # then this configuration is redundant. quarkus.messaging.nats.key-values.test.bucket-name=test quarkus.messaging.nats.key-values.test.storage-type=Memory quarkus.messaging.nats.key-values.test.description=Test bucket
Then your application can use the Key/Value store like this, through Client.keyValue(bucketName):
@Path("/key-value")
@RequestScoped
class KeyValueStoreResource {
private final Client client;
@Inject
public KeyValueStoreResource(Client client) {
this.client = client;
}
@GET
@Path("{key}")
public Uni<byte[]> getValue(@PathParam("key") String key) {
return client.keyValue("test").get(key).onItem().transform(entry -> entry.value().orElse(null));
}
@PUT
@Path("{key}")
@Consumes("application/octet-stream")
public Uni<Void> putValue(@PathParam("key") String key, byte[] value) {
return client.keyValue("test").put(key, value).replaceWithVoid();
}
@DELETE
@Path("{key}")
public Uni<Void> deleteValue(@PathParam("key") String key) {
return client.keyValue("test").delete(key);
}
}
Per-entry TTL
Buckets configured with limit-marker-ttl accept per-entry TTLs (requires NATS server 2.11+). create and purge
have overloads taking a Duration:
client.keyValue("cache").create(key, value, Duration.ofMinutes(5));
client.keyValue("cache").purge(key, Duration.ofMinutes(1));
The server only supports whole-second TTLs, so the duration is rounded up to the next second.
Using NATS Object Store
If you want to use the Object store in NATS, then configure your application as follows:
quarkus.messaging.nats.connection.servers=nats://localhost:4242 quarkus.messaging.nats.connection.username=guest quarkus.messaging.nats.connection.password=guest # Creates a "test" object store. This part is optional. If you already have created the bucket on NATS # then this configuration is redundant. quarkus.messaging.nats.object-stores.test.bucket-name=test quarkus.messaging.nats.object-stores.test.description=Test object store
Then your application can use the Object store like this, through Client.objectStore(bucketName):
@Path("/object-store")
@RequestScoped
class ObjectStoreResource {
private final Client client;
@Inject
public ObjectStoreResource(Client client) {
this.client = client;
}
@GET
@Path("{name}")
public Uni<byte[]> getObject(@PathParam("name") String name) {
return client.objectStore("test").get(name).onItem().transform(ObjectEntry::data);
}
@PUT
@Path("{name}")
@Consumes("application/octet-stream")
public Uni<Void> putObject(@PathParam("name") String name, byte[] data) {
return client.objectStore("test").put(name, data).replaceWithVoid();
}
@DELETE
@Path("{name}")
public Uni<Void> deleteObject(@PathParam("name") String name) {
return client.objectStore("test").delete(name).replaceWithVoid();
}
}
Serializing Java Objects
By default, Java objects are serialized using java.io.* streams. If either the quarkus-jackson or
quarkus-jsonb dependency is present, objects are serialized as JSON instead.
To use a custom serializer, set the build-time property quarkus.messaging.nats.serializer to the
fully-qualified class name of a class that implements
io.quarkiverse.reactive.messaging.nats.jetstream.client.message.Serializer. The default value is
io.quarkiverse.reactive.messaging.nats.jetstream.client.message.JacksonSerializer.
quarkus.messaging.nats.serializer=com.example.MySerializer
Open Telemetry Tracing
To use Open Telemetry tracing, add the quarkus-opentelemetry dependency. Spans follow the
OpenTelemetry messaging semantic conventions
as implemented by the OpenTelemetry instrumentation API bundled with Quarkus, so they look like the spans of the
other Quarkus messaging extensions.
| Span | Kind | Created when |
|---|---|---|
|
|
A message is published. The span covers the publish until JetStream acknowledged it, and records the failure when publishing fails. |
|
|
A message is pulled on demand with |
The trace context of the publisher is propagated in the message headers. It is the parent of the receive
spans, and is also added to them as a span link.
Besides the standard messaging.* attributes (messaging.system is nats, messaging.destination.name is the
subject, messaging.message.id the message id and messaging.message.conversation_id the request/reply correlation
id), spans carry NATS JetStream specific attributes:
-
messaging.nats.stream.name -
messaging.nats.consumer.name,messaging.nats.stream.sequence,messaging.nats.consumer.sequenceandmessaging.nats.message.delivered_counton received messages
The message payload is not recorded, since it may contain sensitive data and can be arbitrarily large. It can be
recorded as the messaging.nats.message.payload attribute with:
quarkus.messaging.nats.trace-payload=true
Configuration
The stream, consumer, key-value store and object store configurations are all optional. Each declared entry is created on NATS if it does not already exist (addIfAbsent); if the configuration for a given name is omitted entirely, it is assumed to already exist on NATS.
| Property Name | Description | Type | Default Value |
|---|---|---|---|
quarkus.messaging.nats.connection.servers |
A comma-separated list of URI’s nats://{host}:{port} to use for establishing the initial connection to the NATS cluster. |
String |
nats://localhost:4222 |
quarkus.messaging.nats.connection.username |
The username to connect to the NATS server |
String |
|
quarkus.messaging.nats.connection.password |
The password to connect to the NATS server |
String |
|
quarkus.messaging.nats.connection.token |
The token to connect to the NATS server |
String |
|
quarkus.messaging.nats.connection.credential-path |
The path to the credentials file to connect to the NATS server |
String |
|
quarkus.messaging.nats.connection.connection-timeout |
The connection timeout |
Duration |
|
quarkus.messaging.nats.connection.error-listener |
The classname for the error listener |
String |
|
quarkus.messaging.nats.connection.buffer-size |
The size in bytes to make buffers for connections |
Integer |
|
quarkus.messaging.nats.connection.tls-algorithm |
The TLS algorithm |
String |
|
quarkus.messaging.nats.connection.connection-attempts |
The maximum number of attempts to attempt to re-connect to NATS |
Integer |
-1 (unlimited) |
quarkus.messaging.nats.connection.connection-backoff |
Back-off delay between to attempt to re-connect to NATS |
Duration |
1s |
quarkus.messaging.nats.connection.tls-configuration-name |
The name of the TLS configuration (bucket) used for client authentication in the TLS registry |
String |
|
quarkus.messaging.nats.connection.inbox-prefix |
Retrieves the optional inbox prefix used for communication. The inbox prefix allows customization of the subscriber’s inbox name. |
String |
Every datasource’s Client owns a thread pool, shut down when the client is closed. The blocking calls of the client
run on this pool: publishing a message (sending it and waiting for the JetStream acknowledgement), next and fetch,
and managing streams, consumers, key-value stores and object stores. They therefore do not take the threads of the
Quarkus worker pool. Threads are started on demand up to the maximum size before tasks are queued.
Alternatively, with quarkus.messaging.nats.thread-pool.virtual-threads=true, every blocking call runs on a new
virtual thread. The pool then has no size limit and no queue, so the size, queue and keep alive properties are
ignored.
| Property Name | Description | Type | Default Value |
|---|---|---|---|
quarkus.messaging.nats.thread-pool.virtual-threads |
Whether every blocking call runs on a new virtual thread instead of a pooled platform thread |
Boolean |
false |
quarkus.messaging.nats.thread-pool.core-size |
The number of threads kept in the pool, even when they are idle |
Integer |
1 |
quarkus.messaging.nats.thread-pool.max-size |
The maximum number of threads in the pool |
Integer |
8 x available processors |
quarkus.messaging.nats.thread-pool.queue-size |
The maximum number of tasks waiting for a thread when all threads are busy. A publish submitted when the queue is full is rejected, and the message is not acknowledged. |
Integer |
unbounded |
quarkus.messaging.nats.thread-pool.keep-alive |
How long a thread above the core size may stay idle before it is stopped |
Duration |
30s |
quarkus.messaging.nats.thread-pool.shutdown-timeout |
How long closing the client waits for running tasks to complete before interrupting them |
Duration |
10s |
Datasources
The connection, streams, consumers, key-value stores and object stores configured directly under
quarkus.messaging.nats. (as shown in the table above, and in the tables below) belong to the *default
datasource. For symmetry with named datasources, the same properties can also be set under
quarkus.messaging.nats.default.* (for example quarkus.messaging.nats.default.connection.servers) - both
spellings are aliases for exactly the same configuration, so use whichever reads better in your application.
Additional, named datasources - each with their own connection, streams, consumers, key-value stores and object
stores - are configured under quarkus.messaging.nats.data-sources.[datasource-name], using the same property
shape as the default datasource:
quarkus.messaging.nats.data-sources.orders-db.connection.servers=nats://orders-nats:4222 quarkus.messaging.nats.data-sources.orders-db.streams.orders.name=orders quarkus.messaging.nats.data-sources.orders-db.streams.orders.subjects=orders.*
Every configured datasource - default and named - gets its own Client CDI bean; see "Injecting the JetStream
`Client`" above.
Each entry in the quarkus.messaging.nats.streams map is created (if absent) with [stream-name] as its map key; name must be set explicitly and is conventionally the same value as [stream-name].
| Property Name | Description | Type | Default Value |
|---|---|---|---|
quarkus.messaging.nats.streams.[stream-name].name |
The name of the stream |
String |
|
quarkus.messaging.nats.streams.[stream-name].retention-policy |
Declares the retention policy for the stream |
Limits, Interest or WorkQueue |
Interest |
quarkus.messaging.nats.streams.[stream-name].compression |
The compression used for stream data |
None or S2 |
None |
quarkus.messaging.nats.streams.[stream-name].storage-type |
The storage type for stream data |
File or Memory |
File |
quarkus.messaging.nats.streams.[stream-name].discard-policy |
The discard policy for this stream |
New or Old |
Old |
quarkus.messaging.nats.streams.[stream-name].description |
Description of the stream |
String |
|
quarkus.messaging.nats.streams.[stream-name].max-consumers |
The maximum number of consumers for this stream |
Long |
|
quarkus.messaging.nats.streams.[stream-name].max-messages |
The maximum number of messages for this stream |
Long |
|
quarkus.messaging.nats.streams.[stream-name].max-messages-per-subject |
The maximum number of messages per subject for this stream |
Long |
|
quarkus.messaging.nats.streams.[stream-name].max-bytes |
The maximum number of bytes for this stream |
Long |
|
quarkus.messaging.nats.streams.[stream-name].max-age |
The maximum message age for this stream |
Duration |
|
quarkus.messaging.nats.streams.[stream-name].maximum-message-size |
The maximum message size for this stream |
Integer |
|
quarkus.messaging.nats.streams.[stream-name].replicas |
The number of replicas a message must be stored on |
Integer |
1 |
quarkus.messaging.nats.streams.[stream-name].no-ack |
Whether acknowledgements are disabled for this stream |
Boolean |
true |
quarkus.messaging.nats.streams.[stream-name].template-owner |
The template json for this stream |
String |
|
quarkus.messaging.nats.streams.[stream-name].duplicate-window |
The duplicate checking window for the stream. |
Duration |
|
quarkus.messaging.nats.streams.[stream-name].subjects |
A comma separated list of the subject names bound to the stream |
String |
|
quarkus.messaging.nats.streams.[stream-name].placement |
Placement directives to consider when placing replicas of this stream, as a nested group ( |
Group |
|
quarkus.messaging.nats.streams.[stream-name].republish |
Republish configuration, as a nested group ( |
Group |
|
quarkus.messaging.nats.streams.[stream-name].subject-transform |
Subject transform applied to the stream, as a nested group ( |
Group |
|
quarkus.messaging.nats.streams.[stream-name].consumer-limits |
Default limits applied to consumers of this stream, as a nested group ( |
Group |
|
quarkus.messaging.nats.streams.[stream-name].mirror |
Configures this stream to mirror another stream, as a nested group ( |
Group |
|
quarkus.messaging.nats.streams.[stream-name].sources.[n] |
Sources this stream from one or more other streams; each entry has the same shape as |
List of Group |
|
quarkus.messaging.nats.streams.[stream-name].sealed |
Whether the stream is sealed (no further changes to messages allowed) |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].allow-rollup |
Whether the stream allows rollup |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].allow-direct |
Whether the stream allows direct message access |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].mirror-direct |
Whether the stream allows higher performance and unified direct access for mirrors as well |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].deny-delete |
Whether message delete is denied for the stream |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].deny-purge |
Whether purge is denied for the stream |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].discard-new-per-subject |
Whether the discard-new policy with max messages per subject is applied per subject |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].first-sequence |
The first sequence used in the stream |
Long |
1 |
quarkus.messaging.nats.streams.[stream-name].subject-delete-marker-ttl |
The subject delete marker TTL |
Duration |
|
quarkus.messaging.nats.streams.[stream-name].allow-message-ttl |
Whether per-message TTL is allowed |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].allow-message-schedules |
Whether message schedules are allowed |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].allow-message-counter |
Whether the stream is a counter stream |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].allow-atomic-publish |
Whether atomic (batch) publish is allowed |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].allow-batched |
Whether batched publish is allowed |
Boolean |
false |
quarkus.messaging.nats.streams.[stream-name].persist-mode |
The persist mode used by the server when storing messages |
Default or Async |
Default |
quarkus.messaging.nats.streams.[stream-name].metadata.[key] |
Application-defined metadata for the stream |
Map<String, String> |
Consumer configuration
Unlike streams, consumers are configured as a single, flat map under quarkus.messaging.nats.consumers, each entry naming the stream it is bound to. Consumers are pull-based when only pull-options (or nothing) is set; push-options creates a push consumer.
| Property Name | Description | Type | Default Value |
|---|---|---|---|
quarkus.messaging.nats.consumers.[consumer-name].stream |
The name of the stream this consumer is bound to |
String |
|
quarkus.messaging.nats.consumers.[consumer-name].name |
The name of the consumer |
String |
|
quarkus.messaging.nats.consumers.[consumer-name].durable |
Set to true if the consumer should be durable |
Boolean |
false |
quarkus.messaging.nats.consumers.[consumer-name].description |
Description of the consumer |
String |
|
quarkus.messaging.nats.consumers.[consumer-name].filter-subject |
A subject that overlaps with the subjects bound to the stream to filter delivery to subscribers. Cannot be used together with |
String |
|
quarkus.messaging.nats.consumers.[consumer-name].filter-subjects |
A comma separated list of subjects that overlap with the subjects bound to the stream to filter delivery to subscribers. Cannot be used together with |
String |
|
quarkus.messaging.nats.consumers.[consumer-name].deliver-policy |
The point in the stream to receive messages from |
All, Last, New, ByStartSequence, ByStartTime or LastPerSubject |
All |
quarkus.messaging.nats.consumers.[consumer-name].start-sequence |
Used with the |
Long |
0 |
quarkus.messaging.nats.consumers.[consumer-name].start-time |
Used with the |
ZonedDateTime |
|
quarkus.messaging.nats.consumers.[consumer-name].acknowledge-wait |
The duration the server will wait for an ack for any individual message once it has been delivered to a consumer. If an ack is not received in time, the message will be redelivered |
Duration |
|
quarkus.messaging.nats.consumers.[consumer-name].inactive-threshold |
Duration that instructs the server to clean up the consumer once inactive for that long |
Duration |
|
quarkus.messaging.nats.consumers.[consumer-name].max-acknowledge-pending |
The maximum number of messages, without an acknowledgement, that can be outstanding |
Long |
|
quarkus.messaging.nats.consumers.[consumer-name].max-deliver |
The maximum number of times a specific message delivery will be attempted |
Long |
|
quarkus.messaging.nats.consumers.[consumer-name].backoff |
A comma separated list of durations controlling the re-delivery of messages on acknowledgement timeout |
List of Duration |
|
quarkus.messaging.nats.consumers.[consumer-name].replay-policy |
Whether messages are replayed at the original publish rate ( |
Instant or Original |
Instant |
quarkus.messaging.nats.consumers.[consumer-name].replicas |
The number of replicas for the consumer’s state. Defaults to inheriting the number of replicas from the stream |
Integer |
|
quarkus.messaging.nats.consumers.[consumer-name].memory-storage |
If set, forces the consumer state to be kept in memory rather than inherit the storage type of the stream |
Boolean |
false |
quarkus.messaging.nats.consumers.[consumer-name].sample-frequency |
The percentage of acknowledgements to sample for observability, e.g. |
String |
|
quarkus.messaging.nats.consumers.[consumer-name].headers-only |
Delivers only the headers of messages, not the bodies |
Boolean |
false |
quarkus.messaging.nats.consumers.[consumer-name].pause-until |
The time until the consumer is paused |
ZonedDateTime |
|
quarkus.messaging.nats.consumers.[consumer-name].metadata.[key] |
Application-defined metadata for the consumer |
Map<String, String> |
|
quarkus.messaging.nats.consumers.[consumer-name].pull-options.max-waiting |
The number of pulls that can be outstanding on this pull consumer |
Long |
|
quarkus.messaging.nats.consumers.[consumer-name].pull-options.max-expires |
The max expire time the server allows on pull requests |
Duration |
|
quarkus.messaging.nats.consumers.[consumer-name].pull-options.max-batch |
The maximum batch size a single pull request can make |
Long |
|
quarkus.messaging.nats.consumers.[consumer-name].pull-options.max-bytes |
The maximum total bytes that can be requested in a given batch |
Long |
|
quarkus.messaging.nats.consumers.[consumer-name].push-options.deliver-subject |
The subject messages are pushed to |
String |
|
quarkus.messaging.nats.consumers.[consumer-name].push-options.deliver-group |
The optional deliver (queue) group to join |
String |
|
quarkus.messaging.nats.consumers.[consumer-name].push-options.flow-control |
Enables per-subscription flow control using a sliding-window protocol |
Boolean |
false |
quarkus.messaging.nats.consumers.[consumer-name].push-options.idle-heartbeat |
If set, the server regularly sends a status message while there are no new messages to send, so the client knows the service is still up |
Duration |
|
quarkus.messaging.nats.consumers.[consumer-name].push-options.rate-limit |
Used to throttle the delivery of messages to the consumer, in bits per second |
Long |
Key/Value Store configuration
Each entry in the quarkus.messaging.nats.key-values map is created (if absent) with [bucket-name] as its map key; bucket-name must be set explicitly and is conventionally the same value as [bucket-name].
| Property Name | Description | Type | Default Value |
|---|---|---|---|
quarkus.messaging.nats.key-values.[bucket-name].bucket-name |
The name of the bucket |
String |
|
quarkus.messaging.nats.key-values.[bucket-name].description |
Description of the Key/Value store |
String |
|
quarkus.messaging.nats.key-values.[bucket-name].storage-type |
The storage type |
File or Memory |
File |
quarkus.messaging.nats.key-values.[bucket-name].max-bucket-size |
The maximum number of bytes for this bucket |
Long |
|
quarkus.messaging.nats.key-values.[bucket-name].maximum-value-size |
The maximum size for an individual value in the bucket |
Integer |
|
quarkus.messaging.nats.key-values.[bucket-name].max-history-per-key |
The maximum amount of history for any one key, from 1 to 64 inclusive. Includes the current value |
Integer |
64 |
quarkus.messaging.nats.key-values.[bucket-name].ttl |
The maximum age for a value in this bucket |
Duration |
|
quarkus.messaging.nats.key-values.[bucket-name].limit-marker-ttl |
The limit marker TTL |
Duration |
|
quarkus.messaging.nats.key-values.[bucket-name].replicas |
The number of replicas for this bucket |
Integer |
1 |
quarkus.messaging.nats.key-values.[bucket-name].compression |
Whether to use compression |
Boolean |
false |
quarkus.messaging.nats.key-values.[bucket-name].republish |
Republish configuration, as a nested group ( |
Group |
|
quarkus.messaging.nats.key-values.[bucket-name].placement |
Placement directives to consider when placing replicas of this bucket, as a nested group ( |
Group |
|
quarkus.messaging.nats.key-values.[bucket-name].mirror |
Configures this bucket to mirror another bucket/stream; same shape as the stream’s |
Group |
|
quarkus.messaging.nats.key-values.[bucket-name].sources.[n] |
Sources this bucket from one or more other buckets/streams; same shape as the stream’s |
List of Group |
|
quarkus.messaging.nats.key-values.[bucket-name].metadata.[key] |
Application-defined metadata for the bucket |
Map<String, String> |
Object Store configuration
Each entry in the quarkus.messaging.nats.object-stores map is created (if absent) with [bucket-name] as its map key; bucket-name must be set explicitly and is conventionally the same value as [bucket-name].
| Property Name | Description | Type | Default Value |
|---|---|---|---|
quarkus.messaging.nats.object-stores.[bucket-name].bucket-name |
The name of the bucket |
String |
|
quarkus.messaging.nats.object-stores.[bucket-name].description |
Description of the object store |
String |
|
quarkus.messaging.nats.object-stores.[bucket-name].storage-type |
The storage type |
File or Memory |
File |
quarkus.messaging.nats.object-stores.[bucket-name].max-bucket-size |
The maximum number of bytes for this bucket |
Long |
|
quarkus.messaging.nats.object-stores.[bucket-name].ttl |
The maximum age for a value in this bucket |
Duration |
|
quarkus.messaging.nats.object-stores.[bucket-name].replicas |
The number of replicas for this bucket |
Integer |
1 |
quarkus.messaging.nats.object-stores.[bucket-name].compression |
Whether to use compression |
Boolean |
false |
quarkus.messaging.nats.object-stores.[bucket-name].placement |
Placement directives to consider when placing replicas of this bucket, as a nested group ( |
Group |
|
quarkus.messaging.nats.object-stores.[bucket-name].metadata.[key] |
Application-defined metadata for the bucket |
Map<String, String> |
Dev service configuration
| Property Name | Description | Type | Default Value |
|---|---|---|---|
quarkus.messaging.nats.devservices.port |
Fixed port the dev service will listen to |
Integer |
|
quarkus.messaging.nats.devservices.image-name |
The image to use |
String |
nats:2.11 |
quarkus.messaging.nats.devservices.shared |
Indicates if the NATS JetStream broker managed by Quarkus Dev Services is shared |
Boolean |
true |
quarkus.messaging.nats.devservices.service-name |
This property is used when you need multiple shared NATS JetStream brokers. |
String |
nats |
quarkus.messaging.nats.devservices.enabled |
If Dev Services for NATS JetStream has been explicitly enabled or disabled |
Boolean |
true |
quarkus.messaging.nats.devservices.tls-configuration.certificate-file |
The absolute path to the PEM certificate file |
String |
|
quarkus.messaging.nats.devservices.tls-configuration.key-file |
The absolute path to the PEM key file |
String |
Configuration reference
The complete reference of the extension’s quarkus.messaging.nats.* configuration properties, generated from
the extension sources.
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Type |
Default |
|---|---|---|
The fully-qualified class name of the serializer implementation used for message serialization and deserialization. The class must implement Environment variable: |
string |
|
If Dev Services for NATS JetStream has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing consumerConfiguration present. Environment variable: |
boolean |
|
Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly. Environment variable: |
int |
|
The image to use. Note that only NATS.io images are supported. Check NATS to find the available versions. Environment variable: |
string |
|
Indicates if the NATS JetStream broker managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for NATS JetStream starts a new container. The discovery uses the Container sharing is only used in dev mode. Environment variable: |
boolean |
|
The value of the This property is used when you need multiple shared NATS JetStream brokers. Environment variable: |
string |
|
Retrieves the username to be used for authenticating with the NATS JetStream broker. If not explicitly configured, the default value is "guest". Environment variable: |
string |
|
Returns the password to be used for authenticating with the NATS JetStream broker. If not explicitly configured, the default value is "guest". Environment variable: |
string |
|
The absolute path to the PEM certificate file. Environment variable: |
string |
required |
The absolut path to the PEM key file. Environment variable: |
string |
required |
A list of URI’s nats://{host}:{port} to use for establishing the initial connection to the NATS cluster. Environment variable: |
list of string |
required |
The username to connect to the NATS server Environment variable: |
string |
|
The password to connect to the NATS server Environment variable: |
string |
|
The token to connect to the NATS server Environment variable: |
string |
|
The connection timeout Environment variable: |
||
The maximum number of maximumReconnects to attempt to re-connect to NATS. -1 means unlimited. Environment variable: |
int |
|
The size in bytes to make buffers for connections Environment variable: |
int |
|
The tls algorithm. Default is Environment variable: |
string |
|
The name of the TLS configuration (bucket) used for client authentication in the TLS registry. Environment variable: |
string |
|
The path to the credentials file for creating an AuthHandler Environment variable: |
string |
|
Retrieves the optional inbox prefix used for communication. The inbox prefix allows customization of the subscriber’s inbox name. Environment variable: |
string |
|
Whether every task runs on a new virtual thread instead of a pooled platform thread. When enabled, the core size, max size, queue size and keep alive are ignored. Environment variable: |
boolean |
|
The number of threads kept in the pool, even when they are idle. Environment variable: |
int |
|
The maximum number of threads in the pool. Defaults to 8 times the number of available processors. Environment variable: |
int |
|
The maximum number of tasks waiting for a thread when all threads are busy. Unbounded when not set. A publish submitted when the queue is full is rejected, and the message is not acknowledged. Environment variable: |
int |
|
How long a thread above the core size may stay idle before it is stopped. Environment variable: |
|
|
How long closing the client waits for running tasks to complete before interrupting them. Environment variable: |
|
|
Whether the message payload is recorded as the Environment variable: |
boolean |
|
Retrieves the name as a non-null string. Environment variable: |
string |
required |
Gets the retention policy for this stream configuration. Environment variable: |
|
|
Gets the compression option for this stream configuration. Environment variable: |
|
|
Gets the storage type for this stream configuration. Environment variable: |
|
|
Gets the discard policy for this stream configuration. Environment variable: |
|
|
Gets the description of this stream configuration. Environment variable: |
string |
|
Gets the maximum number of consumers for this stream configuration. Environment variable: |
long |
|
Gets the maximum messages for this stream configuration. Environment variable: |
long |
|
Gets the maximum messages for this stream configuration. Environment variable: |
long |
|
Gets the maximum number of bytes for this stream configuration. Environment variable: |
long |
|
Gets the maximum message age for this stream configuration. Environment variable: |
||
Gets the maximum message size for this stream configuration. Environment variable: |
int |
|
Gets the number of replicas for this stream configuration. Environment variable: |
int |
|
Gets whether acknowledgements are required in this stream configuration. Environment variable: |
boolean |
|
Gets the template json for this stream configuration. Environment variable: |
string |
|
Gets the duplicate checking window stream configuration. Duration.ZERO means duplicate checking is not enabled. Environment variable: |
||
Gets the subjects for this stream configuration. Environment variable: |
list of string |
required |
The desired cluster name to place the stream. Environment variable: |
string |
|
Tags required on servers hosting this stream Environment variable: |
list of string |
required |
Get source, the Published subject matching filter Environment variable: |
string |
required |
Get destination, the RePublish Subject template Environment variable: |
string |
required |
Get headersOnly, Whether to RePublish only headers (no body) Environment variable: |
boolean |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
Maximum value for max_ack_pending for consumers of this stream. Acts as a default when consumers do not set this value. Environment variable: |
long |
|
Maximum value for inactive_threshold for consumers of this stream. Acts as a default when consumers do not set this value. Environment variable: |
||
Get the name of the source. Same as getName() Environment variable: |
string |
required |
Get the name of the source. Same as getSourceName() Environment variable: |
string |
required |
Get the configured start sequence Environment variable: |
long |
|
Get the configured start time Environment variable: |
||
Get the configured filter subject Environment variable: |
string |
|
The subject prefix that imports the other account Environment variable: |
string |
|
The delivery subject to use for the push consumer. Environment variable: |
string |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
The durable consumer name used for sourcing. Environment variable: |
string |
required |
The subject to deliver messages to. Environment variable: |
string |
required |
Get the name of the source. Same as getName() Environment variable: |
string |
required |
Get the name of the source. Same as getSourceName() Environment variable: |
string |
required |
Get the configured start sequence Environment variable: |
long |
|
Get the configured start time Environment variable: |
||
Get the configured filter subject Environment variable: |
string |
|
The subject prefix that imports the other account Environment variable: |
string |
|
The delivery subject to use for the push consumer. Environment variable: |
string |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
The durable consumer name used for sourcing. Environment variable: |
string |
required |
The subject to deliver messages to. Environment variable: |
string |
required |
Get the flag indicating if the stream is sealed. Environment variable: |
boolean |
|
Get the flag indicating if the stream allows rollup. Environment variable: |
boolean |
|
Get the flag indicating if the stream allows direct message access. Environment variable: |
boolean |
|
Get the flag indicating if the stream allows higher performance and unified direct access for mirrors as well. Environment variable: |
boolean |
|
Get the flag indicating if deny delete is set for the stream Environment variable: |
boolean |
|
Get the flag indicating if deny purge is set for the stream Environment variable: |
boolean |
|
Whether discard policy with max message per subject is applied per subject. Environment variable: |
boolean |
|
Metadata for the stream Environment variable: |
Map<String,String> |
|
The first sequence used in the stream. Environment variable: |
long |
|
Get the Subject Delete Marker TTL duration. May be null. Environment variable: |
||
Whether Allow Message TTL is set Environment variable: |
boolean |
|
Whether Allow Message Schedules is set Environment variable: |
boolean |
|
Whether Allow Message Counter is set Environment variable: |
boolean |
|
Whether Allow Atomic Publish is set Environment variable: |
boolean |
|
Whether Allow Batched is set Environment variable: |
boolean |
|
Gets the persist mode or null if it was not explicitly set when creating or the server did not send it with stream info Environment variable: |
|
|
Retrieves the name of the consumer. Environment variable: |
string |
required |
If set, clients can have subscriptions bind to the consumer and resume until the consumer is explicitly deleted. Environment variable: |
boolean |
|
A subject that overlaps with the subjects bound to the stream to filter delivery to subscribers. Note: This cannot be used with the filterSubjects field. Environment variable: |
string |
|
A set of subjects that overlap with the subjects bound to the stream to filter delivery to subscribers. Note: This cannot be used with the filterSubject field. Environment variable: |
list of string |
|
The duration that the server will wait for an acknowledge for any individual message once it has been delivered to a consumer. If an ack is not received in time; the message will be re-delivered. Environment variable: |
||
The point in the stream to receive messages from; either DeliverAll; DeliverLast; DeliverNew; DeliverByStartSequence; DeliverByStartTime; or DeliverLastPerSubject Environment variable: |
|
|
Used with the DeliverByStartSequence deliver policy. Environment variable: |
long |
|
Used with the DeliverByStartTime deliver policy. Environment variable: |
||
A description of the consumer. This can be particularly useful for ephemeral consumers to indicate their purpose since a durable name cannot be provided. Environment variable: |
string |
|
Duration that instructs the server to clean up consumers inactive for that long. Prior to 2.9; this only applied to ephemeral consumers. Environment variable: |
||
Defines the maximum number of messages; without acknowledgment; that can be outstanding. Once this limit is reached; message delivery will be suspended. This limit applies across all of the consumer’s bound subscriptions. A value of -1 means there can be any number of pending acknowledgments (i.e.; no flow control). The default is 1000. Environment variable: |
long |
|
The maximum number of times a specific message delivery will be attempted. Applies to any message that is re-sent due to acknowledgment policy (i.e.; due to a negative acknowledgment or no acknowledgment sent by the client). The default is -1 (redeliver until acknowledged). Messages that have reached the maximum delivery count will stay in the stream. Environment variable: |
long |
|
A sequence of delays controlling the re-delivery of messages on acknowledgment timeout (but not on nak). The sequence length must be less than or equal to MaxDeliver. If backoff is not set; a timeout will result in immediate re-delivery. E.g.; MaxDeliver=5 backoff=[5s; 30s; 300s; 3600s; 84000s] will re-deliver a message 5 times over one day. When MaxDeliver is larger than the backoff list; the last delay in the list will apply for the remaining deliveries. Note that backoff is NOT applied to naked messages. A nak will result in immediate re-delivery unless nakWithDelay is used to set the re-delivery delay explicitly. When BackOff is set; it overrides AckWait entirely. The first value in the BackOff determines the AckWait value. Environment variable: |
list of Duration |
|
If the policy is ReplayOriginal; the messages in the stream will be pushed to the client at the same rate they were originally received; simulating the original timing. If the policy is ReplayInstant (default); the messages will be pushed to the client as fast as possible while adhering to the acknowledgment policy; Max Ack Pending; and the client’s ability to consume those messages. Environment variable: |
|
|
Sets the number of replicas for the consumer’s state. By default; when the value is set to Optional.empty(); consumers inherit the number of replicas from the stream. Environment variable: |
int |
|
If set; forces the consumer state to be kept in memory rather than inherit the storage type of the stream (default is file storage). This reduces I/O from acknowledgments; useful for ephemeral consumers. Environment variable: |
boolean |
|
Sets the percentage of acknowledgments that should be sampled for observability; 0-100. This value is a string and allows both 30 and 30% as valid values. Environment variable: |
string |
|
A set of application-defined key-value pairs for associating metadata with the consumer. Environment variable: |
Map<String,String> |
|
Delivers only the headers of messages in the stream; adding a Nats-Msg-Size header indicating the size of the removed payload. Environment variable: |
boolean |
|
The time until the consumer is paused Environment variable: |
||
The number of pulls that can be outstanding on a pull consumer Environment variable: |
long |
|
The max amount of expire time for the server to allow on pull requests. Environment variable: |
||
The maximum batch size a single pull request can make. When set with MaxRequestMaxBytes; the batch size will be constrained by whichever limit is hit first. Environment variable: |
long |
|
The maximum total bytes that can be requested in a given batch. When set with MaxRequestBatch; the batch size will be constrained by whichever limit is hit first. Environment variable: |
long |
|
The deliver subject Environment variable: |
string |
required |
Enables per-subscription flow control using a sliding-window protocol. This protocol relies on the server and client exchanging messages to regulate when and how many messages are pushed to the client. This one-to-one flow control mechanism works in tandem with the one-to-many flow control imposed by MaxAckPending across all subscriptions bound to a consumer Environment variable: |
boolean |
|
If the idle heartbeat period is set, the server will regularly send a status message to the client (i.e. when the period has elapsed) while there are no new messages to send. This lets the client know that the JetStream service is still up and running, even when there is no activity on the stream. The message status header will have a code of 100. Unlike FlowControl, it will have no reply to address. It may have a description such \"Idle Heartbeat\". Note that this heartbeat mechanism is all handled transparently by supported clients and does not need to be handled by the application Environment variable: |
||
Used to throttle the delivery of messages to the consumer, in bits per second. Environment variable: |
long |
|
The optional deliver group to join Environment variable: |
string |
|
Retrieves the name of the stream associated with this consumer. Environment variable: |
string |
required |
Gets the name of the bucket associated with this configuration. Environment variable: |
string |
required |
Gets the description of this bucket. Environment variable: |
string |
|
Gets the storage type for this bucket. Environment variable: |
|
|
Gets the maximum number of bytes for this bucket. Environment variable: |
long |
|
Gets the maximum size for an individual value in the bucket. Environment variable: |
int |
|
Get source, the Published subject matching filter Environment variable: |
string |
required |
Get destination, the RePublish Subject template Environment variable: |
string |
required |
Get headersOnly, Whether to RePublish only headers (no body) Environment variable: |
boolean |
|
Gets the maximum number of history for any one key. Includes the current value. Max History must be from 1 to 64 inclusive Environment variable: |
int |
|
Gets the maximum age for a value in this bucket. Environment variable: |
||
Gets the number of replicas for this stream configuration. Environment variable: |
int |
|
Indicates whether compression is enabled for this configuration. Environment variable: |
boolean |
|
The desired cluster name to place the stream. Environment variable: |
string |
|
Tags required on servers hosting this stream Environment variable: |
list of string |
required |
Retrieves the metadata associated with this configuration. The metadata is represented as a map where keys and values are both strings. Environment variable: |
Map<String,String> |
|
Get the name of the source. Same as getName() Environment variable: |
string |
required |
Get the name of the source. Same as getSourceName() Environment variable: |
string |
required |
Get the configured start sequence Environment variable: |
long |
|
Get the configured start time Environment variable: |
||
Get the configured filter subject Environment variable: |
string |
|
The subject prefix that imports the other account Environment variable: |
string |
|
The delivery subject to use for the push consumer. Environment variable: |
string |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
The durable consumer name used for sourcing. Environment variable: |
string |
required |
The subject to deliver messages to. Environment variable: |
string |
required |
Get the name of the source. Same as getName() Environment variable: |
string |
required |
Get the name of the source. Same as getSourceName() Environment variable: |
string |
required |
Get the configured start sequence Environment variable: |
long |
|
Get the configured start time Environment variable: |
||
Get the configured filter subject Environment variable: |
string |
|
The subject prefix that imports the other account Environment variable: |
string |
|
The delivery subject to use for the push consumer. Environment variable: |
string |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
The durable consumer name used for sourcing. Environment variable: |
string |
required |
The subject to deliver messages to. Environment variable: |
string |
required |
The limit marker ttl if set Environment variable: |
||
Gets the name of the bucket associated with this configuration. Environment variable: |
string |
required |
Provides an optional description for the object store configuration. Environment variable: |
string |
|
Retrieves the maximum allowable size, in bytes, for a single bucket in the object store configuration. This value determines the upper limit for the bucket’s capacity. Environment variable: |
long |
|
Retrieves the storage type for the object store configuration. This determines whether storage is file-based or memory-based. If not explicitly specified, the default storage type is Environment variable: |
|
|
Gets the maximum age for a value in this bucket. Environment variable: |
||
Gets the number of replicas for this stream configuration. Environment variable: |
int |
|
Indicates whether compression is enabled for this configuration. Environment variable: |
boolean |
|
The desired cluster name to place the stream. Environment variable: |
string |
|
Tags required on servers hosting this stream Environment variable: |
list of string |
required |
Retrieves the metadata associated with this configuration. The metadata is represented as a map where keys and values are both strings. Environment variable: |
Map<String,String> |
|
A list of URI’s nats://{host}:{port} to use for establishing the initial connection to the NATS cluster. Environment variable: |
list of string |
required |
The username to connect to the NATS server Environment variable: |
string |
|
The password to connect to the NATS server Environment variable: |
string |
|
The token to connect to the NATS server Environment variable: |
string |
|
The connection timeout Environment variable: |
||
The maximum number of maximumReconnects to attempt to re-connect to NATS. -1 means unlimited. Environment variable: |
int |
|
The size in bytes to make buffers for connections Environment variable: |
int |
|
The tls algorithm. Default is Environment variable: |
string |
|
The name of the TLS configuration (bucket) used for client authentication in the TLS registry. Environment variable: |
string |
|
The path to the credentials file for creating an AuthHandler Environment variable: |
string |
|
Retrieves the optional inbox prefix used for communication. The inbox prefix allows customization of the subscriber’s inbox name. Environment variable: |
string |
|
Whether every task runs on a new virtual thread instead of a pooled platform thread. When enabled, the core size, max size, queue size and keep alive are ignored. Environment variable: |
boolean |
|
The number of threads kept in the pool, even when they are idle. Environment variable: |
int |
|
The maximum number of threads in the pool. Defaults to 8 times the number of available processors. Environment variable: |
int |
|
The maximum number of tasks waiting for a thread when all threads are busy. Unbounded when not set. A publish submitted when the queue is full is rejected, and the message is not acknowledged. Environment variable: |
int |
|
How long a thread above the core size may stay idle before it is stopped. Environment variable: |
|
|
How long closing the client waits for running tasks to complete before interrupting them. Environment variable: |
|
|
Retrieves the name as a non-null string. Environment variable: |
string |
required |
Gets the retention policy for this stream configuration. Environment variable: |
|
|
Gets the compression option for this stream configuration. Environment variable: |
|
|
Gets the storage type for this stream configuration. Environment variable: |
|
|
Gets the discard policy for this stream configuration. Environment variable: |
|
|
Gets the description of this stream configuration. Environment variable: |
string |
|
Gets the maximum number of consumers for this stream configuration. Environment variable: |
long |
|
Gets the maximum messages for this stream configuration. Environment variable: |
long |
|
Gets the maximum messages for this stream configuration. Environment variable: |
long |
|
Gets the maximum number of bytes for this stream configuration. Environment variable: |
long |
|
Gets the maximum message age for this stream configuration. Environment variable: |
||
Gets the maximum message size for this stream configuration. Environment variable: |
int |
|
Gets the number of replicas for this stream configuration. Environment variable: |
int |
|
Gets whether acknowledgements are required in this stream configuration. Environment variable: |
boolean |
|
Gets the template json for this stream configuration. Environment variable: |
string |
|
Gets the duplicate checking window stream configuration. Duration.ZERO means duplicate checking is not enabled. Environment variable: |
||
Gets the subjects for this stream configuration. Environment variable: |
list of string |
required |
The desired cluster name to place the stream. Environment variable: |
string |
|
Tags required on servers hosting this stream Environment variable: |
list of string |
required |
Get source, the Published subject matching filter Environment variable: |
string |
required |
Get destination, the RePublish Subject template Environment variable: |
string |
required |
Get headersOnly, Whether to RePublish only headers (no body) Environment variable: |
boolean |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
Maximum value for max_ack_pending for consumers of this stream. Acts as a default when consumers do not set this value. Environment variable: |
long |
|
Maximum value for inactive_threshold for consumers of this stream. Acts as a default when consumers do not set this value. Environment variable: |
||
Get the name of the source. Same as getName() Environment variable: |
string |
required |
Get the name of the source. Same as getSourceName() Environment variable: |
string |
required |
Get the configured start sequence Environment variable: |
long |
|
Get the configured start time Environment variable: |
||
Get the configured filter subject Environment variable: |
string |
|
The subject prefix that imports the other account Environment variable: |
string |
|
The delivery subject to use for the push consumer. Environment variable: |
string |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
The durable consumer name used for sourcing. Environment variable: |
string |
required |
The subject to deliver messages to. Environment variable: |
string |
required |
Get the name of the source. Same as getName() Environment variable: |
string |
required |
Get the name of the source. Same as getSourceName() Environment variable: |
string |
required |
Get the configured start sequence Environment variable: |
long |
|
Get the configured start time Environment variable: |
||
Get the configured filter subject Environment variable: |
string |
|
The subject prefix that imports the other account Environment variable: |
string |
|
The delivery subject to use for the push consumer. Environment variable: |
string |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
The durable consumer name used for sourcing. Environment variable: |
string |
required |
The subject to deliver messages to. Environment variable: |
string |
required |
Get the flag indicating if the stream is sealed. Environment variable: |
boolean |
|
Get the flag indicating if the stream allows rollup. Environment variable: |
boolean |
|
Get the flag indicating if the stream allows direct message access. Environment variable: |
boolean |
|
Get the flag indicating if the stream allows higher performance and unified direct access for mirrors as well. Environment variable: |
boolean |
|
Get the flag indicating if deny delete is set for the stream Environment variable: |
boolean |
|
Get the flag indicating if deny purge is set for the stream Environment variable: |
boolean |
|
Whether discard policy with max message per subject is applied per subject. Environment variable: |
boolean |
|
Metadata for the stream Environment variable: |
Map<String,String> |
|
The first sequence used in the stream. Environment variable: |
long |
|
Get the Subject Delete Marker TTL duration. May be null. Environment variable: |
||
Whether Allow Message TTL is set Environment variable: |
boolean |
|
Whether Allow Message Schedules is set Environment variable: |
boolean |
|
Whether Allow Message Counter is set Environment variable: |
boolean |
|
Whether Allow Atomic Publish is set Environment variable: |
boolean |
|
Whether Allow Batched is set Environment variable: |
boolean |
|
Gets the persist mode or null if it was not explicitly set when creating or the server did not send it with stream info Environment variable: |
|
|
Retrieves the name of the consumer. Environment variable: |
string |
required |
If set, clients can have subscriptions bind to the consumer and resume until the consumer is explicitly deleted. Environment variable: |
boolean |
|
A subject that overlaps with the subjects bound to the stream to filter delivery to subscribers. Note: This cannot be used with the filterSubjects field. Environment variable: |
string |
|
A set of subjects that overlap with the subjects bound to the stream to filter delivery to subscribers. Note: This cannot be used with the filterSubject field. Environment variable: |
list of string |
|
The duration that the server will wait for an acknowledge for any individual message once it has been delivered to a consumer. If an ack is not received in time; the message will be re-delivered. Environment variable: |
||
The point in the stream to receive messages from; either DeliverAll; DeliverLast; DeliverNew; DeliverByStartSequence; DeliverByStartTime; or DeliverLastPerSubject Environment variable: |
|
|
Used with the DeliverByStartSequence deliver policy. Environment variable: |
long |
|
Used with the DeliverByStartTime deliver policy. Environment variable: |
||
A description of the consumer. This can be particularly useful for ephemeral consumers to indicate their purpose since a durable name cannot be provided. Environment variable: |
string |
|
Duration that instructs the server to clean up consumers inactive for that long. Prior to 2.9; this only applied to ephemeral consumers. Environment variable: |
||
Defines the maximum number of messages; without acknowledgment; that can be outstanding. Once this limit is reached; message delivery will be suspended. This limit applies across all of the consumer’s bound subscriptions. A value of -1 means there can be any number of pending acknowledgments (i.e.; no flow control). The default is 1000. Environment variable: |
long |
|
The maximum number of times a specific message delivery will be attempted. Applies to any message that is re-sent due to acknowledgment policy (i.e.; due to a negative acknowledgment or no acknowledgment sent by the client). The default is -1 (redeliver until acknowledged). Messages that have reached the maximum delivery count will stay in the stream. Environment variable: |
long |
|
A sequence of delays controlling the re-delivery of messages on acknowledgment timeout (but not on nak). The sequence length must be less than or equal to MaxDeliver. If backoff is not set; a timeout will result in immediate re-delivery. E.g.; MaxDeliver=5 backoff=[5s; 30s; 300s; 3600s; 84000s] will re-deliver a message 5 times over one day. When MaxDeliver is larger than the backoff list; the last delay in the list will apply for the remaining deliveries. Note that backoff is NOT applied to naked messages. A nak will result in immediate re-delivery unless nakWithDelay is used to set the re-delivery delay explicitly. When BackOff is set; it overrides AckWait entirely. The first value in the BackOff determines the AckWait value. Environment variable: |
list of Duration |
|
If the policy is ReplayOriginal; the messages in the stream will be pushed to the client at the same rate they were originally received; simulating the original timing. If the policy is ReplayInstant (default); the messages will be pushed to the client as fast as possible while adhering to the acknowledgment policy; Max Ack Pending; and the client’s ability to consume those messages. Environment variable: |
|
|
Sets the number of replicas for the consumer’s state. By default; when the value is set to Optional.empty(); consumers inherit the number of replicas from the stream. Environment variable: |
int |
|
If set; forces the consumer state to be kept in memory rather than inherit the storage type of the stream (default is file storage). This reduces I/O from acknowledgments; useful for ephemeral consumers. Environment variable: |
boolean |
|
Sets the percentage of acknowledgments that should be sampled for observability; 0-100. This value is a string and allows both 30 and 30% as valid values. Environment variable: |
string |
|
A set of application-defined key-value pairs for associating metadata with the consumer. Environment variable: |
Map<String,String> |
|
Delivers only the headers of messages in the stream; adding a Nats-Msg-Size header indicating the size of the removed payload. Environment variable: |
boolean |
|
The time until the consumer is paused Environment variable: |
||
The number of pulls that can be outstanding on a pull consumer Environment variable: |
long |
|
The max amount of expire time for the server to allow on pull requests. Environment variable: |
||
The maximum batch size a single pull request can make. When set with MaxRequestMaxBytes; the batch size will be constrained by whichever limit is hit first. Environment variable: |
long |
|
The maximum total bytes that can be requested in a given batch. When set with MaxRequestBatch; the batch size will be constrained by whichever limit is hit first. Environment variable: |
long |
|
The deliver subject Environment variable: |
string |
required |
Enables per-subscription flow control using a sliding-window protocol. This protocol relies on the server and client exchanging messages to regulate when and how many messages are pushed to the client. This one-to-one flow control mechanism works in tandem with the one-to-many flow control imposed by MaxAckPending across all subscriptions bound to a consumer Environment variable: |
boolean |
|
If the idle heartbeat period is set, the server will regularly send a status message to the client (i.e. when the period has elapsed) while there are no new messages to send. This lets the client know that the JetStream service is still up and running, even when there is no activity on the stream. The message status header will have a code of 100. Unlike FlowControl, it will have no reply to address. It may have a description such \"Idle Heartbeat\". Note that this heartbeat mechanism is all handled transparently by supported clients and does not need to be handled by the application Environment variable: |
||
Used to throttle the delivery of messages to the consumer, in bits per second. Environment variable: |
long |
|
The optional deliver group to join Environment variable: |
string |
|
Retrieves the name of the stream associated with this consumer. Environment variable: |
string |
required |
Gets the name of the bucket associated with this configuration. Environment variable: |
string |
required |
Gets the description of this bucket. Environment variable: |
string |
|
Gets the storage type for this bucket. Environment variable: |
|
|
Gets the maximum number of bytes for this bucket. Environment variable: |
long |
|
Gets the maximum size for an individual value in the bucket. Environment variable: |
int |
|
Get source, the Published subject matching filter Environment variable: |
string |
required |
Get destination, the RePublish Subject template Environment variable: |
string |
required |
Get headersOnly, Whether to RePublish only headers (no body) Environment variable: |
boolean |
|
Gets the maximum number of history for any one key. Includes the current value. Max History must be from 1 to 64 inclusive Environment variable: |
int |
|
Gets the maximum age for a value in this bucket. Environment variable: |
||
Gets the number of replicas for this stream configuration. Environment variable: |
int |
|
Indicates whether compression is enabled for this configuration. Environment variable: |
boolean |
|
The desired cluster name to place the stream. Environment variable: |
string |
|
Tags required on servers hosting this stream Environment variable: |
list of string |
required |
Retrieves the metadata associated with this configuration. The metadata is represented as a map where keys and values are both strings. Environment variable: |
Map<String,String> |
|
Get the name of the source. Same as getName() Environment variable: |
string |
required |
Get the name of the source. Same as getSourceName() Environment variable: |
string |
required |
Get the configured start sequence Environment variable: |
long |
|
Get the configured start time Environment variable: |
||
Get the configured filter subject Environment variable: |
string |
|
The subject prefix that imports the other account Environment variable: |
string |
|
The delivery subject to use for the push consumer. Environment variable: |
string |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
The durable consumer name used for sourcing. Environment variable: |
string |
required |
The subject to deliver messages to. Environment variable: |
string |
required |
Get the name of the source. Same as getName() Environment variable: |
string |
required |
Get the name of the source. Same as getSourceName() Environment variable: |
string |
required |
Get the configured start sequence Environment variable: |
long |
|
Get the configured start time Environment variable: |
||
Get the configured filter subject Environment variable: |
string |
|
The subject prefix that imports the other account Environment variable: |
string |
|
The delivery subject to use for the push consumer. Environment variable: |
string |
|
Get source, the subject matching filter Environment variable: |
string |
required |
Get destination, the SubjectTransform Subject template Environment variable: |
string |
required |
The durable consumer name used for sourcing. Environment variable: |
string |
required |
The subject to deliver messages to. Environment variable: |
string |
required |
The limit marker ttl if set Environment variable: |
||
Gets the name of the bucket associated with this configuration. Environment variable: |
string |
required |
Provides an optional description for the object store configuration. Environment variable: |
string |
|
Retrieves the maximum allowable size, in bytes, for a single bucket in the object store configuration. This value determines the upper limit for the bucket’s capacity. Environment variable: |
long |
|
Retrieves the storage type for the object store configuration. This determines whether storage is file-based or memory-based. If not explicitly specified, the default storage type is Environment variable: |
|
|
Gets the maximum age for a value in this bucket. Environment variable: |
||
Gets the number of replicas for this stream configuration. Environment variable: |
int |
|
Indicates whether compression is enabled for this configuration. Environment variable: |
boolean |
|
The desired cluster name to place the stream. Environment variable: |
string |
|
Tags required on servers hosting this stream Environment variable: |
list of string |
required |
Retrieves the metadata associated with this configuration. The metadata is represented as a map where keys and values are both strings. Environment variable: |
Map<String,String> |
|
About the Duration format
To write duration values, use the standard You can also use a simplified format, starting with a number:
In other cases, the simplified format is translated to the
|