Class EventHubsBatchMessageConverter

java.lang.Object
com.azure.spring.messaging.converter.AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>
com.azure.spring.messaging.eventhubs.support.converter.EventHubsBatchMessageConverter
All Implemented Interfaces:
AzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>

public class EventHubsBatchMessageConverter extends AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>
A converter to turn a EventBatchContext to Message and vice versa.
  • Constructor Details

    • EventHubsBatchMessageConverter

      public EventHubsBatchMessageConverter()
      Construct the message converter with default ObjectMapper.
    • EventHubsBatchMessageConverter

      public EventHubsBatchMessageConverter(ObjectMapper objectMapper)
      Construct the message converter with customized ObjectMapper.
      Parameters:
      objectMapper - the object mapper.
  • Method Details

    • getObjectMapper

      protected ObjectMapper getObjectMapper()
      Specified by:
      getObjectMapper in class AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>
    • fromString

      protected com.azure.messaging.eventhubs.EventData fromString(String payload)
      Specified by:
      fromString in class AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>
    • fromByte

      protected com.azure.messaging.eventhubs.EventData fromByte(byte[] payload)
      Specified by:
      fromByte in class AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>
    • setCustomHeaders

      protected void setCustomHeaders(org.springframework.messaging.MessageHeaders headers, com.azure.messaging.eventhubs.EventData azureMessage)
      Overrides:
      setCustomHeaders in class AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>
    • getPayload

      protected Object getPayload(com.azure.messaging.eventhubs.models.EventBatchContext azureMessage)
      Specified by:
      getPayload in class AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>
    • internalToMessage

      protected <U> org.springframework.messaging.Message<?> internalToMessage(com.azure.messaging.eventhubs.models.EventBatchContext azureMessage, Map<String,Object> headers, Class<U> targetPayloadClass)
      adapt the payload and header for the target message
      Overrides:
      internalToMessage in class AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>
      Type Parameters:
      U - targetPayloadType
      Parameters:
      azureMessage - the context holding the original message payload
      headers - headers of original message
      targetPayloadClass - the type of target message
      Returns:
      the target message
    • buildCustomHeaders

      protected Map<String,Object> buildCustomHeaders(com.azure.messaging.eventhubs.models.EventBatchContext azureMessage)
      Overrides:
      buildCustomHeaders in class AbstractAzureMessageConverter<com.azure.messaging.eventhubs.models.EventBatchContext,com.azure.messaging.eventhubs.EventData>