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 class
CloudEventMessageUtils.Protocols
-
Field Summary
Fields Modifier and Type Field Description static String
AMQP_ATTR_PREFIX
AMQP attributes prefix.static org.springframework.util.MimeType
APPLICATION_CLOUDEVENTS
MimeType
instance representing 'application/cloudevents' mime type.static String
APPLICATION_CLOUDEVENTS_VALUE
String value of 'application/cloudevents' mime type.static String
CLOUDEVENT_VALUE
String value of 'cloudevent'.static String
DATA
Value for 'data' attribute.static String
DATACONTENTTYPE
Value for 'datacontenttype' attribute.static String
DATASCHEMA
Value for 'dataschema' attribute.static String
DEFAULT_ATTR_PREFIX
Prefix for attributes.static String
ID
Value for 'id' attribute.static String
KAFKA_ATTR_PREFIX
Prefix for attributes.static String
SCHEMAURL
V03 name for 'dataschema' attribute.static String
SOURCE
Value for 'source' attribute.static String
SPECVERSION
Value for 'specversion' attribute.static String
SUBJECT
Value for 'subject' attribute.static String
TIME
Value for 'time' attribute.static String
TYPE
Value 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> T
getData(org.springframework.messaging.Message<?> message)
static String
getDataContentType(org.springframework.messaging.Message<?> message)
static URI
getDataSchema(org.springframework.messaging.Message<?> message)
static String
getId(org.springframework.messaging.Message<?> message)
static URI
getSource(org.springframework.messaging.Message<?> message)
static String
getSpecVersion(org.springframework.messaging.Message<?> message)
static String
getSubject(org.springframework.messaging.Message<?> message)
static OffsetDateTime
getTime(org.springframework.messaging.Message<?> message)
static String
getType(org.springframework.messaging.Message<?> message)
static boolean
isCloudEvent(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
MimeType
instance 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
-
-