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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CloudEventsPayloadBuilder
builder()
builder factory method for CloudEventsPayloadstatic CloudEventsPayloadBuilder
builder
(CloudEventsPayload template) create builder for CloudEventsPayload instancestatic CloudEventsPayload
deepCopy
(CloudEventsPayload template) factory method to create a deep copy of CloudEventsPayload@NotNull @Valid DeliveryPayload
getData()
MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.The URI from which the message can be retrieved if messages are enabled.@NotNull String
getId()
Unique identifier of the event.Corresponds to thesequenceNumber
of a MessageSubscription."Integer"
@NotNull String
The default REST URI of the ReferenceTypeId that triggered this event, including the project key.@NotNull String
The version of the CloudEvents specification which the event uses.@NotNull String
Unique identifier of the resource that triggered the event.@NotNull ZonedDateTime
getTime()
Corresponds to thelastModifiedAt
of the resource at the time the event was triggered.@NotNull String
getType()
Thetype
is namespaced withcom.commercetools
, followed by the ReferenceTypeId, the type of Subscription (eithermessage
orchange
), and the message or change type.static CloudEventsPayload
of()
factory methodstatic CloudEventsPayload
of
(CloudEventsPayload template) factory method to create a shallow copy CloudEventsPayloadvoid
setData
(DeliveryPayload data) MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.void
setDataref
(String dataref) The URI from which the message can be retrieved if messages are enabled.void
Unique identifier of the event.void
setSequence
(String sequence) Corresponds to thesequenceNumber
of a MessageSubscription.void
setSequencetype
(String sequencetype) "Integer"
void
The default REST URI of the ReferenceTypeId that triggered this event, including the project key.void
setSpecversion
(String specversion) The version of the CloudEvents specification which the event uses.void
setSubject
(String subject) Unique identifier of the resource that triggered the event.void
setTime
(ZonedDateTime time) Corresponds to thelastModifiedAt
of the resource at the time the event was triggered.void
Thetype
is namespaced withcom.commercetools
, followed by the ReferenceTypeId, the type of Subscription (eithermessage
orchange
), and the message or change type.static com.fasterxml.jackson.core.type.TypeReference<CloudEventsPayload>
gives a TypeReference for usage with Jackson DataBinddefault <T> T
withCloudEventsPayload
(Function<CloudEventsPayload, T> helper) accessor map function
-
Field Details
-
CLOUD_EVENTS
discriminator value for CloudEventsPayload- See Also:
-
-
Method Details
-
getSpecversion
The version of the CloudEvents specification which the event uses.
- Returns:
- specversion
-
getId
Unique identifier of the event.
- Returns:
- id
-
getType
The
type
is namespaced withcom.commercetools
, followed by the ReferenceTypeId, the type of Subscription (eithermessage
orchange
), and the message or change type. For example,com.commercetools.product.message.ProductPublished
orcom.commercetools.order.change.ResourceCreated
.- Returns:
- type
-
getSource
The default REST URI of the ReferenceTypeId that triggered this event, including the project key.
- Returns:
- source
-
getSubject
Unique identifier of the resource that triggered the event.
- Returns:
- subject
-
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
MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.
- Returns:
- data
-
setSpecversion
The version of the CloudEvents specification which the event uses.
- Parameters:
specversion
- value to be set
-
setId
Unique identifier of the event.
- Parameters:
id
- value to be set
-
setType
The
type
is namespaced withcom.commercetools
, followed by the ReferenceTypeId, the type of Subscription (eithermessage
orchange
), and the message or change type. For example,com.commercetools.product.message.ProductPublished
orcom.commercetools.order.change.ResourceCreated
.- Parameters:
type
- value to be set
-
setSource
The default REST URI of the ReferenceTypeId that triggered this event, including the project key.
- Parameters:
source
- value to be set
-
setSubject
Unique identifier of the resource that triggered the event.
- Parameters:
subject
- value to be set
-
setTime
Corresponds to the
lastModifiedAt
of the resource at the time the event was triggered.- Parameters:
time
- value to be set
-
setSequence
Corresponds to the
sequenceNumber
of a MessageSubscription. Can be used to process messages in the correct order.- Parameters:
sequence
- value to be set
-
setSequencetype
"Integer"
- Parameters:
sequencetype
- value to be set
-
setDataref
The URI from which the message can be retrieved if messages are enabled. Only set for MessageSubscriptions.
- Parameters:
dataref
- value to be set
-
setData
MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.
- Parameters:
data
- value to be set
-
of
factory method- Returns:
- instance of CloudEventsPayload
-
of
factory method to create a shallow copy CloudEventsPayload- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
deepCopy
factory method to create a deep copy of CloudEventsPayload- Parameters:
template
- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for CloudEventsPayload- Returns:
- builder
-
builder
create builder for CloudEventsPayload instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-
withCloudEventsPayload
accessor map function- Type Parameters:
T
- mapped type- Parameters:
helper
- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-