Package akka.javasdk

Interface CloudEvent


public interface CloudEvent
CloudEvent representation of Metadata.
  • Method Details

    • specversion

      String specversion()
      The CloudEvent spec version.
      Returns:
      The spec version.
    • id

      String id()
      The id of this CloudEvent. According to the CloudEvents https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id[specification], the ID is not guaranteed to be the same for redelivery of the same event, hence we can't use it for deduplication.
      Returns:
      The id.
    • withId

      CloudEvent withId(String id)
      Return a new CloudEvent with the given id.
      Parameters:
      id - The id to set.
      Returns:
      A copy of this CloudEvent.
    • source

      URI source()
      The source of this CloudEvent.
      Returns:
      The source.
    • withSource

      CloudEvent withSource(URI source)
      Return a new CloudEvent with the given source.
      Parameters:
      source - The source to set.
      Returns:
      A copy of this CloudEvent.
    • type

      String type()
      The type of this CloudEvent.
      Returns:
      The type.
    • withType

      CloudEvent withType(String type)
      Return a new CloudEvent with the given type.
      Parameters:
      type - The type to set.
      Returns:
      A copy of this CloudEvent.
    • datacontenttype

      Optional<String> datacontenttype()
      The data content type of this CloudEvent.
      Returns:
      The data content type, if set.
    • withDatacontenttype

      CloudEvent withDatacontenttype(String datacontenttype)
      Return a new CloudEvent with the given data content type.
      Parameters:
      datacontenttype - The data content type to set.
      Returns:
      A copy of this CloudEvent.
    • clearDatacontenttype

      CloudEvent clearDatacontenttype()
      Clear the data content type of this CloudEvent, if set.
      Returns:
      A copy of this CloudEvent.
    • dataschema

      Optional<URI> dataschema()
      The data schema of this CloudEvent.
      Returns:
      The data schema, if set.
    • withDataschema

      CloudEvent withDataschema(URI dataschema)
      Return a new CloudEvent with the given data schema.
      Parameters:
      dataschema - The data schema to set.
      Returns:
      A copy of this CloudEvent.
    • clearDataschema

      CloudEvent clearDataschema()
      Clear the data schema of this CloudEvent, if set.
      Returns:
      A copy of this CloudEvent.
    • subject

      Optional<String> subject()
      The subject of this CloudEvent.
      Returns:
      The subject, if set.
    • withSubject

      CloudEvent withSubject(String subject)
      Return a new CloudEvent with the given subject.
      Parameters:
      subject - The subject to set.
      Returns:
      A copy of this CloudEvent.
    • clearSubject

      CloudEvent clearSubject()
      Clear the subject of this CloudEvent, if set.
      Returns:
      A copy of this CloudEvent.
    • sequence

      Optional<Long> sequence()
      The sequence of this CloudEvent parsed to Long value.
    • sequenceString

      Optional<String> sequenceString()
      The sequence of this CloudEvent.
    • withSequence

      CloudEvent withSequence(String sequence)
      Return a new CloudEvent with the given sequence.
      Parameters:
      sequence - The sequence to set.
      Returns:
      A copy of this CloudEvent.
    • clearSequence

      CloudEvent clearSequence()
      Clear the sequence of this CloudEvent, if set.
      Returns:
      A copy of this CloudEvent.
    • sequenceType

      Optional<String> sequenceType()
      The sequence type of this CloudEvent.
    • withSequenceType

      CloudEvent withSequenceType(String sequenceType)
      Return a new CloudEvent with the given sequence type.
      Parameters:
      sequenceType - The sequence type to set.
      Returns:
      A copy of this CloudEvent.
    • clearSequenceType

      CloudEvent clearSequenceType()
      Clear the sequence type of this CloudEvent, if set.
      Returns:
      A copy of this CloudEvent.
    • time

      The time of this CloudEvent.
      Returns:
      The time, if set.
    • withTime

      CloudEvent withTime(ZonedDateTime time)
      Return a new CloudEvent with the given time.
      Parameters:
      time - The time to set.
      Returns:
      A copy of this CloudEvent.
    • clearTime

      CloudEvent clearTime()
      Clear the time of this CloudEvent, if set.
      Returns:
      A copy of this CloudEvent.
    • asMetadata

      Metadata asMetadata()
      Return this CloudEvent represented as Metadata.

      If this CloudEvent was created by {Metadata.asCloudEvent()}, then any non CloudEvent metadata that was present will still be present.

      Returns:
      This CloudEvent expressed as metadata.
    • of

      static CloudEvent of(String id, URI source, String type)
      Create a CloudEvent.
      Parameters:
      id - The id of the CloudEvent.
      source - The source of the CloudEvent.
      type - The type of the CloudEvent.
      Returns:
      The newly created CloudEvent.