From 40709fbf140e0cf79dd3485fbff67e05b186bc15 Mon Sep 17 00:00:00 2001 From: Ilayaperumal Gopinathan Date: Thu, 28 Jan 2016 16:51:00 +0530 Subject: [PATCH] Add durableSubscription as a binding property - This will be updated as a binder consumer property for the key `durableSubscription` This resolves #293 --- .../cloud/stream/config/BindingProperties.java | 16 +++++++++++++++- .../config/ChannelBindingServiceProperties.java | 6 +++++- 2 files changed, 20 insertions(+), 2 deletions(-) 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 f6fb87923..a70cee0e8 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 the original author or authors. + * Copyright 2015-2016 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. @@ -85,6 +85,8 @@ public class BindingProperties { private Integer concurrency; + private Boolean durableSubscription; + // Partition properties private String partitionIndex; @@ -243,6 +245,14 @@ public class BindingProperties { this.partitioned = partitioned; } + public Boolean getDurableSubscription() { + return this.durableSubscription; + } + + public void setDurableSubscription(Boolean durableSubscription) { + this.durableSubscription = durableSubscription; + } + public String toString() { StringBuilder sb = new StringBuilder(); sb.append("destination=" + this.destination); @@ -315,6 +325,10 @@ public class BindingProperties { sb.append("concurrency=" + this.concurrency); sb.append(COMMA); } + if (this.durableSubscription != null) { + sb.append("durableSubscription=" + this.durableSubscription); + sb.append(COMMA); + } sb.deleteCharAt(sb.lastIndexOf(COMMA)); return "BindingProperties{" + sb.toString() + "}"; } diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/ChannelBindingServiceProperties.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/ChannelBindingServiceProperties.java index 7fa136c94..a879de3a7 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/ChannelBindingServiceProperties.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/ChannelBindingServiceProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 the original author or authors. + * Copyright 2015-2016 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. @@ -112,6 +112,10 @@ public class ChannelBindingServiceProperties { channelConsumerProperties.setProperty(BinderPropertyKeys.CONCURRENCY, Integer.toString(bindingProperties.getConcurrency())); } + if (bindingProperties.getDurableSubscription() != null) { + channelConsumerProperties.setProperty(BinderPropertyKeys.DURABLE, + Boolean.toString(bindingProperties.getDurableSubscription())); + } updateConsumerPartitionProperties(inputChannelName, channelConsumerProperties); } return channelConsumerProperties;