This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3d031b25ef08c525b4019ce8d650aca08111b36c Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Jan 29 15:40:04 2021 +0100 CAMEL-16106: camel-seda - Endpoints with custom queueSize to create queue lazy --- .../apache/camel/component/seda/SedaEndpoint.java | 2 +- .../apache/camel/component/seda/SedaProducer.java | 2 - .../apache/camel/component/seda/SedaSizeTest.java | 45 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java index dacffa4..6af015b 100644 --- a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java +++ b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java @@ -534,7 +534,7 @@ public class SedaEndpoint extends DefaultEndpoint implements AsyncEndpoint, Brow // special for unit testing where we can set a system property to make seda poll faster // and therefore also react faster upon shutdown, which makes overall testing faster of the Camel project String override = System.getProperty("CamelSedaPollTimeout", "" + getPollTimeout()); - setPollTimeout(Integer.valueOf(override)); + setPollTimeout(Integer.parseInt(override)); } @Override diff --git a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaProducer.java b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaProducer.java index fe7ab37..2293e79 100644 --- a/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaProducer.java +++ b/components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaProducer.java @@ -50,8 +50,6 @@ public class SedaProducer extends DefaultAsyncProducer { this.blockWhenFull = blockWhenFull; this.discardWhenFull = discardWhenFull; this.offerTimeout = offerTimeout; - // Force the creation of the queue - endpoint.getQueue(); } @Override diff --git a/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaSizeTest.java b/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaSizeTest.java new file mode 100644 index 0000000..0694d65 --- /dev/null +++ b/core/camel-core/src/test/java/org/apache/camel/component/seda/SedaSizeTest.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.seda; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.builder.RouteBuilder; +import org.junit.jupiter.api.Test; + +public class SedaSizeTest extends ContextTestSupport { + + @Test + public void testSeda() throws Exception { + getMockEndpoint("mock:bar").expectedMessageCount(1); + + template.sendBody("direct:start", "Hello World"); + + assertMockEndpointsSatisfied(); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start").to("seda:bar?size=5"); + + from("seda:bar?size=5").to("mock:bar"); + } + }; + } +}