Class CloudEventMessageUtils


  • public final class CloudEventMessageUtils
    extends Object
    Miscellaneous utility methods to assist with representing Cloud Event as Spring Message.
    Primarily intended for the internal use within Spring-based frameworks and integrations.
    Since:
    3.1
    Author:
    Oleg Zhurakousky, Dave Syer
    • Field Detail

      • 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 - input Message
        Returns:
        true if this Message represents Cloud Event in binary-mode