Class PositionAwareCloudEvent

java.lang.Object
org.occurrent.subscription.PositionAwareCloudEvent
All Implemented Interfaces:
io.cloudevents.CloudEvent, io.cloudevents.CloudEventAttributes, io.cloudevents.CloudEventContext, io.cloudevents.CloudEventExtensions

public final class PositionAwareCloudEvent extends Object implements io.cloudevents.CloudEvent
A wrapper around a CloudEvent that also includes a SubscriptionPosition so that it's possible to resume the stream from a particular state. You can treat this cloud event implementation as a regular cloud event.
  • Constructor Details

    • PositionAwareCloudEvent

      public PositionAwareCloudEvent(io.cloudevents.CloudEvent cloudEvent, SubscriptionPosition subscriptionPosition)
  • Method Details

    • getData

      @Nullable public io.cloudevents.CloudEventData getData()
      Specified by:
      getData in interface io.cloudevents.CloudEvent
    • getSpecVersion

      public io.cloudevents.SpecVersion getSpecVersion()
      Specified by:
      getSpecVersion in interface io.cloudevents.CloudEventAttributes
    • getId

      public String getId()
      Specified by:
      getId in interface io.cloudevents.CloudEventAttributes
    • getType

      public String getType()
      Specified by:
      getType in interface io.cloudevents.CloudEventAttributes
    • getSource

      public URI getSource()
      Specified by:
      getSource in interface io.cloudevents.CloudEventAttributes
    • getDataContentType

      @Nullable public String getDataContentType()
      Specified by:
      getDataContentType in interface io.cloudevents.CloudEventAttributes
    • getDataSchema

      @Nullable public URI getDataSchema()
      Specified by:
      getDataSchema in interface io.cloudevents.CloudEventAttributes
    • getSubject

      @Nullable public String getSubject()
      Specified by:
      getSubject in interface io.cloudevents.CloudEventAttributes
    • getTime

      @Nullable public OffsetDateTime getTime()
      Specified by:
      getTime in interface io.cloudevents.CloudEventAttributes
    • getAttribute

      @Nullable public Object getAttribute(String attributeName) throws IllegalArgumentException
      Specified by:
      getAttribute in interface io.cloudevents.CloudEventAttributes
      Throws:
      IllegalArgumentException
    • getAttributeNames

      public Set<String> getAttributeNames()
      Specified by:
      getAttributeNames in interface io.cloudevents.CloudEventAttributes
    • getExtension

      @Nullable public Object getExtension(String extensionName)
      Specified by:
      getExtension in interface io.cloudevents.CloudEventExtensions
    • getExtensionNames

      public Set<String> getExtensionNames()
      Specified by:
      getExtensionNames in interface io.cloudevents.CloudEventExtensions
    • getSubscriptionPosition

      public SubscriptionPosition getSubscriptionPosition()
    • getOriginalCloudEvent

      public io.cloudevents.CloudEvent getOriginalCloudEvent()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hasSubscriptionPosition

      public static boolean hasSubscriptionPosition(io.cloudevents.CloudEvent cloudEvent)
    • getSubscriptionPositionOrThrowIAE

      public static SubscriptionPosition getSubscriptionPositionOrThrowIAE(io.cloudevents.CloudEvent cloudEvent)
    • getSubscriptionPosition

      public static Optional<SubscriptionPosition> getSubscriptionPosition(io.cloudevents.CloudEvent cloudEvent)