- All Known Subinterfaces:
MessageReader
- All Known Implementing Classes:
BaseBinaryMessageReader,BaseGenericBinaryMessageReaderImpl,BaseStructuredMessageReader,GenericStructuredMessageReader
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a CloudEvent message in structured mode.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StructuredMessageReaderfrom(io.cloudevents.CloudEvent event, EventFormat format) Create a generic structured message from aCloudEvent.static StructuredMessageReaderCreate a generic structured message from aCloudEvent.<R> Rread(StructuredMessageWriter<R> writer) Read self using the provided writer.default io.cloudevents.CloudEventtoEvent()default io.cloudevents.CloudEventtoEvent(io.cloudevents.rw.CloudEventDataMapper<? extends io.cloudevents.CloudEventData> mapper)
-
Method Details
-
read
<R> R read(StructuredMessageWriter<R> writer) throws io.cloudevents.rw.CloudEventRWException, IllegalStateException Read self using the provided writer.- Type Parameters:
R- the return type of theStructuredMessageWriter- Parameters:
writer- the writer to use to write out the message- Returns:
- the return value returned by
StructuredMessageWriter.setEvent(EventFormat, byte[]) - Throws:
io.cloudevents.rw.CloudEventRWException- If something went wrong whenIllegalStateException- If the message is not a valid structured message
-
toEvent
default io.cloudevents.CloudEvent toEvent() throws io.cloudevents.rw.CloudEventRWException, IllegalStateException- Throws:
io.cloudevents.rw.CloudEventRWExceptionIllegalStateException
-
toEvent
default io.cloudevents.CloudEvent toEvent(io.cloudevents.rw.CloudEventDataMapper<? extends io.cloudevents.CloudEventData> mapper) throws io.cloudevents.rw.CloudEventRWException, IllegalStateException - Throws:
io.cloudevents.rw.CloudEventRWExceptionIllegalStateException
-
from
Create a generic structured message from aCloudEvent.- Parameters:
event- the event to convert toStructuredMessageReadercontentType- content type to use to resolve theEventFormat- Returns:
- null if format was not found, otherwise returns the built message
-
from
Create a generic structured message from aCloudEvent.- Parameters:
event- the event to convert toStructuredMessageReaderformat- the format to use to perform the conversion- Returns:
- null if format was not found, otherwise returns the built message
-