code: public <K, V> Optional<KafkaProducer<K, V>> getProducer(
        @NotNull final Serializer<K> keySerializer,
        @NotNull final Serializer<V> valueSerializer) {
      try {
        return partialConfigs.map(
            input -> new KafkaProducer<>(input, keySerializer, valueSerializer));
      } catch (final Exception e) {
        log.warn("error while generating KafkaProducer - {}", e);
        return Optional.empty();
      }
    }
docs: Returns a producer with customized serializers for keys and values.
  
  @param keySerializer   The serializer for key that implements {@link Serializer}.
  @param valueSerializer The serializer for value that implements {@link Serializer}.
  @param <K>             The type of the key {@link Serializer}.
  @param <V>             The type of the value {@link Serializer}.
  
  @return An {@link Optional} of {@link KafkaProducer}.