Package io.dapr.client.domain
Class CloudEvent<T>
java.lang.Object
io.dapr.client.domain.CloudEvent<T>
- Type Parameters:
T
- The type of the payload.
A cloud event in Dapr.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Mime type used for CloudEvent.protected static final com.fasterxml.jackson.databind.ObjectMapper
Shared Json serializer/deserializer as per Jackson's documentation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CloudEvent<?>
deserialize
(byte[] payload) Deserialize a message topic from Dapr.boolean
byte[]
Gets the cloud event's binary data.getData()
Gets the cloud event data.Gets the type of the data's content.getId()
Gets the identifier of the message being processed.Gets the pubsub component name.Gets the event's source.Gets the version of the specification.getTime()
Gets the time.getTopic()
Gets the topic name.Deprecated.Gets the trace parent.Gets the trace state.getType()
Gets the envelope type.int
hashCode()
void
setBinaryData
(byte[] binaryData) Sets the cloud event's binary data.void
Sets the cloud event data.void
setDatacontenttype
(String datacontenttype) Sets the type of the data's content.void
Sets the identifier of the message being processed.void
setPubsubName
(String pubsubName) Sets the pubsub component name.void
Sets the event's source.void
setSpecversion
(String specversion) Sets the version of the specification.void
setTime
(OffsetDateTime time) Sets the time.void
Sets the topic name.void
setTraceId
(String traceId) Deprecated.void
setTraceParent
(String traceParent) Sets the trace parent.void
setTraceState
(String traceState) Sets the trace state.void
Sets the envelope type.
-
Field Details
-
CONTENT_TYPE
Mime type used for CloudEvent.- See Also:
-
OBJECT_MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPERShared Json serializer/deserializer as per Jackson's documentation.
-
-
Constructor Details
-
CloudEvent
public CloudEvent()Instantiates a CloudEvent. -
CloudEvent
public CloudEvent(String id, String source, String type, String specversion, String datacontenttype, T data) Instantiates a CloudEvent.- Parameters:
id
- Identifier of the message being processed.source
- Source for this event.type
- Type of event.specversion
- Version of the event spec.datacontenttype
- Type of the payload.data
- Payload.
-
CloudEvent
Instantiates a CloudEvent.- Parameters:
id
- Identifier of the message being processed.source
- Source for this event.type
- Type of event.specversion
- Version of the event spec.binaryData
- Payload.
-
-
Method Details
-
deserialize
Deserialize a message topic from Dapr.- Parameters:
payload
- Payload sent from Dapr.- Returns:
- Message (can be null if input is null)
- Throws:
IOException
- If cannot parse.
-
getId
Gets the identifier of the message being processed.- Returns:
- Identifier of the message being processed.
-
setId
Sets the identifier of the message being processed.- Parameters:
id
- Identifier of the message being processed.
-
getSource
Gets the event's source.- Returns:
- Event's source.
-
setSource
Sets the event's source.- Parameters:
source
- Event's source.
-
getType
Gets the envelope type.- Returns:
- Envelope type.
-
setType
Sets the envelope type.- Parameters:
type
- Envelope type.
-
getSpecversion
Gets the version of the specification.- Returns:
- Version of the specification.
-
setSpecversion
Sets the version of the specification.- Parameters:
specversion
- Version of the specification.
-
getDatacontenttype
Gets the type of the data's content.- Returns:
- Type of the data's content.
-
setDatacontenttype
Sets the type of the data's content.- Parameters:
datacontenttype
- Type of the data's content.
-
getData
Gets the cloud event data.- Returns:
- Cloud event's data. As per specs, data can be a JSON object or string.
-
setData
Sets the cloud event data. As per specs, data can be a JSON object or string.- Parameters:
data
- Cloud event's data. As per specs, data can be a JSON object or string.
-
getBinaryData
public byte[] getBinaryData()Gets the cloud event's binary data.- Returns:
- Cloud event's binary data.
-
setBinaryData
public void setBinaryData(byte[] binaryData) Sets the cloud event's binary data.- Parameters:
binaryData
- Cloud event's binary data.
-
getPubsubName
Gets the pubsub component name.- Returns:
- the pubsub component name.
-
setPubsubName
Sets the pubsub component name.- Parameters:
pubsubName
- the pubsub component name.
-
getTopic
Gets the topic name.- Returns:
- the topic name.
-
setTopic
Sets the topic name.- Parameters:
topic
- the topic name.
-
getTime
Gets the time.- Returns:
- the time.
-
setTime
Sets the time.- Parameters:
time
- the time.
-
getTraceId
Deprecated.Gets the trace id which is the legacy name for trace parent.- Returns:
- the trace id.
-
setTraceId
Deprecated.Sets the trace id which is the legacy name for trace parent.- Parameters:
traceId
- the trace id.
-
getTraceParent
Gets the trace parent.- Returns:
- the trace parent.
-
setTraceParent
Sets the trace parent.- Parameters:
traceParent
- the trace parent.
-
getTraceState
Gets the trace state.- Returns:
- the trace state.
-
setTraceState
Sets the trace state.- Parameters:
traceState
- the trace state.
-
equals
-
hashCode
public int hashCode()
-