Package io.dapr.client.domain
Class CloudEvent
java.lang.Object
io.dapr.client.domain.CloudEvent
public final class CloudEvent
extends java.lang.Object
A cloud event in Dapr.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTENT_TYPE
Mime type used for CloudEvent.protected static com.fasterxml.jackson.databind.ObjectMapper
OBJECT_MAPPER
Shared Json serializer/deserializer as per Jackson's documentation. -
Constructor Summary
Constructors Constructor Description CloudEvent()
Instantiates a CloudEvent.CloudEvent(java.lang.String id, java.lang.String source, java.lang.String type, java.lang.String specversion, byte[] binaryData)
Instantiates a CloudEvent.CloudEvent(java.lang.String id, java.lang.String source, java.lang.String type, java.lang.String specversion, java.lang.String datacontenttype, java.lang.Object data)
Instantiates a CloudEvent. -
Method Summary
Modifier and Type Method Description static CloudEvent
deserialize(byte[] payload)
Deserialize a message topic from Dapr.boolean
equals(java.lang.Object o)
byte[]
getBinaryData()
Gets the cloud event's binary data.java.lang.Object
getData()
Gets the cloud event data.java.lang.String
getDatacontenttype()
Gets the type of the data's content.java.lang.String
getId()
Gets the identifier of the message being processed.java.lang.String
getSource()
Gets the event's source.java.lang.String
getSpecversion()
Gets the version of the specification.java.lang.String
getType()
Gets the envelope type.int
hashCode()
void
setBinaryData(byte[] binaryData)
Sets the cloud event's binary data.void
setData(java.lang.Object data)
Sets the cloud event data.void
setDatacontenttype(java.lang.String datacontenttype)
Sets the type of the data's content.void
setId(java.lang.String id)
Sets the identifier of the message being processed.void
setSource(java.lang.String source)
Sets the event's source.void
setSpecversion(java.lang.String specversion)
Sets the version of the specification.void
setType(java.lang.String type)
Sets the envelope type.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
CONTENT_TYPE
public static final java.lang.String CONTENT_TYPEMime type used for CloudEvent.- See Also:
- Constant Field Values
-
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(java.lang.String id, java.lang.String source, java.lang.String type, java.lang.String specversion, java.lang.String datacontenttype, java.lang.Object 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
public CloudEvent(java.lang.String id, java.lang.String source, java.lang.String type, java.lang.String specversion, byte[] binaryData)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:
java.io.IOException
- If cannot parse.
-
getId
public java.lang.String getId()Gets the identifier of the message being processed.- Returns:
- Identifier of the message being processed.
-
setId
public void setId(java.lang.String id)Sets the identifier of the message being processed.- Parameters:
id
- Identifier of the message being processed.
-
getSource
public java.lang.String getSource()Gets the event's source.- Returns:
- Event's source.
-
setSource
public void setSource(java.lang.String source)Sets the event's source.- Parameters:
source
- Event's source.
-
getType
public java.lang.String getType()Gets the envelope type.- Returns:
- Envelope type.
-
setType
public void setType(java.lang.String type)Sets the envelope type.- Parameters:
type
- Envelope type.
-
getSpecversion
public java.lang.String getSpecversion()Gets the version of the specification.- Returns:
- Version of the specification.
-
setSpecversion
public void setSpecversion(java.lang.String specversion)Sets the version of the specification.- Parameters:
specversion
- Version of the specification.
-
getDatacontenttype
public java.lang.String getDatacontenttype()Gets the type of the data's content.- Returns:
- Type of the data's content.
-
setDatacontenttype
public void setDatacontenttype(java.lang.String datacontenttype)Sets the type of the data's content.- Parameters:
datacontenttype
- Type of the data's content.
-
getData
public java.lang.Object getData()Gets the cloud event data.- Returns:
- Cloud event's data. As per specs, data can be a JSON object or string.
-
setData
public void setData(java.lang.Object data)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.
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-