@ParametersAreNonnullByDefault public interface MessageReader extends StructuredMessageReader, CloudEventReader
This class expands the CloudEventReader to define reading both binary and structured messages.
| Modifier and Type | Method and Description |
|---|---|
Encoding |
getEncoding() |
default <W extends CloudEventWriter<R>,R> |
read(CloudEventWriterFactory<W,R> writerFactory)
Like
read(CloudEventWriterFactory, CloudEventDataMapper), but with the identity CloudEventDataMapper. |
<W extends CloudEventWriter<R>,R> |
read(CloudEventWriterFactory<W,R> writerFactory,
CloudEventDataMapper<? extends CloudEventData> mapper)
Read the message as binary encoded message using the provided writer factory.
|
default <BW extends CloudEventWriter<R>,R> |
read(MessageWriter<BW,R> writer)
Read the content of this object using a
MessageWriter. |
<R> R |
read(StructuredMessageWriter<R> writer)
Read the message as structured encoded message using the provided writer
|
default CloudEvent |
toEvent()
Like
toEvent(CloudEventDataMapper), but with the identity CloudEventDataMapper. |
default CloudEvent |
toEvent(CloudEventDataMapper<? extends CloudEventData> mapper)
Translate this message into a
CloudEvent representation, mapping the data with the provided mapper. |
from, fromdefault <W extends CloudEventWriter<R>,R> R read(CloudEventWriterFactory<W,R> writerFactory) throws CloudEventRWException, IllegalStateException
read(CloudEventWriterFactory, CloudEventDataMapper), but with the identity CloudEventDataMapper.read in interface CloudEventReaderCloudEventRWExceptionIllegalStateExceptionread(CloudEventWriterFactory, CloudEventDataMapper)<W extends CloudEventWriter<R>,R> R read(CloudEventWriterFactory<W,R> writerFactory, CloudEventDataMapper<? extends CloudEventData> mapper) throws CloudEventRWException, IllegalStateException
read in interface CloudEventReaderW - the CloudEventWriter typeR - the return type of the CloudEventWriterwriterFactory - a factory that generates a reader starting from the SpecVersion of the eventmapper - the mapper to use to map the data, if any.CloudEventRWException - if something went wrong during the visit.IllegalStateException - if the message is not in binary encoding.<R> R read(StructuredMessageWriter<R> writer) throws CloudEventRWException, IllegalStateException
read in interface StructuredMessageReaderR - the return type of the StructuredMessageWriterwriter - Structured Message writerStructuredMessageWriter.setEvent(EventFormat, byte[])CloudEventRWException - if something went wrong during the visit.IllegalStateException - if the message is not in structured encoding.Encoding getEncoding()
default <BW extends CloudEventWriter<R>,R> R read(MessageWriter<BW,R> writer) throws CloudEventRWException, IllegalStateException
MessageWriter. This method allows to transcode an event from one transport to another without
converting it to CloudEvent. The resulting encoding will be the same as the original encoding.BW - the CloudEventWriter typeR - the return type of both CloudEventWriter and StructuredMessageWriterwriter - the MessageWriter accepting this MessageMessageWriterCloudEventRWException - if something went wrong during the visit.IllegalStateException - if the message has an unknown encoding.default CloudEvent toEvent() throws CloudEventRWException, IllegalStateException
toEvent(CloudEventDataMapper), but with the identity CloudEventDataMapper.toEvent in interface StructuredMessageReaderCloudEventRWExceptionIllegalStateExceptiontoEvent(CloudEventDataMapper)default CloudEvent toEvent(CloudEventDataMapper<? extends CloudEventData> mapper) throws CloudEventRWException, IllegalStateException
CloudEvent representation, mapping the data with the provided mapper.toEvent in interface StructuredMessageReadermapper - the mapper to use to map the data, if any.CloudEvent with the contents of this message.CloudEventRWException - if something went wrong during the read.IllegalStateException - if the message has an unknown encoding.Copyright © 2024. All rights reserved.