Class CloudEvent

java.lang.Object
io.dapr.client.domain.CloudEvent

public final class CloudEvent
extends Object
A cloud event in Dapr.
  • Field Details

    • OBJECT_MAPPER

      protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
      Shared Json serializer/deserializer as per Jackson's documentation.
  • Constructor Details

    • CloudEvent

      public CloudEvent​(String id, String source, String type, String specversion, String datacontenttype, String data)
      Instantiates a new input request.
      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.
  • Method Details

    • getId

      public String getId()
      Gets the identifier of the message being processed.
      Returns:
      Identifier of the message being processed.
    • getSource

      public String getSource()
      Gets the source for this event.
      Returns:
      Source for this event.
    • getType

      public String getType()
      Gets the type of event.
      Returns:
      Type of event.
    • getSpecversion

      public String getSpecversion()
      Gets the version of the event spec.
      Returns:
      Version of the event spec.
    • getDatacontenttype

      public String getDatacontenttype()
      Gets the type of the payload.
      Returns:
      Type of the payload.
    • getData

      public String getData()
      Gets the payload.
      Returns:
      Payload
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • deserialize

      public static CloudEvent deserialize​(byte[] payload) throws IOException
      Deserialized 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.