Module: NATS::JetStream::Msg::AckMethods

Included in:
Msg
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/msg/ack_methods.rb

Instance Method Summary collapse

Instance Method Details

#ack(**params) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/msg/ack_methods.rb', line 19

def ack(**params)
  ensure_is_acked_once!

  resp = if params[:timeout]
           @nc.request(@reply, Ack::Ack, **params)
         else
           @nc.publish(@reply, Ack::Ack)
         end
  @sub.synchronize { @ackd = true }

  resp
end

#ack_sync(**params) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/msg/ack_methods.rb', line 32

def ack_sync(**params)
  ensure_is_acked_once!

  params[:timeout] ||= 0.5
  resp = @nc.request(@reply, Ack::Ack, **params)
  @sub.synchronize { @ackd = true }

  resp
end

#in_progress(**params) ⇒ Object



68
69
70
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/msg/ack_methods.rb', line 68

def in_progress(**params)
  params[:timeout] ? @nc.request(@reply, Ack::Progress, **params) : @nc.publish(@reply, Ack::Progress)
end

#metadataObject



72
73
74
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/msg/ack_methods.rb', line 72

def 
  @meta ||= (reply)
end

#nak(**params) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/msg/ack_methods.rb', line 42

def nak(**params)
  ensure_is_acked_once!

  resp = if params[:timeout]
           @nc.request(@reply, Ack::Nak, **params)
         else
           @nc.publish(@reply, Ack::Nak)
         end
  @sub.synchronize { @ackd = true }

  resp
end

#term(**params) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/nats-pure-2.2.1/lib/nats/io/jetstream/msg/ack_methods.rb', line 55

def term(**params)
  ensure_is_acked_once!

  resp = if params[:timeout]
           @nc.request(@reply, Ack::Term, **params)
         else
           @nc.publish(@reply, Ack::Term)
         end
  @sub.synchronize { @ackd = true }

  resp
end