Package com.hivemq.adapter.sdk.api.data
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.
Interface to overwrite the default creation of payloads from samples.
-
Method Summary
Modifier and TypeMethodDescriptionconvertToJson(@NotNull ProtocolAdapterDataSample sample, @NotNull com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
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 contextobjectMapper- 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.
-