Interface JsonPayloadCreator

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface JsonPayloadCreator
Interface to overwrite the default creation of payloads from samples.
  • Method Details

    • convertToJson

      @NotNull @NotNull List<byte[]> convertToJson(@NotNull @NotNull ProtocolAdapterDataSample sample, @NotNull @NotNull com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Parameters:
      sample - the sample containing the data points and the polling context
      objectMapper - object mapper instance that can be used to create the payloads
      Returns:
      a list containing the payload for the mqtt publishes that will be created. The implementation can decide to put all data points into a single payload or split them. This is indicated via PollingContext.getMessageHandlingOptions(). The resulting bytes MUST be utf-8 encoded jsons.