Interface AzureMessageConverter<I,O>

Type Parameters:
I - The Azure message type when sending to the broker using Azure SDK.
O - The Azure message type when receiving from the broker using Azure SDK.

public interface AzureMessageConverter<I,O>
A converter to turn the payload of a Message from serialized form to a typed Object and vice versa.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromMessage(org.springframework.messaging.Message<?> message, Class<O> targetClass)
    Convert the payload of a Message from a serialized form to a typed Object of the specified target class.
    default <U> org.springframework.messaging.Message<U>
    toMessage(I azureMessage, Class<U> targetPayloadClass)
    Create an empty header Message by default.
    <U> org.springframework.messaging.Message<U>
    toMessage(I azureMessage, Map<String,Object> headers, Class<U> targetPayloadClass)
    Create a Message whose payload is the result of converting the given payload Object to serialized form.
  • Method Details

    • fromMessage

      @Nullable O fromMessage(org.springframework.messaging.Message<?> message, Class<O> targetClass)
      Convert the payload of a Message from a serialized form to a typed Object of the specified target class.
      Parameters:
      message - the input message
      targetClass - the target class for the conversion
      Returns:
      the result of the conversion, or null if the converter cannot perform the conversion
    • toMessage

      @Nullable <U> org.springframework.messaging.Message<U> toMessage(I azureMessage, Map<String,Object> headers, Class<U> targetPayloadClass)
      Create a Message whose payload is the result of converting the given payload Object to serialized form. The optional MessageHeaders parameter may contain additional headers to be added to the message.
      Type Parameters:
      U - payload class type in message
      Parameters:
      azureMessage - the Object to convert
      headers - optional headers for the message
      targetPayloadClass - the target payload class for the conversion
      Returns:
      the new message, or null if the converter does not support the Object type or the target media type
    • toMessage

      @Nullable default <U> org.springframework.messaging.Message<U> toMessage(I azureMessage, Class<U> targetPayloadClass)
      Create an empty header Message by default.
      Type Parameters:
      U - payload class type in message
      Parameters:
      azureMessage - the Object to convert
      targetPayloadClass - the target payload class for the conversion
      Returns:
      the new message, or null if the converter does not support the * Object type or the target media type