Re: migration to Camel 3.7
Seems like a bug Here is a full dependencyManagement and dependencies parts of pom.xml made according to https://camel.apache.org/camel-spring-boot/latest/index.html org.apache.camel.springboot camel-spring-boot-bom ${camel-version} pom import org.apache.camel.springboot camel-spring-boot-starter org.apache.camel.springboot camel-activemq-starter The main method looks like @SpringBootApplication @ImportResource("classpath:camel.xml") public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } Logs, where I have camel got started twice with 2 routes and 0 routes respectively 2021-01-26 20:23:00.242 INFO 27189 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.7.1 (camel) is starting 2021-01-26 20:23:00.244 INFO 27189 --- [ main] o.a.c.impl.engine.AbstractCamelContext : StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 2021-01-26 20:23:00.272 INFO 27189 --- [ main] c.s.b.CamelSpringBootApplicationListener : Starting CamelMainRunController to ensure the main thread keeps running 2021-01-26 20:23:00.275 INFO 27189 --- [ main] o.a.c.i.e.InternalRouteStartupManager: Route: my.route started and consuming from: file:///home/camel/in 2021-01-26 20:23:00.276 INFO 27189 --- [ main] o.a.c.i.e.InternalRouteStartupManager: Route: another.route started and consuming from: direct://routing 2021-01-26 20:23:00.279 INFO 27189 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Total 2 routes, of which 2 are started 2021-01-26 20:23:00.280 INFO 27189 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.7.1 (camel) started in 38ms 2021-01-26 20:23:00.292 INFO 27189 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.7.1 (camel) is starting 2021-01-26 20:23:00.293 INFO 27189 --- [ main] o.a.c.impl.engine.AbstractCamelContext : StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 2021-01-26 20:23:00.293 INFO 27189 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Total 0 routes, of which 0 are started 2021-01-26 20:23:00.293 INFO 27189 --- [ main] o.a.c.impl.engine.AbstractCamelContext : Apache Camel 3.7.1 (camel) started in 1ms 2021-01-26 20:23:00.300 INFO 27189 --- [ main] as2.MyApplication : Started MyApplication in 4.558 seconds (JVM running for 5.694) The problem disappears if I remove ImportResource annotation, but how one could set onException or InterceptFrom blocks in this case? ____ От: Иванов Григорий Олегович Отправлено: 26 января 2021 г. 17:28:58 Кому: users@camel.apache.org Тема: Re: migration to Camel 3.7 I figured out it is related to having camelContext described in camel.xml along with another beans and for example camel-activemq-starter dependency in pom.xml The one way to eliminate camelContext reloading is to drop camelContext description at all, xml routes then could be placed in classpath directory to be load. But I have interceptFrom, onException and others described in my camelContext bean, where should I move it now? Or, I noticed using the camel-activemq from org.apache.camel instead of camel-activemq-starter from org.apache.camel.springboot also helps, would it be correct? Please, help ____ От: Иванов Григорий Олегович Отправлено: 23 декабря 2020 г. 15:03:34 Кому: users@camel.apache.org Тема: migration to Camel 3.7 Hi, I have an issue when migrated from 3.5 to 3.7 Camel According to logs there are 4 additional empty (0 routes) camel contexts being started (camel-1 to camel-4) Please tell if it is a feature and if so what is its purpose? Should I care about these contexts or somehow treat them? Camel 3.7.0, Spring Boot 2.4.1 Here is the logs, thanks in advance! 14:46:01.152 [main ] INFO pl.engine.AbstractCamelContext - Total 51 routes, of which 51 are started 14:46:01.152 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 3s362ms 14:46:01.193 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.194 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.195 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-1 due to clash with an existing name already registered in MBeanServer. 14:46:01.215 [main
Re: migration to Camel 3.7
I figured out it is related to having camelContext described in camel.xml along with another beans and for example camel-activemq-starter dependency in pom.xml The one way to eliminate camelContext reloading is to drop camelContext description at all, xml routes then could be placed in classpath directory to be load. But I have interceptFrom, onException and others described in my camelContext bean, where should I move it now? Or, I noticed using the camel-activemq from org.apache.camel instead of camel-activemq-starter from org.apache.camel.springboot also helps, would it be correct? Please, help От: Иванов Григорий Олегович Отправлено: 23 декабря 2020 г. 15:03:34 Кому: users@camel.apache.org Тема: migration to Camel 3.7 Hi, I have an issue when migrated from 3.5 to 3.7 Camel According to logs there are 4 additional empty (0 routes) camel contexts being started (camel-1 to camel-4) Please tell if it is a feature and if so what is its purpose? Should I care about these contexts or somehow treat them? Camel 3.7.0, Spring Boot 2.4.1 Here is the logs, thanks in advance! 14:46:01.152 [main ] INFO pl.engine.AbstractCamelContext - Total 51 routes, of which 51 are started 14:46:01.152 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 3s362ms 14:46:01.193 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.194 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.195 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-1 due to clash with an existing name already registered in MBeanServer. 14:46:01.215 [main ] INFO pl.engine.AbstractCamelContext - StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 14:46:01.221 [main ] INFO pl.engine.AbstractCamelContext - Total 0 routes, of which 0 are started 14:46:01.223 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 29ms 14:46:01.236 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.236 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.236 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-2 due to clash with an existing name already registered in MBeanServer. 14:46:01.262 [main ] INFO pl.engine.AbstractCamelContext - StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 14:46:01.280 [main ] INFO pl.engine.AbstractCamelContext - Total 0 routes, of which 0 are started 14:46:01.283 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 47ms 14:46:01.294 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.295 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.298 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-3 due to clash with an existing name already registered in MBeanServer. 14:46:01.347 [main ] INFO pl.engine.AbstractCamelContext - StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 14:46:01.356 [main ] INFO pl.engine.AbstractCamelContext - Total 0 routes, of which 0 are started 14:46:01.356 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 61ms 14:46:01.396 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.398 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.399 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-4 due to clash with an existing name already registered in MBeanServer. 14:46:01.451 [main ] INFO pl.engine.AbstractCamelContext - StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 14:46:01.463 [main ] INFO pl.engine.AbstractCamelContext - Total 0 routes, of which 0 are started 14:46:01.463 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 64ms 14:46:01.474 [main ] INFO phere.sample.CamelApplication - Started CamelApplication in 13.587 seconds (JVM running for 16.829)
migration to Camel 3.7
Hi, I have an issue when migrated from 3.5 to 3.7 Camel According to logs there are 4 additional empty (0 routes) camel contexts being started (camel-1 to camel-4) Please tell if it is a feature and if so what is its purpose? Should I care about these contexts or somehow treat them? Camel 3.7.0, Spring Boot 2.4.1 Here is the logs, thanks in advance! 14:46:01.152 [main ] INFO pl.engine.AbstractCamelContext - Total 51 routes, of which 51 are started 14:46:01.152 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 3s362ms 14:46:01.193 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.194 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.195 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-1 due to clash with an existing name already registered in MBeanServer. 14:46:01.215 [main ] INFO pl.engine.AbstractCamelContext - StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 14:46:01.221 [main ] INFO pl.engine.AbstractCamelContext - Total 0 routes, of which 0 are started 14:46:01.223 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 29ms 14:46:01.236 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.236 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.236 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-2 due to clash with an existing name already registered in MBeanServer. 14:46:01.262 [main ] INFO pl.engine.AbstractCamelContext - StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 14:46:01.280 [main ] INFO pl.engine.AbstractCamelContext - Total 0 routes, of which 0 are started 14:46:01.283 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 47ms 14:46:01.294 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.295 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.298 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-3 due to clash with an existing name already registered in MBeanServer. 14:46:01.347 [main ] INFO pl.engine.AbstractCamelContext - StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 14:46:01.356 [main ] INFO pl.engine.AbstractCamelContext - Total 0 routes, of which 0 are started 14:46:01.356 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 61ms 14:46:01.396 [main ] INFO nagement.JmxManagementStrategy - JMX is enabled 14:46:01.398 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) is starting 14:46:01.399 [main ] WARN JmxManagementLifecycleStrategy - This CamelContext(camel) will be registered using the name: camel-4 due to clash with an existing name already registered in MBeanServer. 14:46:01.451 [main ] INFO pl.engine.AbstractCamelContext - StreamCaching is not in use. If using streams then it's recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html 14:46:01.463 [main ] INFO pl.engine.AbstractCamelContext - Total 0 routes, of which 0 are started 14:46:01.463 [main ] INFO pl.engine.AbstractCamelContext - Apache Camel 3.7.0 (camel) started in 64ms 14:46:01.474 [main ] INFO phere.sample.CamelApplication - Started CamelApplication in 13.587 seconds (JVM running for 16.829)
Re: groovy scripts in IntelliJ IDEA
If someone are interested, it could be done via using Idea's Dynamic Properties - https://confluence.jetbrains.com/display/GRVY/Dynamic+Methods+and+Properties От: Иванов Григорий Олегович Отправлено: 11 ноября 2020 г. 19:11:12 Кому: users@camel.apache.org Тема: groovy scripts in IntelliJ IDEA Hi, I have a question about using an external groovy script in camel route - https://camel.apache.org/components/latest/languages/groovy-language.html#_loading_script_from_external_resource Say I want do something like request.getHeader("foo").collectEntries { k, v -> [k, v ?: "default"] } Now I have my IDE complains about the request object, it says "Cannot resolve symbol request" Is there a way to fix it except to suppress the warning? Thanks
groovy scripts in IntelliJ IDEA
Hi, I have a question about using an external groovy script in camel route - https://camel.apache.org/components/latest/languages/groovy-language.html#_loading_script_from_external_resource Say I want do something like request.getHeader("foo").collectEntries { k, v -> [k, v ?: "default"] } Now I have my IDE complains about the request object, it says "Cannot resolve symbol request" Is there a way to fix it except to suppress the warning? Thanks
Mocking a class in a script
Hi I have a production route with a groovy script I should test, is there a way to mock URL class or do something else to not really make a request to production API? The problem is that besides the request part it have some other stuff I would like to be tested. I agree, this route is not as testable as it could be, but for now it comes "as is". Could you suggest something?... some stuff I should test ... def r = new URL("http://someproductoinservice.com").openConnection(); r.with { setRequestMethod("POST") setConnectTimeout(6) setReadTimeout(30) setDoOutput(true) setRequestProperty("Content-Type", "application/json") getOutputStream().write(request.getHeader('inMsg').getBytes("UTF-8")); } r.getResponseCode(); ... more stuff ... ...
Camel documentation question
Hello! As I could remember there was a section on the old camel website about using activeMQ destination options Is there a reason for not to have it now? Camel AMQ component - https://camel.apache.org/components/latest/activemq-component.html AMQ destination options - https://activemq.apache.org/destination-options Thanks!
Re: Camel 3 - beans creation when testing
OK, thank you Claus, I will keep it in mind It turns out, spring creates an object of connection factory but not really attempts to connect to broker after that So now when I have all the stuff in place (host resolving, etc) the exception is gone От: Claus Ibsen Отправлено: 14 октября 2020 г. 13:49:02 Кому: users@camel.apache.org Тема: Re: Camel 3 - beans creation when testing Hi That is spring that does that it creates all the when it startup. I am not sure if it has some kind of lazy=true option or something you can set on to create it on-demand. On Tue, Oct 13, 2020 at 10:42 AM Иванов Григорий - wrote: > > > Hello, everyone > > I have a question about routes testing > > In production I have ActiveMQ connection factory bean > > > class="org.apache.activemq.ActiveMQConnectionFactory"> > value="tcp://${activemq.host}:${activemq.port}"/> > > > ... > > > > Now when I run a test I get this warning > > "Create pooled connection during start failed. This exception will be ignored" > > and an exception after it > > "javax.jms.JMSException: Error while attempting to add new Connection to the > pool" > > > So as I can see, it is being created during test initialization even if there > is no bean usage in the route I test > > Is this a desired behavior? > > > -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Camel 3 - beans creation when testing
Hello, everyone I have a question about routes testing In production I have ActiveMQ connection factory bean ... Now when I run a test I get this warning "Create pooled connection during start failed. This exception will be ignored" and an exception after it "javax.jms.JMSException: Error while attempting to add new Connection to the pool" So as I can see, it is being created during test initialization even if there is no bean usage in the route I test Is this a desired behavior?