class
NATS::JetStream::PullSubscription
- NATS::JetStream::PullSubscription
- Reference
- Object
Defined in:
jetstream/pull_subscription.crConstructors
Instance Method Summary
-
#ack_next(msg : Message, timeout : Time::Span = 2.seconds)
Acknowledge the given message and request the next in a single round trip to the server to save latency.
-
#ack_next(msg : Message, count : Int, timeout : Time::Span = 2.seconds, no_wait : Bool = false)
Acknowledge the given message and request the next
countmessages in a single round trip to the server to save latency. - #close
- #closed? : Bool
- #consumer : Consumer
- #fetch(timeout : Time::Span = 2.seconds)
-
#fetch(message_count : Int, timeout : Time::Span = 2.seconds, no_wait : Bool = false, max_bytes : Int | Nil = nil) : Enumerable(Message)
Fetch up to
message_countmessages from the consumer, waiting up totimeoutfor them.
Constructor Detail
Instance Method Detail
Acknowledge the given message and request the next in a single round trip to the server to save latency.
pull = js.pull_subscribe(consumer)
# Poll for messages until we get one
until msg = pull.fetch(timeout: 30.seconds)
end
loop do
end
Acknowledge the given message and request the next count messages in
a single round trip to the server to save latency.
Fetch up to message_count messages from the consumer, waiting up to
timeout for them. Returns early once we have message_count of them,
when the server tells us the request has expired, or, if no_wait is
true, as soon as the server tells us there aren't any more.
Raises NATS::JetStream::Error if the server rejects the request, such
as when the consumer no longer exists.