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



738
739
740
741
742
743
744
745
746
747
748
749
# File 'lib/nats/io/js.rb', line 738

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



751
752
753
754
755
756
757
758
759
# File 'lib/nats/io/js.rb', line 751

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



787
788
789
# File 'lib/nats/io/js.rb', line 787

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

#metadataObject



791
792
793
# File 'lib/nats/io/js.rb', line 791

def 
  @meta ||= (reply)
end

#nak(**params) ⇒ Object



761
762
763
764
765
766
767
768
769
770
771
772
# File 'lib/nats/io/js.rb', line 761

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



774
775
776
777
778
779
780
781
782
783
784
785
# File 'lib/nats/io/js.rb', line 774

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