Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 3.15 KB

README.md

File metadata and controls

62 lines (47 loc) · 3.15 KB

Synadia      NATS

JNATS JetStream Publisher Extensions

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

Artifact License Apache 2 Maven Central javadoc

PublishRetrier

This class parallels the standard JetStream publish api with methods that will retry the publish. The examples:

AsyncJsPublisher

This class is a full async message publish manager that provides:

  1. Publishing a message async
    • The number of inflight messages (published but not received acks) can be set.
  2. Queueing and tracking of the inflight PublishAck future
  3. 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

Notes

  1. A reminder, that if publish order is a requirement, it's best to use synchronous publishing.
  2. 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.