Class CloudEventMessageUtils
- java.lang.Object
-
- org.springframework.cloud.function.cloudevent.CloudEventMessageUtils
-
public final class CloudEventMessageUtils extends Object
Miscellaneous utility methods to assist with representing Cloud Event as SpringMessage.
Primarily intended for the internal use within Spring-based frameworks and integrations.- Since:
- 3.1
- Author:
- Oleg Zhurakousky, Dave Syer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCloudEventMessageUtils.Protocols
-
Field Summary
Fields Modifier and Type Field Description static StringAMQP_ATTR_PREFIXAMQP attributes prefix.static org.springframework.util.MimeTypeAPPLICATION_CLOUDEVENTSMimeTypeinstance representing 'application/cloudevents' mime type.static StringAPPLICATION_CLOUDEVENTS_VALUEString value of 'application/cloudevents' mime type.static StringCLOUDEVENT_VALUEString value of 'cloudevent'.static StringDATAValue for 'data' attribute.static StringDATACONTENTTYPEValue for 'datacontenttype' attribute.static StringDATASCHEMAValue for 'dataschema' attribute.static StringDEFAULT_ATTR_PREFIXPrefix for attributes.static StringIDValue for 'id' attribute.static StringKAFKA_ATTR_PREFIXPrefix for attributes.static StringSCHEMAURLV03 name for 'dataschema' attribute.static StringSOURCEValue for 'source' attribute.static StringSPECVERSIONValue for 'specversion' attribute.static StringSUBJECTValue for 'subject' attribute.static StringTIMEValue for 'time' attribute.static StringTYPEValue for 'type' attribute.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>getAttributes(org.springframework.messaging.Message<?> message)static <T> TgetData(org.springframework.messaging.Message<?> message)static StringgetDataContentType(org.springframework.messaging.Message<?> message)static URIgetDataSchema(org.springframework.messaging.Message<?> message)static StringgetId(org.springframework.messaging.Message<?> message)static URIgetSource(org.springframework.messaging.Message<?> message)static StringgetSpecVersion(org.springframework.messaging.Message<?> message)static StringgetSubject(org.springframework.messaging.Message<?> message)static OffsetDateTimegetTime(org.springframework.messaging.Message<?> message)static StringgetType(org.springframework.messaging.Message<?> message)static booleanisCloudEvent(org.springframework.messaging.Message<?> message)Will check for the existence of required attributes.
-
-
-
Field Detail
-
CLOUDEVENT_VALUE
public static String CLOUDEVENT_VALUE
String value of 'cloudevent'. Typically used asMessageUtils.MESSAGE_TYPE
-
APPLICATION_CLOUDEVENTS_VALUE
public static String APPLICATION_CLOUDEVENTS_VALUE
String value of 'application/cloudevents' mime type.
-
APPLICATION_CLOUDEVENTS
public static org.springframework.util.MimeType APPLICATION_CLOUDEVENTS
MimeTypeinstance representing 'application/cloudevents' mime type.
-
DEFAULT_ATTR_PREFIX
public static String DEFAULT_ATTR_PREFIX
Prefix for attributes.
-
AMQP_ATTR_PREFIX
public static String AMQP_ATTR_PREFIX
AMQP attributes prefix.
-
KAFKA_ATTR_PREFIX
public static String KAFKA_ATTR_PREFIX
Prefix for attributes.
-
DATA
public static String DATA
Value for 'data' attribute.
-
ID
public static String ID
Value for 'id' attribute.
-
SOURCE
public static String SOURCE
Value for 'source' attribute.
-
SPECVERSION
public static String SPECVERSION
Value for 'specversion' attribute.
-
TYPE
public static String TYPE
Value for 'type' attribute.
-
DATACONTENTTYPE
public static String DATACONTENTTYPE
Value for 'datacontenttype' attribute.
-
DATASCHEMA
public static String DATASCHEMA
Value for 'dataschema' attribute.
-
SCHEMAURL
public static final String SCHEMAURL
V03 name for 'dataschema' attribute.
-
SUBJECT
public static String SUBJECT
Value for 'subject' attribute.
-
TIME
public static String TIME
Value for 'time' attribute.
-
-
Method Detail
-
getId
public static String getId(org.springframework.messaging.Message<?> message)
-
getSource
public static URI getSource(org.springframework.messaging.Message<?> message)
-
getSpecVersion
public static String getSpecVersion(org.springframework.messaging.Message<?> message)
-
getType
public static String getType(org.springframework.messaging.Message<?> message)
-
getDataContentType
public static String getDataContentType(org.springframework.messaging.Message<?> message)
-
getDataSchema
public static URI getDataSchema(org.springframework.messaging.Message<?> message)
-
getSubject
public static String getSubject(org.springframework.messaging.Message<?> message)
-
getTime
public static OffsetDateTime getTime(org.springframework.messaging.Message<?> message)
-
getData
public static <T> T getData(org.springframework.messaging.Message<?> message)
-
getAttributes
public static Map<String,Object> getAttributes(org.springframework.messaging.Message<?> message)
-
isCloudEvent
public static boolean isCloudEvent(org.springframework.messaging.Message<?> message)
Will check for the existence of required attributes. Assumes attributes (headers) are in canonical form.- Parameters:
message- inputMessage- Returns:
- true if this Message represents Cloud Event in binary-mode
-
-