Merge pull request #7723 from artembilan/KafkaPropertiesTypes
* pr/7723: Fix typo in Kafka sample Fix compatibility with Apache Kafka 0.10.1
This commit is contained in:
commit
2e0f87e753
|
@ -43,6 +43,7 @@ import org.springframework.util.CollectionUtils;
|
|||
*
|
||||
* @author Gary Russell
|
||||
* @author Stephane Nicoll
|
||||
* @author Artem Bilan
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.kafka")
|
||||
|
@ -199,7 +200,7 @@ public class KafkaProperties {
|
|||
* Frequency in milliseconds that the consumer offsets are auto-committed to Kafka
|
||||
* if 'enable.auto.commit' true.
|
||||
*/
|
||||
private Long autoCommitInterval;
|
||||
private Integer autoCommitInterval;
|
||||
|
||||
/**
|
||||
* What to do when there is no initial offset in Kafka or if the current offset
|
||||
|
@ -264,11 +265,11 @@ public class KafkaProperties {
|
|||
return this.ssl;
|
||||
}
|
||||
|
||||
public Long getAutoCommitInterval() {
|
||||
public Integer getAutoCommitInterval() {
|
||||
return this.autoCommitInterval;
|
||||
}
|
||||
|
||||
public void setAutoCommitInterval(Long autoCommitInterval) {
|
||||
public void setAutoCommitInterval(Integer autoCommitInterval) {
|
||||
this.autoCommitInterval = autoCommitInterval;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ public class KafkaAutoConfigurationTests {
|
|||
assertThat(configs.get(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG))
|
||||
.isEqualTo(Boolean.FALSE);
|
||||
assertThat(configs.get(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG))
|
||||
.isEqualTo(123L);
|
||||
.isEqualTo(123);
|
||||
assertThat(configs.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG))
|
||||
.isEqualTo("earliest");
|
||||
assertThat(configs.get(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG)).isEqualTo(456);
|
||||
|
|
|
@ -64,11 +64,10 @@ public class KafkaSpecialProducerConsumerConfigExample {
|
|||
*/
|
||||
@Bean
|
||||
public ConsumerFactory<?, ?> kafkaConsumerFactory(KafkaProperties properties) {
|
||||
Map<String, Object> consumererProperties = properties
|
||||
.buildConsumerProperties();
|
||||
consumererProperties.put(CommonClientConfigs.METRIC_REPORTER_CLASSES_CONFIG,
|
||||
Map<String, Object> consumerProperties = properties.buildConsumerProperties();
|
||||
consumerProperties.put(CommonClientConfigs.METRIC_REPORTER_CLASSES_CONFIG,
|
||||
MyConsumerMetricsReporter.class);
|
||||
return new DefaultKafkaConsumerFactory<Object, Object>(consumererProperties);
|
||||
return new DefaultKafkaConsumerFactory<Object, Object>(consumerProperties);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue