class InfluxDbReporterFactory extends BaseReporterFactory {

    @Override
    public ScheduledReporter build(MetricRegistry registry) {
        try {
            InfluxDbReporter.Builder builder = builder(registry);

            switch (senderType) {
                case HTTP:
                    return builder.build(
                        new InfluxDbHttpSender(
                            protocol,
                            host,
                            port,
                            database,
                            auth,
                            precision.getUnit(),
                            connectTimeout,
                            readTimeout,
                            prefix
                        )
                    );
                case TCP:
                    return builder.build(
                        new InfluxDbTcpSender(
                            host,
                            port,
                            readTimeout,
                            database,
                            prefix
                        )
                    );
                case UDP:
                    return builder.build(
                        new InfluxDbUdpSender(
                            host,
                            port,
                            readTimeout,
                            database,
                            prefix
                        )
                    );
                case LOGGER:
                    return builder.build(
                        new InfluxDbLoggerSender(
                            database,
                            TimeUnit.MILLISECONDS,
                            prefix
                        )
                    );
                case KAFKA:
                        return builder.build(
                        new InfluxDBKafkaSender(
                            database,
                            TimeUnit.MILLISECONDS,
                            prefix
                        )
                     );
                default:
                    throw new UnsupportedDataTypeException("The Sender Type is not supported. ");
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}