public class MessageUtils extends Object
MessageReader and MessageWriter related code.| Constructor and Description |
|---|
MessageUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <V> Map<String,V> |
generateAttributesToHeadersMapping(Function<String,V> headerNameMapping)
Generate a map with cloudevents attributes as keys and header keys as values
|
static IllegalStateException |
generateWrongEncoding(Encoding expected,
Encoding actual) |
static MessageReader |
parseStructuredOrBinaryMessage(Supplier<String> contentTypeHeaderReader,
Function<EventFormat,MessageReader> structuredMessageFactory,
Supplier<String> specVersionHeaderReader,
Function<SpecVersion,MessageReader> binaryMessageFactory)
Common flow to parse an incoming message that could be structured or binary.
|
public static MessageReader parseStructuredOrBinaryMessage(Supplier<String> contentTypeHeaderReader, Function<EventFormat,MessageReader> structuredMessageFactory, Supplier<String> specVersionHeaderReader, Function<SpecVersion,MessageReader> binaryMessageFactory) throws CloudEventRWException
contentTypeHeaderReader - supplier that returns the content type header, if anystructuredMessageFactory - factory to create the structured MessageReader from the provided EventFormatspecVersionHeaderReader - supplier that returns the spec version header, if anybinaryMessageFactory - factory to create the binary MessageReader from the provided SpecVersionMessageReaderCloudEventRWException - if something goes wrong while resolving the SpecVersion or if the message has unknown encodingpublic static <V> Map<String,V> generateAttributesToHeadersMapping(Function<String,V> headerNameMapping)
V - Header key typeheaderNameMapping - mapper to generate the header namepublic static IllegalStateException generateWrongEncoding(Encoding expected, Encoding actual)
expected - the expected encodingactual - the actual encodingIllegalStateException.Copyright © 2023. All rights reserved.