Skip to content

Commit

Permalink
event 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghanzheng committed Jul 25, 2022
1 parent ed30a1e commit 497c4ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.context.annotation.Bean;
Expand All @@ -29,6 +30,7 @@
import org.springframework.kafka.support.ProducerListener;
import org.springframework.kafka.support.converter.RecordMessageConverter;
import org.springframework.kafka.transaction.KafkaTransactionManager;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;

import java.time.Duration;
Expand Down Expand Up @@ -114,7 +116,7 @@ public KafkaEventEngine kafkaEventEngine(ConfigurableBeanFactory beanFactory,
ConsumerFactory<Object, Object> consumerFactory = createConsumerFactory(value);

KafkaTransactionManager<Object, Object> kafkaTransactionManager =
registerKafkaTransactionManager(value, producerFactory);
createKafkaTransactionManager(value, producerFactory);

KafkaListenerContainerFactory<? extends MessageListenerContainer> kafkaListenerContainerFactory =
createKafkaListenerContainerFactory(value, consumerFactory, kafkaTransactionManager);
Expand Down Expand Up @@ -226,12 +228,15 @@ private KafkaListenerContainerFactory<? extends MessageListenerContainer> create
map.from(listenerProperties::getMonitorInterval).as(Duration::getSeconds).as(Number::intValue)
.to(container::setMonitorInterval);
map.from(listenerProperties::getLogContainerConfig).to(container::setLogContainerConfig);
map.from(listenerProperties::isOnlyLogRecordMetadata).to(container::setOnlyLogRecordMetadata);
if (ClassUtils.hasMethod(KafkaProperties.Listener.class, "isOnlyLogRecordMetadata") &&
ClassUtils.hasMethod(KafkaProperties.Listener.class, "setOnlyLogRecordMetadata")) {
map.from(listenerProperties::isOnlyLogRecordMetadata).to(container::setOnlyLogRecordMetadata);
}
map.from(listenerProperties::isMissingTopicsFatal).to(container::setMissingTopicsFatal);
return listenerContainerFactory;
}

private KafkaTransactionManager<Object, Object> registerKafkaTransactionManager(
private KafkaTransactionManager<Object, Object> createKafkaTransactionManager(
KafkaEventProperties.ExtendedKafkaProperties properties,
ProducerFactory<Object, Object> producerFactory) {
if (StringUtils.hasText(properties.getProducer().getTransactionIdPrefix())) {
Expand Down
2 changes: 1 addition & 1 deletion concept-event/version.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ext.'conceptEventVersion' = '0.3.0'
ext.'conceptEventVersion' = '0.4.0'

0 comments on commit 497c4ec

Please sign in to comment.