Handle binder config in BindingProperties
- Per-binding properties defined in `BindingProperties` need to hold the binder specific configurations needed when binding producer/consumers. Previously, these were added in `ChannelBindingServiceProperties` as producer/consumer properties. Since these configuration properties are for per-binding based on the input/output (consumer/producer) channel being bound it is better to move these properties into `BindingProperties`. - Add some of the supported producer/consumer properties into BindingProperties - This fixes #256 Rename CommonBinderProperties -> BinderPropertyKeys Rename class AbstractBinderPropertiesAccessor.java -> AbstractBindingPropertiesAccessor.java
This commit is contained in:
committed by
Mark Fisher
parent
373dd12fbb
commit
fa89e5bcb6
@@ -37,10 +37,10 @@ import org.apache.kafka.clients.producer.ProducerConfig;
|
||||
import org.apache.kafka.common.serialization.ByteArraySerializer;
|
||||
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.cloud.stream.binder.AbstractBinderPropertiesAccessor;
|
||||
import org.springframework.cloud.stream.binder.AbstractBindingPropertiesAccessor;
|
||||
import org.springframework.cloud.stream.binder.BinderException;
|
||||
import org.springframework.cloud.stream.binder.BinderHeaders;
|
||||
import org.springframework.cloud.stream.binder.BinderProperties;
|
||||
import org.springframework.cloud.stream.binder.BinderPropertyKeys;
|
||||
import org.springframework.cloud.stream.binder.Binding;
|
||||
import org.springframework.cloud.stream.binder.EmbeddedHeadersMessageConverter;
|
||||
import org.springframework.cloud.stream.binder.MessageChannelBinderSupport;
|
||||
@@ -191,7 +191,7 @@ public class KafkaMessageChannelBinder extends MessageChannelBinderSupport {
|
||||
private static final String POINT_TO_POINT_SEMANTICS_CONSUMER_GROUP = "springXD";
|
||||
|
||||
private static final Set<Object> KAFKA_CONSUMER_PROPERTIES = new SetBuilder()
|
||||
.add(BinderProperties.MIN_PARTITION_COUNT)
|
||||
.add(BinderPropertyKeys.MIN_PARTITION_COUNT)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -200,14 +200,14 @@ public class KafkaMessageChannelBinder extends MessageChannelBinderSupport {
|
||||
private static final Set<Object> SUPPORTED_CONSUMER_PROPERTIES = new SetBuilder()
|
||||
.addAll(CONSUMER_STANDARD_PROPERTIES)
|
||||
.addAll(KAFKA_CONSUMER_PROPERTIES)
|
||||
.add(BinderProperties.PARTITION_INDEX) // Not actually used
|
||||
.add(BinderProperties.COUNT) // Not actually used
|
||||
.add(BinderProperties.CONCURRENCY)
|
||||
.add(BinderPropertyKeys.PARTITION_INDEX) // Not actually used
|
||||
.add(BinderPropertyKeys.COUNT) // Not actually used
|
||||
.add(BinderPropertyKeys.CONCURRENCY)
|
||||
.add(FETCH_SIZE)
|
||||
.build();
|
||||
|
||||
private static final Set<Object> KAFKA_PRODUCER_PROPERTIES = new SetBuilder()
|
||||
.add(BinderProperties.MIN_PARTITION_COUNT)
|
||||
.add(BinderPropertyKeys.MIN_PARTITION_COUNT)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -228,7 +228,7 @@ public class KafkaMessageChannelBinder extends MessageChannelBinderSupport {
|
||||
private static final Set<Object> SUPPORTED_PRODUCER_PROPERTIES = new SetBuilder()
|
||||
.addAll(PRODUCER_PARTITIONING_PROPERTIES)
|
||||
.addAll(PRODUCER_STANDARD_PROPERTIES)
|
||||
.add(BinderProperties.DIRECT_BINDING_ALLOWED)
|
||||
.add(BinderPropertyKeys.DIRECT_BINDING_ALLOWED)
|
||||
.addAll(KAFKA_PRODUCER_PROPERTIES)
|
||||
.addAll(PRODUCER_BATCHING_BASIC_PROPERTIES)
|
||||
.addAll(PRODUCER_COMPRESSION_PROPERTIES)
|
||||
@@ -787,7 +787,7 @@ public class KafkaMessageChannelBinder extends MessageChannelBinderSupport {
|
||||
}
|
||||
}
|
||||
|
||||
private class KafkaPropertiesAccessor extends AbstractBinderPropertiesAccessor {
|
||||
private class KafkaPropertiesAccessor extends AbstractBindingPropertiesAccessor {
|
||||
|
||||
public KafkaPropertiesAccessor(Properties properties) {
|
||||
super(properties);
|
||||
@@ -798,7 +798,7 @@ public class KafkaMessageChannelBinder extends MessageChannelBinderSupport {
|
||||
if (nextModuleCount == 0) {
|
||||
throw new IllegalArgumentException("Module count cannot be zero");
|
||||
}
|
||||
int nextModuleConcurrency = getProperty(NEXT_MODULE_CONCURRENCY, defaultConcurrency);
|
||||
int nextModuleConcurrency = getProperty(BinderPropertyKeys.NEXT_MODULE_CONCURRENCY, defaultConcurrency);
|
||||
int minKafkaPartitions = getMinPartitionCount(defaultMinPartitionCount);
|
||||
return Math.max(minKafkaPartitions, nextModuleCount * nextModuleConcurrency);
|
||||
}
|
||||
@@ -826,7 +826,7 @@ public class KafkaMessageChannelBinder extends MessageChannelBinderSupport {
|
||||
}
|
||||
|
||||
public int getMinPartitionCount(int defaultPartitionCount) {
|
||||
return getProperty(MIN_PARTITION_COUNT, defaultPartitionCount);
|
||||
return getProperty(BinderPropertyKeys.MIN_PARTITION_COUNT, defaultPartitionCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.cloud.stream.binder.Binder;
|
||||
import org.springframework.cloud.stream.binder.BinderProperties;
|
||||
import org.springframework.cloud.stream.binder.BinderPropertyKeys;
|
||||
import org.springframework.cloud.stream.binder.PartitionCapableBinderTests;
|
||||
import org.springframework.cloud.stream.binder.Spy;
|
||||
import org.springframework.cloud.stream.test.junit.kafka.KafkaTestSupport;
|
||||
@@ -162,9 +162,9 @@ public class KafkaBinderTests extends PartitionCapableBinderTests {
|
||||
DirectChannel moduleOutputChannel = new DirectChannel();
|
||||
QueueChannel moduleInputChannel = new QueueChannel();
|
||||
Properties producerProperties = new Properties();
|
||||
producerProperties.put(BinderProperties.MIN_PARTITION_COUNT, "10");
|
||||
producerProperties.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "10");
|
||||
Properties consumerProperties = new Properties();
|
||||
consumerProperties.put(BinderProperties.MIN_PARTITION_COUNT, "10");
|
||||
consumerProperties.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "10");
|
||||
long uniqueBindingId = System.currentTimeMillis();
|
||||
binder.bindProducer("foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProperties);
|
||||
binder.bindConsumer("foo" + uniqueBindingId + ".0", moduleInputChannel, consumerProperties);
|
||||
@@ -193,11 +193,11 @@ public class KafkaBinderTests extends PartitionCapableBinderTests {
|
||||
DirectChannel moduleOutputChannel = new DirectChannel();
|
||||
QueueChannel moduleInputChannel = new QueueChannel();
|
||||
Properties producerProps = new Properties();
|
||||
producerProps.put(BinderProperties.MIN_PARTITION_COUNT, "5");
|
||||
producerProps.put(BinderProperties.NEXT_MODULE_CONCURRENCY, "6");
|
||||
producerProps.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "5");
|
||||
producerProps.put(BinderPropertyKeys.NEXT_MODULE_CONCURRENCY, "6");
|
||||
Properties consumerProps = new Properties();
|
||||
consumerProps.put(BinderProperties.MIN_PARTITION_COUNT, "5");
|
||||
consumerProps.put(BinderProperties.CONCURRENCY, "6");
|
||||
consumerProps.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "5");
|
||||
consumerProps.put(BinderPropertyKeys.CONCURRENCY, "6");
|
||||
long uniqueBindingId = System.currentTimeMillis();
|
||||
binder.bindProducer("foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProps);
|
||||
binder.bindConsumer("foo" + uniqueBindingId + ".0", moduleInputChannel, consumerProps);
|
||||
@@ -225,11 +225,11 @@ public class KafkaBinderTests extends PartitionCapableBinderTests {
|
||||
DirectChannel moduleOutputChannel = new DirectChannel();
|
||||
QueueChannel moduleInputChannel = new QueueChannel();
|
||||
Properties producerProps = new Properties();
|
||||
producerProps.put(BinderProperties.MIN_PARTITION_COUNT, "6");
|
||||
producerProps.put(BinderProperties.NEXT_MODULE_CONCURRENCY, "5");
|
||||
producerProps.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "6");
|
||||
producerProps.put(BinderPropertyKeys.NEXT_MODULE_CONCURRENCY, "5");
|
||||
Properties consumerProps = new Properties();
|
||||
consumerProps.put(BinderProperties.MIN_PARTITION_COUNT, "6");
|
||||
consumerProps.put(BinderProperties.CONCURRENCY, "5");
|
||||
consumerProps.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "6");
|
||||
consumerProps.put(BinderPropertyKeys.CONCURRENCY, "5");
|
||||
long uniqueBindingId = System.currentTimeMillis();
|
||||
binder.bindProducer("foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProps);
|
||||
binder.bindConsumer("foo" + uniqueBindingId + ".0", moduleInputChannel, consumerProps);
|
||||
@@ -257,11 +257,11 @@ public class KafkaBinderTests extends PartitionCapableBinderTests {
|
||||
DirectChannel moduleOutputChannel = new DirectChannel();
|
||||
QueueChannel moduleInputChannel = new QueueChannel();
|
||||
Properties producerProperties = new Properties();
|
||||
producerProperties.put(BinderProperties.MIN_PARTITION_COUNT, "3");
|
||||
producerProperties.put(BinderProperties.NEXT_MODULE_COUNT, "5");
|
||||
producerProperties.put(BinderProperties.PARTITION_KEY_EXPRESSION, "payload");
|
||||
producerProperties.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "3");
|
||||
producerProperties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "5");
|
||||
producerProperties.put(BinderPropertyKeys.PARTITION_KEY_EXPRESSION, "payload");
|
||||
Properties consumerProperties = new Properties();
|
||||
consumerProperties.put(BinderProperties.MIN_PARTITION_COUNT, "3");
|
||||
consumerProperties.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "3");
|
||||
long uniqueBindingId = System.currentTimeMillis();
|
||||
binder.bindProducer("foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProperties);
|
||||
binder.bindConsumer("foo" + uniqueBindingId + ".0", moduleInputChannel, consumerProperties);
|
||||
@@ -289,11 +289,11 @@ public class KafkaBinderTests extends PartitionCapableBinderTests {
|
||||
DirectChannel moduleOutputChannel = new DirectChannel();
|
||||
QueueChannel moduleInputChannel = new QueueChannel();
|
||||
Properties producerProperties = new Properties();
|
||||
producerProperties.put(BinderProperties.MIN_PARTITION_COUNT, "5");
|
||||
producerProperties.put(BinderProperties.NEXT_MODULE_COUNT, "3");
|
||||
producerProperties.put(BinderProperties.PARTITION_KEY_EXPRESSION, "payload");
|
||||
producerProperties.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "5");
|
||||
producerProperties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "3");
|
||||
producerProperties.put(BinderPropertyKeys.PARTITION_KEY_EXPRESSION, "payload");
|
||||
Properties consumerProperties = new Properties();
|
||||
consumerProperties.put(BinderProperties.MIN_PARTITION_COUNT, "5");
|
||||
consumerProperties.put(BinderPropertyKeys.MIN_PARTITION_COUNT, "5");
|
||||
long uniqueBindingId = System.currentTimeMillis();
|
||||
binder.bindProducer("foo" + uniqueBindingId + ".0", moduleOutputChannel, producerProperties);
|
||||
binder.bindConsumer("foo" + uniqueBindingId + ".0", moduleInputChannel, consumerProperties);
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.junit.Test;
|
||||
|
||||
import org.springframework.cloud.stream.binder.Binder;
|
||||
import org.springframework.cloud.stream.binder.BinderHeaders;
|
||||
import org.springframework.cloud.stream.binder.BinderProperties;
|
||||
import org.springframework.cloud.stream.binder.BinderPropertyKeys;
|
||||
import org.springframework.cloud.stream.binder.Binding;
|
||||
import org.springframework.cloud.stream.binder.TestUtils;
|
||||
import org.springframework.integration.IntegrationMessageHeaderAccessor;
|
||||
@@ -69,8 +69,8 @@ public class RawModeKafkaBinderTests extends KafkaBinderTests {
|
||||
Properties properties = new Properties();
|
||||
properties.put("partitionKeyExtractorClass", "org.springframework.cloud.stream.binder.kafka.RawKafkaPartitionTestSupport");
|
||||
properties.put("partitionSelectorClass", "org.springframework.cloud.stream.binder.kafka.RawKafkaPartitionTestSupport");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "3");
|
||||
properties.put(BinderProperties.NEXT_MODULE_CONCURRENCY, "2");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "3");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_CONCURRENCY, "2");
|
||||
|
||||
DirectChannel output = new DirectChannel();
|
||||
output.setBeanName("test.output");
|
||||
@@ -123,8 +123,8 @@ public class RawModeKafkaBinderTests extends KafkaBinderTests {
|
||||
Properties properties = new Properties();
|
||||
properties.put("partitionKeyExpression", "payload[0]");
|
||||
properties.put("partitionSelectorExpression", "hashCode()");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "3");
|
||||
properties.put(BinderProperties.NEXT_MODULE_CONCURRENCY, "2");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "3");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_CONCURRENCY, "2");
|
||||
|
||||
DirectChannel output = new DirectChannel();
|
||||
output.setBeanName("test.output");
|
||||
|
||||
@@ -59,8 +59,8 @@ import org.springframework.amqp.support.postprocessor.GZipPostProcessor;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.cloud.stream.binder.AbstractBinderPropertiesAccessor;
|
||||
import org.springframework.cloud.stream.binder.BinderProperties;
|
||||
import org.springframework.cloud.stream.binder.AbstractBindingPropertiesAccessor;
|
||||
import org.springframework.cloud.stream.binder.BinderPropertyKeys;
|
||||
import org.springframework.cloud.stream.binder.BinderUtils;
|
||||
import org.springframework.cloud.stream.binder.Binding;
|
||||
import org.springframework.cloud.stream.binder.MessageChannelBinderSupport;
|
||||
@@ -128,7 +128,7 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
|
||||
private static final Set<Object> RABBIT_CONSUMER_PROPERTIES = new HashSet<Object>(Arrays.asList(new String[] {
|
||||
|
||||
BinderProperties.MAX_CONCURRENCY,
|
||||
BinderPropertyKeys.MAX_CONCURRENCY,
|
||||
RabbitPropertiesAccessor.ACK_MODE,
|
||||
RabbitPropertiesAccessor.PREFETCH,
|
||||
RabbitPropertiesAccessor.PREFIX,
|
||||
@@ -151,7 +151,7 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
|
||||
private static final Set<Object> SUPPORTED_PUBSUB_CONSUMER_PROPERTIES = new SetBuilder()
|
||||
.addAll(SUPPORTED_BASIC_CONSUMER_PROPERTIES)
|
||||
.add(BinderProperties.DURABLE)
|
||||
.add(BinderPropertyKeys.DURABLE)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -159,7 +159,7 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
*/
|
||||
private static final Set<Object> SUPPORTED_NAMED_CONSUMER_PROPERTIES = new SetBuilder()
|
||||
.addAll(SUPPORTED_BASIC_CONSUMER_PROPERTIES)
|
||||
.add(BinderProperties.CONCURRENCY)
|
||||
.add(BinderPropertyKeys.CONCURRENCY)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -167,8 +167,8 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
*/
|
||||
private static final Set<Object> SUPPORTED_CONSUMER_PROPERTIES = new SetBuilder()
|
||||
.addAll(SUPPORTED_BASIC_CONSUMER_PROPERTIES)
|
||||
.add(BinderProperties.CONCURRENCY)
|
||||
.add(BinderProperties.PARTITION_INDEX)
|
||||
.add(BinderPropertyKeys.CONCURRENCY)
|
||||
.add(BinderPropertyKeys.PARTITION_INDEX)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -177,7 +177,7 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
private static final Set<Object> SUPPORTED_REPLYING_CONSUMER_PROPERTIES = new SetBuilder()
|
||||
// request
|
||||
.addAll(SUPPORTED_BASIC_CONSUMER_PROPERTIES)
|
||||
.add(BinderProperties.CONCURRENCY)
|
||||
.add(BinderPropertyKeys.CONCURRENCY)
|
||||
// reply
|
||||
.add(RabbitPropertiesAccessor.REPLY_HEADER_PATTERNS)
|
||||
.add(RabbitPropertiesAccessor.DELIVERY_MODE)
|
||||
@@ -191,7 +191,7 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
.add(RabbitPropertiesAccessor.DELIVERY_MODE)
|
||||
.add(RabbitPropertiesAccessor.PREFIX)
|
||||
.add(RabbitPropertiesAccessor.REQUEST_HEADER_PATTERNS)
|
||||
.add(BinderProperties.COMPRESS)
|
||||
.add(BinderPropertyKeys.COMPRESS)
|
||||
.build();
|
||||
|
||||
private static final Set<Object> SUPPORTED_PUBSUB_PRODUCER_PROPERTIES = new SetBuilder()
|
||||
@@ -212,7 +212,7 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
private static final Set<Object> SUPPORTED_PRODUCER_PROPERTIES = new SetBuilder()
|
||||
.addAll(PRODUCER_PARTITIONING_PROPERTIES)
|
||||
.addAll(SUPPORTED_BASIC_PRODUCER_PROPERTIES)
|
||||
.add(BinderProperties.DIRECT_BINDING_ALLOWED)
|
||||
.add(BinderPropertyKeys.DIRECT_BINDING_ALLOWED)
|
||||
.addAll(PRODUCER_BATCHING_BASIC_PROPERTIES)
|
||||
.addAll(PRODUCER_BATCHING_ADVANCED_PROPERTIES)
|
||||
.build();
|
||||
@@ -225,7 +225,7 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
.addAll(SUPPORTED_BASIC_PRODUCER_PROPERTIES)
|
||||
// reply
|
||||
.addAll(SUPPORTED_BASIC_CONSUMER_PROPERTIES)
|
||||
.add(BinderProperties.CONCURRENCY)
|
||||
.add(BinderPropertyKeys.CONCURRENCY)
|
||||
.add(RabbitPropertiesAccessor.REPLY_HEADER_PATTERNS)
|
||||
.build();
|
||||
|
||||
@@ -958,7 +958,7 @@ public class RabbitMessageChannelBinder extends MessageChannelBinderSupport impl
|
||||
* Property accessor for the RabbitBinder. Refer to the Spring-AMQP documentation for information on the
|
||||
* specific properties.
|
||||
*/
|
||||
private static class RabbitPropertiesAccessor extends AbstractBinderPropertiesAccessor {
|
||||
private static class RabbitPropertiesAccessor extends AbstractBindingPropertiesAccessor {
|
||||
|
||||
/**
|
||||
* The acknowledge mode (i.e. NONE, MANUAL, AUTO).
|
||||
|
||||
@@ -60,7 +60,7 @@ import org.springframework.amqp.utils.test.TestUtils;
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.cloud.stream.binder.Binder;
|
||||
import org.springframework.cloud.stream.binder.BinderProperties;
|
||||
import org.springframework.cloud.stream.binder.BinderPropertyKeys;
|
||||
import org.springframework.cloud.stream.binder.Binding;
|
||||
import org.springframework.cloud.stream.binder.PartitionCapableBinderTests;
|
||||
import org.springframework.cloud.stream.binder.Spy;
|
||||
@@ -230,7 +230,7 @@ public class RabbitBinderTests extends PartitionCapableBinderTests {
|
||||
properties.put("partitionKeyExtractorClass", "foo");
|
||||
properties.put("partitionSelectorExpression", "0");
|
||||
properties.put("partitionSelectorClass", "foo");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "1");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "1");
|
||||
|
||||
binder.bindProducer("props.0", new DirectChannel(), properties);
|
||||
assertEquals(1, bindings.size());
|
||||
@@ -318,7 +318,7 @@ public class RabbitBinderTests extends PartitionCapableBinderTests {
|
||||
properties.put("partitionKeyExtractorClass", "foo");
|
||||
properties.put("partitionSelectorExpression", "0");
|
||||
properties.put("partitionSelectorClass", "foo");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "1");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "1");
|
||||
properties.put("partitionIndex", "0");
|
||||
try {
|
||||
binder.bindRequestor("dummy", null, null, properties);
|
||||
@@ -387,7 +387,7 @@ public class RabbitBinderTests extends PartitionCapableBinderTests {
|
||||
properties.put("partitionKeyExtractorClass", "foo");
|
||||
properties.put("partitionSelectorExpression", "0");
|
||||
properties.put("partitionSelectorClass", "foo");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "1");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "1");
|
||||
properties.put("partitionIndex", "0");
|
||||
try {
|
||||
binder.bindReplier("dummy", null, null, properties);
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.cloud.stream.binder.AbstractBinderPropertiesAccessor;
|
||||
import org.springframework.cloud.stream.binder.AbstractBindingPropertiesAccessor;
|
||||
import org.springframework.cloud.stream.binder.BinderHeaders;
|
||||
import org.springframework.cloud.stream.binder.BinderProperties;
|
||||
import org.springframework.cloud.stream.binder.BinderPropertyKeys;
|
||||
import org.springframework.cloud.stream.binder.Binding;
|
||||
import org.springframework.cloud.stream.binder.EmbeddedHeadersMessageConverter;
|
||||
import org.springframework.cloud.stream.binder.MessageChannelBinderSupport;
|
||||
@@ -83,7 +83,7 @@ public class RedisMessageChannelBinder extends MessageChannelBinderSupport imple
|
||||
private static final Set<Object> SUPPORTED_NAMED_CONSUMER_PROPERTIES = new SetBuilder()
|
||||
.addAll(CONSUMER_STANDARD_PROPERTIES)
|
||||
.addAll(CONSUMER_RETRY_PROPERTIES)
|
||||
.add(BinderProperties.CONCURRENCY)
|
||||
.add(BinderPropertyKeys.CONCURRENCY)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ public class RedisMessageChannelBinder extends MessageChannelBinderSupport imple
|
||||
*/
|
||||
private static final Set<Object> SUPPORTED_CONSUMER_PROPERTIES = new SetBuilder()
|
||||
.addAll(SUPPORTED_NAMED_CONSUMER_PROPERTIES)
|
||||
.add(BinderProperties.PARTITION_INDEX)
|
||||
.add(BinderPropertyKeys.PARTITION_INDEX)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ public class RedisMessageChannelBinder extends MessageChannelBinderSupport imple
|
||||
// request
|
||||
.addAll(CONSUMER_STANDARD_PROPERTIES)
|
||||
.addAll(CONSUMER_RETRY_PROPERTIES)
|
||||
.add(BinderProperties.CONCURRENCY)
|
||||
.add(BinderPropertyKeys.CONCURRENCY)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ public class RedisMessageChannelBinder extends MessageChannelBinderSupport imple
|
||||
private static final Set<Object> SUPPORTED_PRODUCER_PROPERTIES = new SetBuilder()
|
||||
.addAll(PRODUCER_PARTITIONING_PROPERTIES)
|
||||
.addAll(PRODUCER_STANDARD_PROPERTIES)
|
||||
.add(BinderProperties.DIRECT_BINDING_ALLOWED)
|
||||
.add(BinderPropertyKeys.DIRECT_BINDING_ALLOWED)
|
||||
.build();
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ public class RedisMessageChannelBinder extends MessageChannelBinderSupport imple
|
||||
private static final Set<Object> SUPPORTED_REQUESTING_PRODUCER_PROPERTIES = new SetBuilder()
|
||||
// reply
|
||||
.addAll(CONSUMER_RETRY_PROPERTIES)
|
||||
.add(BinderProperties.CONCURRENCY)
|
||||
.add(BinderPropertyKeys.CONCURRENCY)
|
||||
.build();
|
||||
|
||||
private final RedisConnectionFactory connectionFactory;
|
||||
@@ -466,7 +466,7 @@ public class RedisMessageChannelBinder extends MessageChannelBinderSupport imple
|
||||
|
||||
}
|
||||
|
||||
private static class RedisPropertiesAccessor extends AbstractBinderPropertiesAccessor {
|
||||
private static class RedisPropertiesAccessor extends AbstractBindingPropertiesAccessor {
|
||||
|
||||
public RedisPropertiesAccessor(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.cloud.stream.binder.Binder;
|
||||
import org.springframework.cloud.stream.binder.BinderProperties;
|
||||
import org.springframework.cloud.stream.binder.BinderPropertyKeys;
|
||||
import org.springframework.cloud.stream.binder.Binding;
|
||||
import org.springframework.cloud.stream.binder.EmbeddedHeadersMessageConverter;
|
||||
import org.springframework.cloud.stream.binder.PartitionCapableBinderTests;
|
||||
@@ -171,7 +171,7 @@ public class RedisBinderTests extends PartitionCapableBinderTests {
|
||||
properties.put("partitionKeyExtractorClass", "foo");
|
||||
properties.put("partitionSelectorExpression", "0");
|
||||
properties.put("partitionSelectorClass", "foo");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "1");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "1");
|
||||
|
||||
binder.bindProducer("props.0", new DirectChannel(), properties);
|
||||
assertEquals(1, bindings.size());
|
||||
@@ -287,7 +287,7 @@ public class RedisBinderTests extends PartitionCapableBinderTests {
|
||||
properties.put("partitionKeyExtractorClass", "foo");
|
||||
properties.put("partitionSelectorExpression", "0");
|
||||
properties.put("partitionSelectorClass", "foo");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "1");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "1");
|
||||
properties.put("partitionIndex", "0");
|
||||
try {
|
||||
binder.bindReplier("dummy", new DirectChannel(), new DirectChannel(), properties);
|
||||
|
||||
@@ -247,7 +247,7 @@ public abstract class AbstractBinderTests {
|
||||
@Test
|
||||
public void testBadDynamic() throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(BinderProperties.PARTITION_KEY_EXPRESSION, "'foo'");
|
||||
properties.setProperty(BinderPropertyKeys.PARTITION_KEY_EXPRESSION, "'foo'");
|
||||
Binder<MessageChannel> binder = getBinder();
|
||||
try {
|
||||
binder.bindDynamicProducer("queue:foo", properties);
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class BrokerBinderTests extends
|
||||
public void testDirectBinding() throws Exception {
|
||||
Binder binder = getBinder();
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(BinderProperties.DIRECT_BINDING_ALLOWED, "true");
|
||||
properties.setProperty(BinderPropertyKeys.DIRECT_BINDING_ALLOWED, "true");
|
||||
|
||||
DirectChannel moduleInputChannel = new DirectChannel();
|
||||
moduleInputChannel.setBeanName("direct.input");
|
||||
|
||||
@@ -86,8 +86,8 @@ abstract public class PartitionCapableBinderTests extends BrokerBinderTests {
|
||||
Properties properties = new Properties();
|
||||
properties.put("partitionKeyExpression", "payload");
|
||||
properties.put("partitionSelectorExpression", "hashCode()");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "3");
|
||||
properties.put(BinderProperties.NEXT_MODULE_CONCURRENCY, "2");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "3");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_CONCURRENCY, "2");
|
||||
|
||||
DirectChannel output = new DirectChannel();
|
||||
output.setBeanName("test.output");
|
||||
@@ -187,8 +187,8 @@ abstract public class PartitionCapableBinderTests extends BrokerBinderTests {
|
||||
Properties properties = new Properties();
|
||||
properties.put("partitionKeyExtractorClass", "org.springframework.cloud.stream.binder.PartitionTestSupport");
|
||||
properties.put("partitionSelectorClass", "org.springframework.cloud.stream.binder.PartitionTestSupport");
|
||||
properties.put(BinderProperties.NEXT_MODULE_COUNT, "3");
|
||||
properties.put(BinderProperties.NEXT_MODULE_CONCURRENCY, "2");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_COUNT, "3");
|
||||
properties.put(BinderPropertyKeys.NEXT_MODULE_CONCURRENCY, "2");
|
||||
|
||||
DirectChannel output = new DirectChannel();
|
||||
output.setBeanName("test.output");
|
||||
|
||||
Reference in New Issue
Block a user