/** * Creates a new Kafka writer using the given configuration. * * @param configuration * The configuration to use */ public KafkaWriter(final Configuration configuration) { this.bootstrapServers = configuration.getStringProperty(CONFIG_PROPERTY_BOOTSTRAP_SERVERS); this.topicName = configuration.getStringProperty(CONFIG_PROPERTY_TOPIC_NAME); this.acknowledges = configuration.getStringProperty(CONFIG_PROPERTY_ACKS, DEFAULT_ACKS); this.lingerMs = configuration.getIntProperty(CONFIG_PROPERTY_LINGER_MS, DEFAULT_LINGER_MS); this.batchSize = configuration.getIntProperty(CONFIG_PROPERTY_BATCH_SIZE, DEFAULT_BATCH_SIZE); this.bufferMemory = configuration.getIntProperty(CONFIG_PROPERTY_BUFFER_MEMORY, DEFAULT_BUFFER_MEMORY); this.checkConfiguration(); }
/** * Creates a new Kafka writer using the given configuration. * * @param configuration * The configuration to use */ public KafkaWriter(final Configuration configuration) { this.bootstrapServers = configuration.getStringProperty(CONFIG_PROPERTY_BOOTSTRAP_SERVERS); this.topicName = configuration.getStringProperty(CONFIG_PROPERTY_TOPIC_NAME); this.acknowledges = configuration.getStringProperty(CONFIG_PROPERTY_ACKS, DEFAULT_ACKS); this.lingerMs = configuration.getIntProperty(CONFIG_PROPERTY_LINGER_MS, DEFAULT_LINGER_MS); this.batchSize = configuration.getIntProperty(CONFIG_PROPERTY_BATCH_SIZE, DEFAULT_BATCH_SIZE); this.bufferMemory = configuration.getIntProperty(CONFIG_PROPERTY_BUFFER_MEMORY, DEFAULT_BUFFER_MEMORY); this.checkConfiguration(); }