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



753
754
755
756
757
758
759
760
761
762
763
764
# File 'lib/nats/io/js.rb', line 753

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



766
767
768
769
770
771
772
773
774
# File 'lib/nats/io/js.rb', line 766

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



802
803
804
# File 'lib/nats/io/js.rb', line 802

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

#metadataObject



806
807
808
# File 'lib/nats/io/js.rb', line 806

def 
  @meta ||= (reply)
end

#nak(**params) ⇒ Object



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

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



789
790
791
792
793
794
795
796
797
798
799
800
# File 'lib/nats/io/js.rb', line 789

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