Class CloudEventsPayloadBuilder
- All Implemented Interfaces:
Builder<CloudEventsPayload>
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()
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
builds CloudEventsPayload with checking for non-null required valuesbuilds CloudEventsPayload without checking for non-null required valuesdata
(DeliveryPayload data) MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.data
(Function<DeliveryPayloadBuilder, Builder<? extends DeliveryPayload>> builder) MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.The URI from which the message can be retrieved if messages are enabled.getData()
MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.The URI from which the message can be retrieved if messages are enabled.getId()
Unique identifier of the event.Corresponds to thesequenceNumber
of a MessageSubscription."Integer"
The default REST URI of the ReferenceTypeId that triggered this event, including the project key.The version of the CloudEvents specification which the event uses.Unique identifier of the resource that triggered the event.getTime()
Corresponds to thelastModifiedAt
of the resource at the time the event was triggered.getType()
Thetype
is namespaced withcom.commercetools
, followed by the ReferenceTypeId, the type of Subscription (eithermessage
orchange
), and the message or change type.Unique identifier of the event.static CloudEventsPayloadBuilder
of()
factory method for an instance of CloudEventsPayloadBuilderstatic CloudEventsPayloadBuilder
of
(CloudEventsPayload template) create builder for CloudEventsPayload instanceCorresponds to thesequenceNumber
of a MessageSubscription.sequencetype
(String sequencetype) "Integer"
The default REST URI of the ReferenceTypeId that triggered this event, including the project key.specversion
(String specversion) The version of the CloudEvents specification which the event uses.Unique identifier of the resource that triggered the event.time
(ZonedDateTime time) Corresponds to thelastModifiedAt
of the resource at the time the event was triggered.Thetype
is namespaced withcom.commercetools
, followed by the ReferenceTypeId, the type of Subscription (eithermessage
orchange
), and the message or change type.
-
Constructor Details
-
CloudEventsPayloadBuilder
public CloudEventsPayloadBuilder()
-
-
Method Details
-
specversion
The version of the CloudEvents specification which the event uses.
- Parameters:
specversion
- value to be set- Returns:
- Builder
-
id
Unique identifier of the event.
- Parameters:
id
- value to be set- Returns:
- Builder
-
type
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- Returns:
- Builder
-
source
The default REST URI of the ReferenceTypeId that triggered this event, including the project key.
- Parameters:
source
- value to be set- Returns:
- Builder
-
subject
Unique identifier of the resource that triggered the event.
- Parameters:
subject
- value to be set- Returns:
- Builder
-
time
Corresponds to the
lastModifiedAt
of the resource at the time the event was triggered.- Parameters:
time
- value to be set- Returns:
- Builder
-
sequence
Corresponds to the
sequenceNumber
of a MessageSubscription. Can be used to process messages in the correct order.- Parameters:
sequence
- value to be set- Returns:
- Builder
-
sequencetype
"Integer"
- Parameters:
sequencetype
- value to be set- Returns:
- Builder
-
dataref
The URI from which the message can be retrieved if messages are enabled. Only set for MessageSubscriptions.
- Parameters:
dataref
- value to be set- Returns:
- Builder
-
data
MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.
- Parameters:
data
- value to be set- Returns:
- Builder
-
data
public CloudEventsPayloadBuilder data(Function<DeliveryPayloadBuilder, Builder<? extends DeliveryPayload>> builder) MessageDeliveryPayload, ResourceCreatedDeliveryPayload, ResourceUpdatedDeliveryPayload, or ResourceDeletedDeliveryPayload.
- Parameters:
builder
- function to build the data value- Returns:
- Builder
-
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
Corresponds to the
sequenceNumber
of a MessageSubscription. Can be used to process messages in the correct order.- Returns:
- sequence
-
getSequencetype
"Integer"
- Returns:
- sequencetype
-
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
-
build
builds CloudEventsPayload with checking for non-null required values- Specified by:
build
in interfaceBuilder<CloudEventsPayload>
- Returns:
- CloudEventsPayload
-
buildUnchecked
builds CloudEventsPayload without checking for non-null required values- Returns:
- CloudEventsPayload
-
of
factory method for an instance of CloudEventsPayloadBuilder- Returns:
- builder
-
of
create builder for CloudEventsPayload instance- Parameters:
template
- instance with prefilled values for the builder- Returns:
- builder
-