Interface CloudEventsPayload


public interface CloudEventsPayload

The CloudEventsFormat represents event data in a way that conforms to a common specification. The payload can be found inside the data field.


Example to create an instance using the builder pattern

     CloudEventsPayload cloudEventsPayload = CloudEventsPayload.builder()
             .specversion("{specversion}")
             .id("{id}")
             .type("{type}")
             .source("{source}")
             .subject("{subject}")
             .time(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .data(dataBuilder -> dataBuilder)
             .build()
 
  • Field Details

  • Method Details

    • getSpecversion

      @NotNull @NotNull String getSpecversion()

      The version of the CloudEvents specification which the event uses.

      Returns:
      specversion
    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the event.

      Returns:
      id
    • getType

      @NotNull @NotNull String getType()

      The type is namespaced with com.commercetools, followed by the ReferenceTypeId, the type of Subscription (either message or change), and the message or change type. For example, com.commercetools.product.message.ProductPublished or com.commercetools.order.change.ResourceCreated.

      Returns:
      type
    • getSource

      @NotNull @NotNull String getSource()

      The default REST URI of the ReferenceTypeId that triggered this event, including the project key.

      Returns:
      source
    • getSubject

      @NotNull @NotNull String getSubject()

      Unique identifier of the resource that triggered the event.

      Returns:
      subject
    • getTime

      @NotNull @NotNull ZonedDateTime getTime()

      Corresponds to the lastModifiedAt of the resource at the time the event was triggered.

      Returns:
      time
    • getSequence

      String getSequence()

      Corresponds to the sequenceNumber of a MessageSubscription. Can be used to process messages in the correct order.

      Returns:
      sequence
    • getSequencetype

      String getSequencetype()

      "Integer"

      Returns:
      sequencetype
    • getDataref

      String getDataref()

      The URI from which the message can be retrieved if messages are enabled. Only set for MessageSubscriptions.

      Returns:
      dataref
    • getData

      @NotNull @Valid @NotNull @Valid DeliveryPayload getData()
      Returns:
      data
    • setSpecversion

      void setSpecversion(String specversion)

      The version of the CloudEvents specification which the event uses.

      Parameters:
      specversion - value to be set
    • setId

      void setId(String id)

      Unique identifier of the event.

      Parameters:
      id - value to be set
    • setType

      void setType(String type)

      The type is namespaced with com.commercetools, followed by the ReferenceTypeId, the type of Subscription (either message or change), and the message or change type. For example, com.commercetools.product.message.ProductPublished or com.commercetools.order.change.ResourceCreated.

      Parameters:
      type - value to be set
    • setSource

      void setSource(String source)

      The default REST URI of the ReferenceTypeId that triggered this event, including the project key.

      Parameters:
      source - value to be set
    • setSubject

      void setSubject(String subject)

      Unique identifier of the resource that triggered the event.

      Parameters:
      subject - value to be set
    • setTime

      void setTime(ZonedDateTime time)

      Corresponds to the lastModifiedAt of the resource at the time the event was triggered.

      Parameters:
      time - value to be set
    • setSequence

      void setSequence(String sequence)

      Corresponds to the sequenceNumber of a MessageSubscription. Can be used to process messages in the correct order.

      Parameters:
      sequence - value to be set
    • setSequencetype

      void setSequencetype(String sequencetype)

      "Integer"

      Parameters:
      sequencetype - value to be set
    • setDataref

      void setDataref(String dataref)

      The URI from which the message can be retrieved if messages are enabled. Only set for MessageSubscriptions.

      Parameters:
      dataref - value to be set
    • setData

      void setData(DeliveryPayload data)
      Parameters:
      data - value to be set
    • of

      static CloudEventsPayload of()
      factory method
      Returns:
      instance of CloudEventsPayload
    • of

      static CloudEventsPayload of(CloudEventsPayload template)
      factory method to create a shallow copy CloudEventsPayload
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • copyDeep

      CloudEventsPayload copyDeep()
    • deepCopy

      @Nullable static CloudEventsPayload deepCopy(@Nullable CloudEventsPayload template)
      factory method to create a deep copy of CloudEventsPayload
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static CloudEventsPayloadBuilder builder()
      builder factory method for CloudEventsPayload
      Returns:
      builder
    • builder

      static CloudEventsPayloadBuilder builder(CloudEventsPayload template)
      create builder for CloudEventsPayload instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withCloudEventsPayload

      default <T> T withCloudEventsPayload(Function<CloudEventsPayload,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<CloudEventsPayload> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference