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

Included in:
Msg
Defined in:
lib/nats/io/js.rb

Instance Method Summary collapse

Instance Method Details

#ack(**params) ⇒ Object



836
837
838
839
840
841
842
843
844
845
846
847
# File 'lib/nats/io/js.rb', line 836

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



849
850
851
852
853
854
855
856
857
# File 'lib/nats/io/js.rb', line 849

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



885
886
887
# File 'lib/nats/io/js.rb', line 885

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

#metadataObject



889
890
891
# File 'lib/nats/io/js.rb', line 889

def 
  @meta ||= (reply)
end

#nak(**params) ⇒ Object



859
860
861
862
863
864
865
866
867
868
869
870
# File 'lib/nats/io/js.rb', line 859

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



872
873
874
875
876
877
878
879
880
881
882
883
# File 'lib/nats/io/js.rb', line 872

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