---
schema_version: "1"
id: d48ec62b478aae0ab6e85f6886eaf528a01d45474ba141671201f6845a53aa9a
title: Interface InvocationEvent<T>
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforce-functions/functions/guide/javasdk/interfaces/java-invocationevent.md
canonical_url: https://developer.salesforce.com/docs/platform/functions/guide/java-invocationevent.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c75ba981228fa0401eb542e4aba9baa18e620b8abcb9e20fa0168ae290a59d4b
products:
  - Salesforce Functions
---
# 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 Type                              | Method                 | Description                                                                     |
| ---------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------- |
| `T`                                            | `getData()`            | 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.String`                             | `getId()`              | Returns the platform event occurrence id for event invocation.                  |
| `java.net.URI`                                 | `getSource()`          | 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.String`                             | `getType()`            | 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
