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
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic CloudEventsPayloadBuilderbuilder()builder factory method for CloudEventsPayloadstatic CloudEventsPayloadBuilderbuilder(CloudEventsPayload template) create builder for CloudEventsPayload instancecopyDeep()static CloudEventsPayloaddeepCopy(CloudEventsPayload template) factory method to create a deep copy of CloudEventsPayload@NotNull @Valid DeliveryPayloadgetData()The URI from which the message can be retrieved if messages are enabled.@NotNull StringgetId()Unique identifier of the event.Corresponds to thesequenceNumberof a MessageSubscription."Integer"@NotNull StringThe default REST URI of the ReferenceTypeId that triggered this event, including the project key.@NotNull StringThe version of the CloudEvents specification which the event uses.@NotNull StringUnique identifier of the resource that triggered the event.@NotNull ZonedDateTimegetTime()Corresponds to thelastModifiedAtof the resource at the time the event was triggered.@NotNull StringgetType()Thetypeis namespaced withcom.commercetools, followed by the ReferenceTypeId, the type of Subscription (eithermessageorchange), and the message or change type.static CloudEventsPayloadof()factory methodstatic CloudEventsPayloadof(CloudEventsPayload template) factory method to create a shallow copy CloudEventsPayloadvoidsetData(DeliveryPayload data) voidsetDataref(String dataref) The URI from which the message can be retrieved if messages are enabled.voidUnique identifier of the event.voidsetSequence(String sequence) Corresponds to thesequenceNumberof a MessageSubscription.voidsetSequencetype(String sequencetype) "Integer"voidThe default REST URI of the ReferenceTypeId that triggered this event, including the project key.voidsetSpecversion(String specversion) The version of the CloudEvents specification which the event uses.voidsetSubject(String subject) Unique identifier of the resource that triggered the event.voidsetTime(ZonedDateTime time) Corresponds to thelastModifiedAtof the resource at the time the event was triggered.voidThetypeis namespaced withcom.commercetools, followed by the ReferenceTypeId, the type of Subscription (eithermessageorchange), and the message or change type.static com.fasterxml.jackson.core.type.TypeReference<CloudEventsPayload>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithCloudEventsPayload(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
typeis namespaced withcom.commercetools, followed by the ReferenceTypeId, the type of Subscription (eithermessageorchange), and the message or change type. For example,com.commercetools.product.message.ProductPublishedorcom.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
lastModifiedAtof the resource at the time the event was triggered.- Returns:
- time
-
getSequence
String getSequence()Corresponds to the
sequenceNumberof 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, EventDeliveryPayload.
- 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
typeis namespaced withcom.commercetools, followed by the ReferenceTypeId, the type of Subscription (eithermessageorchange), and the message or change type. For example,com.commercetools.product.message.ProductPublishedorcom.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
lastModifiedAtof the resource at the time the event was triggered.- Parameters:
time- value to be set
-
setSequence
Corresponds to the
sequenceNumberof 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, EventDeliveryPayload.
- 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
-
copyDeep
CloudEventsPayload copyDeep() -
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
-