I added the following ugly reflection code and it's working

try {
            Field f = ProducerConfig.class.getDeclaredField("config");
            f.setAccessible(true);
            ConfigDef config = (ConfigDef) f.get(ConfigDef.class);
            config.define(ServoReporter.class.getName(),
ConfigDef.Type.CLASS, ConfigDef.Importance.LOW, "");
        } catch (Exception e) {
            e.printStackTrace();
        }

On Wed, Nov 5, 2014 at 10:48 PM, Bae, Jae Hyeon <metac...@gmail.com> wrote:

> Hi
>
> When I set up
>
> props.put("metric.reporters",
> Lists.newArrayList(ServoReporter.class.getName()));
>
> I got the following error:
>
> org.apache.kafka.common.config.ConfigException: Unknown configuration
> 'com.netflix.suro.sink.kafka.ServoReporter'
> at
> org.apache.kafka.common.config.AbstractConfig.get(AbstractConfig.java:60)
> at
> org.apache.kafka.common.config.AbstractConfig.getClass(AbstractConfig.java:91)
> at
> org.apache.kafka.common.config.AbstractConfig.getConfiguredInstances(AbstractConfig.java:147)
> at
> org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:105)
> at
> org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:94)
>
> AbstractConfig.getClass throws an exception because it cannot find any
> definition of ServoReporter.class.getName() but I cannot add custom class
> definition because the class name is not defined in the key set of
> properties.
>
> Do you have any idea?
>
> Thank you
> Best, Jae
>

Reply via email to