diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ConsumerProperties.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ConsumerProperties.java index 76077c41e..63f45ea42 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ConsumerProperties.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binder/ConsumerProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2017 the original author or authors. + * Copyright 2016-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,28 +27,100 @@ import com.fasterxml.jackson.annotation.JsonInclude; * @author Ilayaperumal Gopinathan * @author Gary Russell * @author Soby Chacko + * @author Oleg Zhurakousky */ @JsonInclude(JsonInclude.Include.NON_DEFAULT) public class ConsumerProperties { + /** + * The concurrency setting of the consumer. Default: 1. + */ private int concurrency = 1; + /** + * Whether the consumer receives data from a partitioned producer. Default: 'false'. + */ private boolean partitioned; + /** + * When set to a value greater than equal to zero, allows customizing the instance + * count of this consumer (if different from spring.cloud.stream.instanceCount). + * When set to a negative value, it will default to spring.cloud.stream.instanceCount. + * See that property for more information. + * Default: -1 + * NOTE: This setting will override the one set in 'spring.cloud.stream.instance-count' + */ private int instanceCount = -1; + /** + * When set to a value greater than equal to zero, allows customizing the instance + * index of this consumer (if different from spring.cloud.stream.instanceIndex). + * When set to a negative value, it will default to spring.cloud.stream.instanceIndex. + * See that property for more information. + * Default: -1 + * NOTE: This setting will override the one set in 'spring.cloud.stream.instance-index' + */ private int instanceIndex = -1; + /** + * The number of attempts to process the message (including the first) + * in the event of processing failures. This is a RetryTemplate configuration + * which is provided by the framework. + * Default: 3. Set to 1 to disable retry. You can also provide custom RetryTemplate + * in the event you want to take complete control of the RetryTemplate. Simply configure + * it as @Bean inside your application configuration. + */ private int maxAttempts = 3; + /** + * The backoff initial interval on retry. This is a RetryTemplate configuration + * which is provided by the framework. + * Default: 1000 ms. + * You can also provide custom RetryTemplate + * in the event you want to take complete control of the RetryTemplate. Simply configure + * it as @Bean inside your application configuration. + */ private int backOffInitialInterval = 1000; + /** + * The maximum backoff interval. This is a RetryTemplate configuration + * which is provided by the framework. + * Default: 10000 ms. + * You can also provide custom RetryTemplate + * in the event you want to take complete control of the RetryTemplate. Simply configure + * it as @Bean inside your application configuration. + */ private int backOffMaxInterval = 10000; + /** + * The backoff multiplier.This is a RetryTemplate configuration + * which is provided by the framework. + * Default: 2.0. + * You can also provide custom RetryTemplate + * in the event you want to take complete control of the RetryTemplate. Simply configure + * it as @Bean inside your application configuration. + */ private double backOffMultiplier = 2.0; + /** + * When set to none, disables header parsing on input. Effective only + * for messaging middleware that does not support message headers natively + * and requires header embedding. This option is useful when consuming data + * from non-Spring Cloud Stream applications when native headers are not + * supported. When set to headers, uses the middleware’s native header mechanism. + * When set to embeddedHeaders, embeds headers into the message payload. + * Default: depends on binder implementation. Rabbit and Kafka binders currently + * distributed with spring cloud stream support headers natively. + */ private HeaderMode headerMode; + /** + * When set to true, the inbound message is deserialized directly by client library, + * which must be configured correspondingly (e.g. setting an appropriate Kafka producer value serializer). + * NOTE: This is binder specific setting which has no effect if binder does not support native + * serialization/deserialization. Currently only Kafka binder supports it. + * Default: 'false' + */ private boolean useNativeDecoding; @Min(value = 1, message = "Concurrency should be greater than zero.") diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceProperties.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceProperties.java index 51fdbe753..39cd2a5b9 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceProperties.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceProperties.java @@ -52,13 +52,21 @@ public class BindingServiceProperties implements ApplicationContextAware, Initia private static final int DEFAULT_BINDING_RETRY_INTERVAL = 30; /** - * The instance id of the application: a number from 0 to instanceCount-1. Used for partitioning and with Kafka. + * The instance id of the application: a number from 0 to instanceCount-1. + * Used for partitioning and with Kafka. + * NOTE: Could also be managed per individual binding + * "spring.cloud.stream.bindings.foo.consumer.instance-index" where 'foo' is + * the name of the binding. */ @Value("${INSTANCE_INDEX:${CF_INSTANCE_INDEX:0}}") private int instanceIndex; /** - * The number of deployed instances of an application. Default: 1. + * The number of deployed instances of an application. + * Default: 1. + * NOTE: Could also be managed per individual binding + * "spring.cloud.stream.bindings.foo.consumer.instance-count" where 'foo' is + * the name of the binding. */ private int instanceCount = 1;