nats-io / jetstream

JetStream Utilities
Apache License 2.0
455 stars 44 forks source link

does jetstream support message delay? #417

Closed alifpay closed 3 years ago

alifpay commented 3 years ago

Is it possible publish/subscribe message with time delay.. ?

Message timers let you specify an initial invisibility period for a message added to a queue. For example, if you send a message with a 45-second timer, the message isn't visible to consumers for its first 45 seconds in the queue. The default (minimum) delay for a message is 0 seconds.

ripienaar commented 3 years ago

no we dont have such a feature, mind explaining the use case a bit?

alifpay commented 3 years ago

We have an external API, sometimes it doesn't respond, after a while we try to send it again ... if our app is in one replica, that's not a problem, we get from the database and send it. but if we have more than one replica, the request will be more than one and it is problem..

https://github.com/nats-io/nats-streaming-server/issues/324

ripienaar commented 3 years ago

You can use the duplicate tracking in jetstream to allow multiple publishes but only 1 going into the stream, would that not address the concern of the more than 1 replica?

alifpay commented 3 years ago

it is OK! We are using Queue Subscribe in nats streaming, but need a message to delay.. I tested with nats streaming to resend. it is very fast and it is very overwhelmed.