StreamBridge's dynamic destinations should be closed on shutdown.
- if not, we might lose some messages on shutdown especially in case of kafka async mode producing. Resolves #2835
This commit is contained in:
@@ -639,6 +639,25 @@ public class StreamBridgeTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDynamicDestinationDestroy() {
|
||||
BindingService bindingService;
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(TestChannelBinderConfiguration
|
||||
.getCompleteConfiguration(InterceptorConfiguration.class))
|
||||
.web(WebApplicationType.NONE).run(
|
||||
"--spring.jmx.enabled=false",
|
||||
"--spring.cloud.stream.dynamic-destination-cache-size=1"
|
||||
)) {
|
||||
StreamBridge bridge = context.getBean(StreamBridge.class);
|
||||
bridge.send("a", "hello foo");
|
||||
|
||||
bindingService = context.getBean(BindingService.class);
|
||||
assertThat(bindingService.getProducerBindingNames().length).isEqualTo(1);
|
||||
assertThat(bindingService.getProducerBindingNames()[0]).isEqualTo("a");
|
||||
}
|
||||
assertThat(bindingService.getProducerBindingNames().length).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWithIntegrationFlowBecauseMarcinSaidSo() {
|
||||
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(TestChannelBinderConfiguration
|
||||
|
||||
Reference in New Issue
Block a user