Extensions specific to JetStream publishing.
Current Release: 0.4.1
Current Snapshot: 0.4.2-SNAPSHOT
Gradle and Maven io.synadia:jnats-js-publish-extensions
Dependencies Help
This class parallels the standard JetStream publish api with methods that will retry the publish. The examples:
-
The Publish Retrier Sync Example demonstrates publishing synchronously with the retrier.
-
The Publish Retrier Async Example demonstrates publishing asynchronously with the retrier.
This class is a full async message publish manager that provides:
- Publishing a message async
- The number of inflight messages (published but not received acks) can be set.
- Queueing and tracking of the inflight PublishAck future
- The ability to observe the queue and respond to events
- The message was published
- The message received a valid ack
- The publish completed with an exception
- The publish timed out.
- Publishing was paused or resumed due to threshold settings
It can be combined with the retrier. You must consider that when publishing async in this manner it's possible for messages to be published out of order. In that case you can use publish expectations. If order of messages is a requirement, you
-
The Async Js Publisher Example demonstrates basic use of the class.
-
The Async Js Publisher Custom Threads Example has the identical workflow, but demonstrates the ability to provide the executors and threads manually instead of relying on the built-in ones.
- A reminder, that if publish order is a requirement, it's best to use synchronous publishing.
- With the AsyncJsPublisher, it is easy to flood the server and receive a 429 Too Many Messages so you must tune the queue size for this. On my 5 yr old Windows machine against a non-cluster single server, that number seems to be about 50,000 See the examples.
Copyright (c) 2024-2025 Synadia Communications Inc. All Rights Reserved. See LICENSE and NOTICE file for details.