Interface KafkaToMqttTransformer
-
- All Superinterfaces:
Transformer<KafkaToMqttInitInput>
- 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 KafkaToMqttTransformer extends Transformer<KafkaToMqttInitInput>
Implement this transformer for the programmatic creation ofPublishes
fromKafkaRecords
. One instance of the implementing class is created per reference in the kafka-configuration.xml. The methods of this interface may be called concurrently and must be thread-safe.Your implementation of the KafkaToMqttTransformer must be placed in a Java archive (.jar) together with all its dependencies in the
customizations
folder of the "HiveMQ Enterprise Extension for Kafka". In addition, a<kafka-to-mqtt-transformer>
referencing the implementing class via its canonical name must be configured in thekafka-extension.xml
file.- Since:
- 4.5.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
transformKafkaToMqtt(@NotNull KafkaToMqttInput input, @NotNull KafkaToMqttOutput output)
This callback is executed for everyKafkaRecord
that the "HiveMQ Enterprise Extension for Kafka" polls from Kafka according to the configured<kafka-topics>
in the<kafka-to-mqtt-transformer>
tag.-
Methods inherited from interface com.hivemq.extensions.kafka.api.transformers.Transformer
init
-
-
-
-
Method Detail
-
transformKafkaToMqtt
@ThreadSafe void transformKafkaToMqtt(@NotNull @NotNull KafkaToMqttInput input, @NotNull @NotNull KafkaToMqttOutput output)
This callback is executed for everyKafkaRecord
that the "HiveMQ Enterprise Extension for Kafka" polls from Kafka according to the configured<kafka-topics>
in the<kafka-to-mqtt-transformer>
tag.It allows the publication of any number of
Publishes
via theKafkaToMqttOutput
object. This method is called by multiple threads concurrently. Extensions are responsible for their own exception handling and this method must not throw anyException
.- Parameters:
input
- TheKafkaToMqttInput
contains the triggeringKafkaRecord
and theKafkaCluster
information.output
- TheKafkaToMqttOutput
allows toprovide a list of Publishes
. If no output is set, an empty List is used as default and the kafka record will not be processed again, but ignored.- Since:
- 4.5.0
-
-