@ParametersAreNonnullByDefault
public interface CloudEventReader
Represents an object that can be read as CloudEvent.
The read may consume this object, hence it's not safe to invoke it multiple times, unless it's explicitly allowed by the implementer.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <W extends CloudEventWriter<R>,R>
Rread(CloudEventWriterFactory<W, R> writerFactory) Likeread(CloudEventWriterFactory, CloudEventDataMapper), but with the identityCloudEventDataMapper.<W extends CloudEventWriter<R>,R>
Rread(CloudEventWriterFactory<W, R> writerFactory, CloudEventDataMapper<? extends CloudEventData> mapper) Read self using the provided writer factory.
-
Method Details
-
read
default <W extends CloudEventWriter<R>,R> R read(CloudEventWriterFactory<W, R> writerFactory) throws CloudEventRWExceptionLikeread(CloudEventWriterFactory, CloudEventDataMapper), but with the identityCloudEventDataMapper.- Type Parameters:
W- The type of theCloudEventWritercreated by writerFactoryR- The return value of theCloudEventWritercreated by writerFactory- Parameters:
writerFactory- a factory that generates a visitor starting from the SpecVersion of the event- Returns:
- the value returned by
CloudEventWriter.end()orCloudEventWriter.end(CloudEventData) - Throws:
CloudEventRWException- if something went wrong during the read.- See Also:
-
read
<W extends CloudEventWriter<R>,R> R read(CloudEventWriterFactory<W, R> writerFactory, CloudEventDataMapper<? extends CloudEventData> mapper) throws CloudEventRWExceptionRead self using the provided writer factory.- Type Parameters:
W- theCloudEventWritertypeR- the return type of theCloudEventWriter- Parameters:
writerFactory- a factory that generates a visitor starting from the SpecVersion of the eventmapper- the mapper to invoke when building theCloudEventData- Returns:
- the value returned by
CloudEventWriter.end()orCloudEventWriter.end(CloudEventData) - Throws:
CloudEventRWException- if something went wrong during the read.
-