From 2ec31fa1037c3ed624c1513d1a0fd8d976218012 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Sat, 10 Dec 2016 17:20:52 -0500 Subject: [PATCH] GH-213: Fix sample inconsistency in "quick tour" Fixes GH-213 (https://github.com/spring-projects/spring-kafka/issues/213) After introduction copying of `ContainerProperties` instance in the `AbstractMessageListenerContainer` the sample in the Reference Manual ins't valid any more. * Move `containerProps.setMessageListener()` before `createContainer()` where copying is happened already and we can't affect container with original `ContainerProperties` modifications afterwards. **Cherry pick to 1.0.x** --- src/reference/asciidoc/quick-tour.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reference/asciidoc/quick-tour.adoc b/src/reference/asciidoc/quick-tour.adoc index 69f0785d..d8e80d70 100644 --- a/src/reference/asciidoc/quick-tour.adoc +++ b/src/reference/asciidoc/quick-tour.adoc @@ -44,7 +44,6 @@ Using plain Java to send and receive a message: public void testAutoCommit() throws Exception { logger.info("Start auto"); ContainerProperties containerProps = new ContainerProperties("topic1", "topic2"); - KafkaMessageListenerContainer container = createContainer(containerProps); final CountDownLatch latch = new CountDownLatch(4); containerProps.setMessageListener(new MessageListener() { @@ -55,6 +54,7 @@ public void testAutoCommit() throws Exception { } }); + KafkaMessageListenerContainer container = createContainer(containerProps); container.setBeanName("testAuto"); container.start(); Thread.sleep(1000); // wait a bit for the container to start