Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.13.1
-
None
-
Eclipse, jUnit, Windows
-
Unknown
Description
I just tried to setup a throughput logger with java dsl (not using uri strings) and it seems that setGroupSize and other setters are ignored.
To reproduce i wrote a test:
EndpointsUtilTest
import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.log.LogEndpoint; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; public class EndpointsUtilTest extends CamelTestSupport { private static final String MOCK_OUT = "mock:out"; private static final String DIRECT_IN = "direct:in"; @Test public void test() throws InterruptedException { MockEndpoint out = context.getEndpoint(MOCK_OUT, MockEndpoint.class); int expectedCount = 1000; out.expectedMessageCount(expectedCount); for (int i = 0; i < expectedCount; i++) { template.sendBody(DIRECT_IN, "blub"); } out.assertIsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from(DIRECT_IN).to(getTPLogger()).to(getTPLoggerSetter()).to(MOCK_OUT); } }; } private LogEndpoint getTPLogger(){ LogEndpoint endpoint = context.getEndpoint("log:tplogger?groupSize=10", LogEndpoint.class); return endpoint; } private LogEndpoint getTPLoggerSetter(){ LogEndpoint endpoint = context.getEndpoint("log:tploggerSetter", LogEndpoint.class); endpoint.setGroupSize(10); return endpoint; } }
Both loggers should produce same output but only the one produced with getTPLogger() is a correct throughput logger.