Interface InvocationEvent<T>

Type Parameters: T - The type of the payload of this event.


public interface InvocationEvent<T>

An Event is representative of the data associated with the occurrence of an event, and supporting metadata about the source of that occurrence.

Method Summary

Modifier and TypeMethodDescription
TgetData()Returns the unmarshalled payload of the event.
java.util.Optional<java.lang.String>getDataContentType()Returns the media type of the event payload that is accessible via getData().
java.util.Optional<java.net.URI>getDataSchema()Returns the schema that the event payload adheres to.
java.lang.StringgetId()Returns the platform event occurrence id for event invocation.
java.net.URIgetSource()Returns an URI which Identifies the context in which an event happened.
java.util.Optional<java.time.OffsetDateTime>getTime()Returns the timestamp of when the occurrence happened.
java.lang.StringgetType()Returns a value describing the type of invocation.

Method Details

getId

@Nonnull java.lang.String getId()

Returns the platform event occurrence id for event invocation.

Returns: The platform event occurrence id for event invocation. See Also: CloudEvent Specification

getType

@Nonnull java.lang.String getType()

Returns a value describing the type of invocation. The format of this is producer defined and might include information such as the version of the type.

Returns: A string describing the type of invocation. See Also: CloudEvent Specification

getSource

@Nonnull java.net.URI getSource()

Returns an URI which identifies the context in which an event happened. Often this will include information such as the type of the event source, the organization publishing the event or the process that produced the event.

Returns: An URI which Identifies the context in which an event happened. See Also: CloudEvent Specification

getData

@Nonnull T getData()

Returns the unmarshalled payload of the event.

Returns: The payload of the event.

getDataContentType

@Nonnull java.util.Optional<java.lang.String> getDataContentType()

Returns the media type of the event payload that is accessible via getData(). This is valid for the original data that was posted to the function before it was automatically unmarshalled into InvocationEvent.

When using POJOs and other higher level types for InvocationEvent, this value is most likely not very useful. When using raw bytes (by using byte[] for T), this value can be used to drive your custom unmarshalling process.

Returns: The media type of the event payload. See Also: CloudEvent Specification

getDataSchema

@Nonnull java.util.Optional<java.net.URI> getDataSchema()

Returns the schema that the event payload adheres to.

Returns: The schema that the event payload adheres to. See Also: CloudEvent Specification

getTime

@Nonnull java.util.Optional<java.time.OffsetDateTime> getTime()

Returns the timestamp of when the occurrence happened. If the time of the occurrence cannot be determined then this attribute may be set to some other time (such as the current time), however all producers for the same source must be consistent in this respect. In other words, either they all use the actual time of the occurrence or they all use the same algorithm to determine the value used.

Returns: The timestamp of when the occurrence happened See Also: CloudEvent Specification