From 2ddd7973c426a7b2925ba89a21ced5ffbf0034e2 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Tue, 30 Jul 2019 14:21:09 +0200 Subject: [PATCH] GH-1770 Fixed BindingService unbinding lifecycle . . . to ensure the bindings are gracefully stopped before unibind is called Resolves #1770 --- .../springframework/cloud/stream/binding/BindingService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindingService.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindingService.java index 7fa4b9efa..2335cb2ca 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindingService.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindingService.java @@ -306,6 +306,8 @@ public class BindingService { List> bindings = this.consumerBindings.remove(inputName); if (bindings != null && !CollectionUtils.isEmpty(bindings)) { for (Binding binding : bindings) { + binding.stop(); + //then binding.unbind(); } } @@ -316,7 +318,10 @@ public class BindingService { public void unbindProducers(String outputName) { Binding binding = this.producerBindings.remove(outputName); + if (binding != null) { + binding.stop(); + //then binding.unbind(); } else if (this.log.isWarnEnabled()) {