java.lang.Object
io.cloudevents.spring.messaging.CloudEventContextUtils
Utility class for copying message headers to and from
CloudEventContext.- Author:
- Dave Syer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.cloudevents.CloudEventContextHelper method for convertingMessageHeadersto aCloudEventContext.toMap(io.cloudevents.CloudEventContext context) Helper method for extractingMessageHeadersfrom aCloudEventContext.
-
Constructor Details
-
CloudEventContextUtils
public CloudEventContextUtils()
-
-
Method Details
-
fromMap
public static io.cloudevents.CloudEventContext fromMap(Map<String, Object> headers) throws io.cloudevents.rw.CloudEventRWExceptionHelper method for convertingMessageHeadersto aCloudEventContext. The input headers must represent a valid event in "binary" form, i.e. it must have headersce-id,ce-specversionetc.- Parameters:
headers- the input message headers- Returns:
- a
CloudEventContextthat can be used to create a newCloudEvent - Throws:
io.cloudevents.rw.CloudEventRWException- if something goes wrong while converting the headers toCloudEventContext
-
toMap
public static Map<String,Object> toMap(io.cloudevents.CloudEventContext context) throws io.cloudevents.rw.CloudEventRWException Helper method for extractingMessageHeadersfrom aCloudEventContext. The result will contain headers canonicalized with ace-prefix, analogous to the "binary" message format in Cloud Events.- Parameters:
context- the inputCloudEventContext- Returns:
- the response headers represented by the event
- Throws:
io.cloudevents.rw.CloudEventRWException- if something goes wrong while converting theCloudEventContextto headers
-