Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure the passed in auditor as well #46

Merged
merged 1 commit into from
Jun 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,13 @@ private LiKafkaConsumerImpl(LiKafkaConsumerConfig configs,
DeliveredMessageOffsetTracker messageOffsetTracker = new DeliveredMessageOffsetTracker(maxTrackedMessagesPerPartition);

// Instantiate auditor if needed.
Auditor<K, V> auditor = consumerAuditor != null ? consumerAuditor
: configs.getConfiguredInstance(LiKafkaConsumerConfig.AUDITOR_CLASS_CONFIG, Auditor.class);
Auditor<K, V> auditor;
if (consumerAuditor != null) {
auditor = consumerAuditor;
auditor.configure(configs.originals());
} else {
auditor = configs.getConfiguredInstance(LiKafkaConsumerConfig.AUDITOR_CLASS_CONFIG, Auditor.class);
}
auditor.start();

// Instantiate key and value deserializer if needed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,12 @@ private LiKafkaProducerImpl(LiKafkaProducerConfig configs,
_uuidFactory = configs.getConfiguredInstance(LiKafkaProducerConfig.UUID_FACTORY_CLASS_CONFIG, UUIDFactory.class);
_messageSplitter = new MessageSplitterImpl(_maxMessageSegmentSize, segmentSerializer, _uuidFactory);
// Instantiate auditor if necessary
_auditor = auditor != null ? auditor
: configs.getConfiguredInstance(LiKafkaProducerConfig.AUDITOR_CLASS_CONFIG, Auditor.class, _producer);
if (auditor != null) {
_auditor = auditor;
_auditor.configure(configs.configsWithCurrentProducer(_producer));
} else {
_auditor = configs.getConfiguredInstance(LiKafkaProducerConfig.AUDITOR_CLASS_CONFIG, Auditor.class, _producer);
}
_auditor.start();
_numThreadsInSend = new AtomicInteger(0);
_closed = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public void testProducerConfigure() {
producerConfig.close();

final TestAuditor producerAuditor = new TestAuditor();
producerAuditor.configure(props);
LiKafkaProducer producerInstance = new LiKafkaProducerImpl(getProducerProperties(new Properties()),
null, null, null, producerAuditor);
assertEquals(1, TestAuditor.configureMethodInvocations.get().intValue());
Expand All @@ -53,7 +52,6 @@ public void testConsumerConfigure() {
producerConfig.close();

final TestAuditor consumerAuditor = new TestAuditor();
consumerAuditor.configure(props);
LiKafkaConsumerImpl producerInstance = new LiKafkaConsumerImpl(getConsumerProperties(new Properties()),
null, null, null, consumerAuditor);
assertEquals(1, TestAuditor.configureMethodInvocations.get().intValue());
Expand Down