Class PubSubAcknowledgmentCallback

java.lang.Object
com.google.cloud.spring.pubsub.integration.inbound.PubSubAcknowledgmentCallback
All Implemented Interfaces:
org.springframework.integration.acks.AcknowledgmentCallback, org.springframework.integration.acks.SimpleAcknowledgment

public class PubSubAcknowledgmentCallback extends Object implements org.springframework.integration.acks.AcknowledgmentCallback
Pub/Sub specific implementation of AcknowledgmentCallback.

AcknowledgmentCallback.isAcknowledged() is implemented for semantic accuracy only, since in Pub/Sub acknowledging a message more than once is not an error.

AcknowledgmentCallback.noAutoAck() is not implemented; the correct way to enable manual acking is through configuring PubSubMessageSource.

Since:
1.2
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.springframework.integration.acks.AcknowledgmentCallback

    org.springframework.integration.acks.AcknowledgmentCallback.Status
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a callback for a given message and acknowledgement mode.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    acknowledge(org.springframework.integration.acks.AcknowledgmentCallback.Status status)
    In AckMode.AUTO_ACK mode, nacking cannot be done through this callback.
    boolean
     
    boolean
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.integration.acks.AcknowledgmentCallback

    acknowledge, noAutoAck
  • Constructor Details

    • PubSubAcknowledgmentCallback

      public PubSubAcknowledgmentCallback(AcknowledgeablePubsubMessage message, AckMode ackMode)
      Instantiates a callback for a given message and acknowledgement mode.
      Parameters:
      message - message to acknowledge
      ackMode - whether to ack and/or nack automatically
  • Method Details

    • acknowledge

      public void acknowledge(org.springframework.integration.acks.AcknowledgmentCallback.Status status)
      In AckMode.AUTO_ACK mode, nacking cannot be done through this callback.

      Use GcpPubSubHeaders.ORIGINAL_MESSAGE to nack instead.

      Specified by:
      acknowledge in interface org.springframework.integration.acks.AcknowledgmentCallback
    • isAutoAck

      public boolean isAutoAck()
      Specified by:
      isAutoAck in interface org.springframework.integration.acks.AcknowledgmentCallback
    • isAcknowledged

      public boolean isAcknowledged()
      Specified by:
      isAcknowledged in interface org.springframework.integration.acks.AcknowledgmentCallback