io.quarkus.kafka.client.serialization.ObjectMapperProducer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-kafka-client Show documentation
Show all versions of quarkus-kafka-client Show documentation
Connect to Apache Kafka with its native API
package io.quarkus.kafka.client.serialization;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.arc.Arc;
import io.quarkus.arc.ArcContainer;
final class ObjectMapperProducer {
private ObjectMapperProducer() {
}
// Try to get the ObjectMapper from Arc but fallback to regular ObjectMapper creation
// The fallback could be used for example in unit tests where Arc has not been initialized
static ObjectMapper get() {
ObjectMapper objectMapper = null;
ArcContainer container = Arc.container();
if (container != null) {
objectMapper = container.instance(ObjectMapper.class).get();
}
return objectMapper != null ? objectMapper : new ObjectMapper();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy