diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BinderProperties.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BinderProperties.java index 8b68035c8..d6f778da8 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BinderProperties.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BinderProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 the original author or authors. + * Copyright 2015-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. @@ -28,12 +28,27 @@ import java.util.Properties; */ public class BinderProperties { + /** + * The binder type. It typically references one of the binders found on the classpath, + * in particular a key in a META-INF/spring.binders file. + * By default, it has the same value as the configuration name. + */ private String type; + /** + * Root for a set of properties that can be used to customize the environment of the binder. + */ private Map environment = new HashMap<>(); + /** + * Whether the configuration will inherit the environment of the application itself. Default: true + */ private boolean inheritEnvironment = true; + /** + * Whether the binder configuration is a candidate for being considered a default binder, + * or can be used only when explicitly referenced. Defaulys: true + */ private boolean defaultCandidate = true; public String getType() { diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingProperties.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingProperties.java index 245383806..e4857d2a7 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingProperties.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 the original author or authors. + * Copyright 2015-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. @@ -54,16 +54,30 @@ public class BindingProperties { */ private String group; - // Properties for both inbound/outbound + // Properties for both input and output bindings + /** + * Specifies content-type that will be used by this binding in the event + * it is not specified in Message headers. Default: 'application/json'. + */ private String contentType = "application/json"; + /** + * The name of the binder to use for this binding in the event multiple binders available (e.g., 'rabbit'); + */ private String binder; + /** + * Additional consumer specific properties (see {@link ConsumerProperties}) + */ private ConsumerProperties consumer; + /** + * Additional producer specific properties (see {@link ProducerProperties}) + */ private ProducerProperties producer; + public String getDestination() { return this.destination; } 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 470a0f7c5..343c7299b 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 @@ -1,5 +1,5 @@ /* - * Copyright 2015-2017 the original author or authors. + * Copyright 2015-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. @@ -43,6 +43,7 @@ import org.springframework.util.Assert; * @author Marius Bogoevici * @author Gary Russell * @author Ilayaperumal Gopinathan + * @author Oleg Zhurakousky */ @ConfigurationProperties("spring.cloud.stream") @JsonInclude(Include.NON_DEFAULT) @@ -50,25 +51,52 @@ public class BindingServiceProperties implements ApplicationContextAware, Initia private static final int DEFAULT_BINDING_RETRY_INTERVAL = 30; - private ConversionService conversionService; - + /** + * The instance id of the application: a number from 0 to instanceCount-1. Used for partitioning and with Kafka. + */ @Value("${INSTANCE_INDEX:${CF_INSTANCE_INDEX:0}}") private int instanceIndex; + /** + * The number of deployed instances of an application. Default: 1. + */ private int instanceCount = 1; + /** + * Additional binding properties (see {@link BinderProperties}) per binding name (e.g., 'input`). + * + * For example; This sets the content-type for the 'input' binding of a Sink application: + * 'spring.cloud.stream.bindings.input.contentType=text/plain' + */ private Map bindings = new TreeMap<>( String.CASE_INSENSITIVE_ORDER); + /** + * Additional per-binder properties (see {@link BinderProperties}) if more then one binder of the same type is used + * (i.e., connect to multiple instances of RabbitMq). Here you can specify multiple + * binder configurations, each with different environment settings. For example; + * spring.cloud.stream.binders.rabbit1.environment. . . , spring.cloud.stream.binders.rabbit2.environment. . . + */ private Map binders = new HashMap<>(); + /** + * The name of the binder to use by all bindings in the event multiple binders available (e.g., 'rabbit'); + */ private String defaultBinder; + /** + * A list of destinations that can be bound dynamically. If set, only listed destinations can be bound. + */ private String[] dynamicDestinations = new String[0]; - private ConfigurableApplicationContext applicationContext; - + /** + * Retry interval (in seconds) used to schedule binding attempts. Default: 30 sec. + */ private int bindingRetryInterval = DEFAULT_BINDING_RETRY_INTERVAL; + + private ConfigurableApplicationContext applicationContext; + + private ConversionService conversionService; public Map getBindings() { return this.bindings;