Deprecate KTU.senderProps()

This commit is contained in:
Gary Russell
2019-12-10 10:28:16 -05:00
committed by Artem Bilan
parent 16a12fe33f
commit e326722c55
7 changed files with 20 additions and 8 deletions

View File

@@ -82,7 +82,7 @@ public final class KafkaTestUtils {
* @return the properties. * @return the properties.
*/ */
public static Map<String, Object> producerProps(EmbeddedKafkaBroker embeddedKafka) { public static Map<String, Object> producerProps(EmbeddedKafkaBroker embeddedKafka) {
return senderProps(embeddedKafka.getBrokersAsString()); return producerProps(embeddedKafka.getBrokersAsString());
} }
@@ -109,8 +109,9 @@ public final class KafkaTestUtils {
* Set up test properties for an {@code <Integer, String>} producer. * Set up test properties for an {@code <Integer, String>} producer.
* @param brokers the bootstrapServers property. * @param brokers the bootstrapServers property.
* @return the properties. * @return the properties.
* @since 2.3.5
*/ */
public static Map<String, Object> senderProps(String brokers) { public static Map<String, Object> producerProps(String brokers) {
Map<String, Object> props = new HashMap<>(); Map<String, Object> props = new HashMap<>();
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, brokers); props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, brokers);
props.put(ProducerConfig.RETRIES_CONFIG, 0); props.put(ProducerConfig.RETRIES_CONFIG, 0);
@@ -122,6 +123,17 @@ public final class KafkaTestUtils {
return props; return props;
} }
/**
* Set up test properties for an {@code <Integer, String>} producer.
* @param brokers the bootstrapServers property.
* @return the properties.
* @deprecated in favor of {@link #producerProps(String)}.
*/
@Deprecated
public static Map<String, Object> senderProps(String brokers) {
return producerProps(brokers);
}
/** /**
* Poll the consumer, expecting a single record for the specified topic. * Poll the consumer, expecting a single record for the specified topic.
* @param consumer the consumer. * @param consumer the consumer.

View File

@@ -109,7 +109,7 @@ public class ReactiveKafkaProducerTemplateIntegrationTests {
private SenderOptions<Integer, String> setupSenderOptionsWithDefaultTopic() { private SenderOptions<Integer, String> setupSenderOptionsWithDefaultTopic() {
Map<String, Object> senderProps = Map<String, Object> senderProps =
KafkaTestUtils.senderProps(EmbeddedKafkaCondition.getBroker().getBrokersAsString()); KafkaTestUtils.producerProps(EmbeddedKafkaCondition.getBroker().getBrokersAsString());
return SenderOptions.create(senderProps); return SenderOptions.create(senderProps);
} }

View File

@@ -97,7 +97,7 @@ public class ReactiveKafkaProducerTemplateTransactionIntegrationTests {
private SenderOptions<Integer, String> setupSenderOptionsWithDefaultTopic() { private SenderOptions<Integer, String> setupSenderOptionsWithDefaultTopic() {
Map<String, Object> senderProps = Map<String, Object> senderProps =
KafkaTestUtils.senderProps(EmbeddedKafkaCondition.getBroker().getBrokersAsString()); KafkaTestUtils.producerProps(EmbeddedKafkaCondition.getBroker().getBrokersAsString());
SenderOptions<Integer, String> senderOptions = SenderOptions.create(senderProps); SenderOptions<Integer, String> senderOptions = SenderOptions.create(senderProps);
senderOptions = senderOptions senderOptions = senderOptions
.producerProperty(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "reactive.transaction") .producerProperty(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "reactive.transaction")

View File

@@ -134,7 +134,7 @@ public class KafkaStreamsBranchTests {
@Bean @Bean
public Map<String, Object> producerConfigs() { public Map<String, Object> producerConfigs() {
return KafkaTestUtils.senderProps(this.brokerAddresses); return KafkaTestUtils.producerProps(this.brokerAddresses);
} }
@Bean @Bean

View File

@@ -191,7 +191,7 @@ public class KafkaStreamsJsonSerializationTests {
@Bean @Bean
public Map<String, Object> producerConfigs() { public Map<String, Object> producerConfigs() {
Map<String, Object> senderProps = KafkaTestUtils.senderProps(this.brokerAddresses); Map<String, Object> senderProps = KafkaTestUtils.producerProps(this.brokerAddresses);
senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, JsonSerializer.class); senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class); senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
return senderProps; return senderProps;

View File

@@ -181,7 +181,7 @@ public class KafkaStreamsTests {
@Bean @Bean
public Map<String, Object> producerConfigs() { public Map<String, Object> producerConfigs() {
return KafkaTestUtils.senderProps(this.brokerAddresses); return KafkaTestUtils.producerProps(this.brokerAddresses);
} }
@Bean @Bean

View File

@@ -169,7 +169,7 @@ public class RecoveringDeserializationExceptionHandlerTests {
@Bean @Bean
public Map<String, Object> producerConfigs() { public Map<String, Object> producerConfigs() {
Map<String, Object> senderProps = KafkaTestUtils.senderProps(this.brokerAddresses); Map<String, Object> senderProps = KafkaTestUtils.producerProps(this.brokerAddresses);
senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class); senderProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class);
senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class); senderProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class);
return senderProps; return senderProps;