LDAPS

2021-01-29 Thread Daniel Johansson
Hi Camel Users

I hope someone can get LDAPS working with camel.

I'm using camel 2.23.2 and camel-ldap component to try to get all objects
under a specific OU from a microsoft AD.
This works fine with LDAP however if I want to use LDAPS i get into trouble
and get:
ERROR s.l.i.CamelConfig.initialDirContext: Throw ex:
-
simple bind failed: :636
javax.naming.CommunicationException: simple bind failed: :636
[Root exception is java.net.SocketException: Connection or outbound has
closed]
-
2021-01-29 13:10:03,453 [Camel (MyCamelContext) thread #1 -
timer://LDAP-Timer] ERROR o.a.c.p.DefaultErrorHandler.log: Failed delivery
for (MessageId: ID-bamse-1611922198416-0-2 on ExchangeId:
ID-bamse-1611922198416-0-1). Exhausted after delivery attempt: 1 caught:
java.lang.NullPointerException

I have followed the guide at
https://camel.apache.org/components/2.x/ldap-component.html
and read the Camel in action book about adding SSL to components i.e. "14.4
Transport security" and "14.4.1 Defining global SSL configuration"

Below is my code for CamelConfig and the CustomSocketFactory is exactly as
its done in https://camel.apache.org/components/2.x/ldap-component.html
And as i mentioned the config and routes works fine without ldaps. The key
and trust store contains the server cert and I can see that the MS-AD
replies with the server cert that is on my truststore.
I have tried everything :) I hope someone can help me to figure out what's
wrong.

Best regards
/Daniel

private InitialDirContext ldapServer;
private final Hashtable environment;

  @Bean
  public SSLContextParameters sslContextParameters() {
KeyStoreParameters ksp = new KeyStoreParameters();
ksp.setResource("keystore.jks");
ksp.setPassword("apassword");

KeyManagersParameters kmp = new KeyManagersParameters();
kmp.setKeyStore(ksp);
kmp.setKeyPassword("apassword");

KeyStoreParameters tsp = new KeyStoreParameters();
tsp.setResource("truststore.jks");
tsp.setPassword("apassword");

TrustManagersParameters tmp = new TrustManagersParameters();
tmp.setKeyStore(tsp);

SSLContextParameters scp = new SSLContextParameters();
scp.setKeyManagers(kmp);
scp.setTrustManagers(tmp);

return scp;
}

  @Bean(name = "customSocketFactory")
  public CustomSocketFactory customSocketFactory() {
CustomSocketFactory customSocketFactory = new
CustomSocketFactory(sslContextParameters());
  return  customSocketFactory;
}

  @Bean(name = "ldapServer")
  @Scope("prototype")
  public InitialDirContext initialDirContext() {
environment.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
environment.put(Context.PROVIDER_URL, ldapUrl);
environment.put(Context.URL_PKG_PREFIXES, "com.sun.jndi.url");
environment.put(Context.REFERRAL, "ignore");
//Simple authentication consists of sending the LDAP server the fully
qualified DN of the client (user) and the client's clear-text password.
environment.put(Context.SECURITY_AUTHENTICATION, "simple");
//SECURITY_PROTOCOL can be ignored if using ldaps:// as a scheme.
//environment.put(Context.SECURITY_PROTOCOL,"ssl");
//Set to the fully qualified DN of the entity that is being
authenticated.
environment.put(Context.SECURITY_PRINCIPAL, "cn=");
//Set to the password of the principal.
environment.put(Context.SECURITY_CREDENTIALS, ldapPasswd);
try {
ldapServer = new InitialDirContext(environment);

ldapServer.addToEnvironment("java.naming.ldap.factory.socket","customSocketFactory");

} catch (NamingException ex) {
LOG.error("Throw ex: \n-\n" + ex.getMessage()
+"\n"+ ex.getExplanation() +"\n"+ ex.toString()+"\n-");
}
return ldapServer;
}


Re: Future of Camel

2021-01-29 Thread ski n
Thanks, Claus.

BTW: The post was not just meant as a question "what is planned for Camel
in the next year?", but more addressed how users see the future of Camel.
What do they like to see in future Camel versions (short term/long term)?
And what are improvement areas? I would love to see how others user
experience Camel. Maybe a user survey would be interesting?

Regards,

Raymond



Op wo 20 jan. 2021 om 20:21 schreef Claus Ibsen :

> Hi
>
>
> On Sun, Jan 17, 2021 at 10:28 AM ski n  wrote:
> >
> > Hi all,
> >
> > In 2020 there was a clear roadmap towards 3.7.0. This roadmap focussed on
> > modularization and performance, especially useful in microservices and
> > cloud functions.
> >
> > Now I wonder what the roadmap of 2021 will be and what the future of
> Camel
> > brings.
> >
>
> There is not like that with a new calendar year that the Camel project
> shifts
>  focus and comes up with a new set of goals, than the previous year.
>
> It's a continued evolution with a steady release stream.
>
>
> > I made 12 questions on the Camel ecosystem to think about this topic:
> >
> >
> > 1) Management DSL
> >
> > Camel has always had the Java DSL. One of the last additions of this DSL
> is
> > the EndpointDSL. Not everything can be done with the DSL yet. Will there
> > also a Management DSL where you can configure and manage context and
> route?
> >
>
> Not everything has to be a DSL. They require extra effort to maintain,
> document,
> and then there is "one more way of doing X" problem.
>
>
> > 2) Ease of use
> >
> > One of the strongest points of Camel is its ease of use. Are there ideas
> to
> > make it even more high level, towards citizens integrators?
> >
>
> Camel is aimed at developers and it's not within the scope of being a
> higher level integration product / system
> for non-developers such as citizen users, sys admins etc.
>
> That said such products can be built on top of Camel such as Syndesis
> / Fuse Online,
> and other products (some are listed in the Camel users stories).
>
>
>
> > 3) Performance
> >
> > 3.x focussed on the memory footprint and performance of core Camel. Will
> > this focus shift towards components. For example
> > the 10 most used componets (file, ftp, sjms, kafka for example). Maybe
> > based on Maven statistics.
> >
>
> Performance and low footprint will keep being a priority, as it's
> getting increasingly required by modern cloud computing and workloads,
> where you "pay by use", and don't have big datacenters with 98% idle
> CPUs sitting doing nothing.
>
> And yes beyond the core itself then some widely used components is a
> goal as well.
> We have an effort to improve their startup by moving logic to
> init/build phase etc.
> That is general for all the components.
>
>
> > 4) GraalVM
> >
> > Will GraalVM native images with ahead of time compilation will be
> supported.
> >
>
> This is already supported and all work related to this is in the realm
> of the camel-quarkus project.
>
> This has had a huge impact on core also, as we have done alot of
> effort to make core reflection free,
> and fast startup, and minimal footprint, and modular to make dead code
> elimination much more effective.
>
> And on top of that Quarkus in JVM mode does a lot of built time
> optimizations that dramatic reduce JVM foorprint
> so you have a double win, and dont have to be 100% graal to get there.
>
>
>
> > 5) Java 17
> >
> > In september 2021 the new LTS for Java comes out. Will the team
> especially
> > target this release or will it first support Java 15?
> >
>
> Yes Camel will support Java 17 but possible not right away when Java 17 is
> GA.
> But we do CI builds on the latest Java version such as 15.
>
> But only the LTS versions of Java are officially going to be supported.
>
> > 6) DSL Export
> >
> > With DumpToXML it's possible to export a route in XML format. Will there
> > also a DumpToDSL?
> >
>
> No that is not a goal.
>
> > 7) jOOr I
> >
> > Will Csimple eventually replace simple?
> >
>
> No not in the short run. csimple is not 100% replecable by simple, as
> it requires more type information when doing OGNL method calls.
> simple does dynamic runtime discovery with reflection, where as
> csimple is compiled and therefore need type ahead information.
>
> Also simple is widely in use.
>
> But for users that want low foorprint then csimple is hopefully going
> to be great. Its still new and we will continue improve it over the
> next number of releases.
> There is not yet support for nested functions (hard to implement, and
> requires a parser rewrite).
>
>
>
> > 8) jOOr II
> >
> > The jOOR language allows using Java code in a Camel expression. From an
> end
> > user perspective, why don't just use .java() like .groovy()?
> >
>
> Because Java gives false impression that its 100% Java and you can do
> whatever you can do in Java.
> There are some limitations, and potential classloading issues.
>
> But for small java code / snippets / scripts then its great.
>
> But the name java

Re: Apache Camel Windows Service stuck in state Stopping (due to RabbitMQ Unknown consumerTag exception)

2021-01-29 Thread Michael Martinsen
I will try to collect a thread dump - and also try to let the Windows
Service just continue trying to stop to see what happens - off course
assuming I can reproduce this in my test environment :-/

Thanks so far.

/Michael

Venlig hilsen / Best Regards

Michael Martinsen



Openminds
Fredens Torv 1B, 1.
DK-8000 Aarhus C
Denmark
Cvr; 33647166
M: +45 6169 6779
E: m...@openminds.dk
www.openminds.dk





On Fri, Jan 29, 2021 at 9:56 AM Claus Ibsen  wrote:
>
> Hi
>
> When your app is stuck then you can take a thread dump, which can help
> pin point to which thread and where its stuck.
>
> Camel uses a separate thread to shutdown routes, while waiting for
> that to complete. And after a timeout then Camel will attempt to force
> shutdown.
> Don't you see any kind of shutdown logging about waiting for routes to
> finish and a timeout was hit or something?
>
> On Fri, Jan 29, 2021 at 9:11 AM Michael Martinsen  wrote:
> >
> > Hello Camel users
> >
> > I have a problem with some Apache Camel applications (Spring Boot) that are
> > consuming messages from RabbitMQ.
> > I am running these applications as Windows Services (using WinSW).
> >
> > Sometime when I deploy a new application to the Windows server running the
> > applications, the following exception is logged:
> >
> > 2021-01-28 19:57:24,554 WARN
> > org.apache.camel.component.rabbitmq.RabbitMQConsumer [Camel (camel-1)
> > thread #13 - ShutdownTask] Error occurred while stopping consumer. This
> > exception is ignored
> > java.io.IOException: Unknown consumerTag
> > at com.rabbitmq.client.impl.ChannelN.basicCancel(ChannelN.java:1476)
> > at
> > com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicCancel(AutorecoveringChannel.java:642)
> > at
> > org.apache.camel.component.rabbitmq.RabbitConsumer.doStop(RabbitConsumer.java:185)
> > at org.apache.camel.support.ServiceSupport.stop(ServiceSupport.java:119)
> > at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:142)
> > at
> > org.apache.camel.util.ServiceHelper.stopAndShutdownService(ServiceHelper.java:205)
> > at
> > org.apache.camel.component.rabbitmq.RabbitMQConsumer.closeConnectionAndChannel(RabbitMQConsumer.java:146)
> > at
> > org.apache.camel.component.rabbitmq.RabbitMQConsumer.doSuspend(RabbitMQConsumer.java:161)
> > at org.apache.camel.support.ServiceSupport.suspend(ServiceSupport.java:145)
> > at
> > org.apache.camel.util.ServiceHelper.suspendService(ServiceHelper.java:388)
> > at
> > org.apache.camel.impl.DefaultShutdownStrategy.suspendNow(DefaultShutdownStrategy.java:401)
> > at
> > org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:572)
> > at
> > java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> > at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> > at
> > java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> > at
> > java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> > at java.base/java.lang.Thread.run(Thread.java:830)
> > 2021-01-28 19:57:24,981 INFO
> > org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
> > thread #13 - ShutdownTask] Route: XXX complete, was consuming from:
> > rabbitmq://?declare=false&networkRecoveryInterval=3&queue=test.queue
> > 2021-01-28 19:57:24,981 INFO
> > org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
> > thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
> > from: seda://dlq
> > 2021-01-28 19:57:24,981 INFO
> > org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
> > thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
> > from: direct://YYY
> > 2021-01-28 19:57:24,981 INFO
> > org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
> > thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
> > from: file://YYY
> > 2021-01-28 19:57:24,981 INFO org.apache.camel.impl.DefaultShutdownStrategy
> > [RMI TCP Connection(2)-10.0.3.117] Graceful shutdown of 4 routes completed
> > in 0 seconds
> > 2021-01-28 19:57:24,996 INFO org.apache.camel.impl.DefaultCamelContext [RMI
> > TCP Connection(2)-10.0.3.117] Apache Camel 2.25.2 (CamelContext: camel-1)
> > uptime 7 days 17 hours
> > 2021-01-28 19:57:24,996 INFO org.apache.camel.impl.DefaultCamelContext [RMI
> > TCP Connection(2)-10.0.3.117] Apache Camel 2.25.2 (CamelContext: camel-1)
> > is shutdown in 0.442 seconds
> > 2021-01-28 19:57:25,076 INFO
> > org.springframework.scheduling.concurrent.ExecutorConfigurationSupport [RMI
> > TCP Connection(2)-10.0.3.117] Shutting down ExecutorService
> > 'applicationTaskExecutor'
> >
> > And that's it.
> > Although the exception is only a warning and it states that it's ignored,
> > nothing more happens.
> > The Windows Service does not stop and it's stuck in state "Stopping"..
> > Either the entire Windows server has to be restarted or some ma

RE: Spring Boot, Apache Camel and Undertow

2021-01-29 Thread Jesper Duelund Isaksen
Hi again

I've created the following bug report incl. a reproducer linked in the bug 
report regarding the issue:
CAMEL-16109 - https://issues.apache.org/jira/browse/CAMEL-16109

Feel free to contact me if you need more information.

Kind regards
Jesper Duelund Isaksen

-Original Message-
From: Claus Ibsen  
Sent: 28. januar 2021 14:40
To: users@camel.apache.org
Subject: Re: Spring Boot, Apache Camel and Undertow

 CAUTION - External Mail

Hi

Ah can you create a JIRA about the camel-hystrix-starter issue.
Yeah using plain camel-hystrix is fine as it will then skip the auto 
configuration, but you can use hystrix anyway.



On Thu, Jan 28, 2021 at 2:19 PM Jesper Duelund Isaksen 
 wrote:
>
> Thanks for the quick reply Claus.
>
> That did indeed help. It seems we must then change any existing routes 
> declared as 
> 'from("servlet:https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F0.0.0.0%3A9080%2Ftest%2Fendpoint3&data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C4ebd5b6bc8ff4f2ae98608d8c3924e1c%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474380423648116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Kzq610sRtx%2F2CgyBqs6VixSc%2FMFbM%2BK%2BnlhoqmRyWfI%3D&reserved=0";)'
>  instead of 
> 'from("undertow:https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F0.0.0.0%3A9080%2Ftest%2Fendpoint3&data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C4ebd5b6bc8ff4f2ae98608d8c3924e1c%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474380423648116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Kzq610sRtx%2F2CgyBqs6VixSc%2FMFbM%2BK%2BnlhoqmRyWfI%3D&reserved=0";)'.
>
> The camel-hystrix-starter does need to be removed now though. It results in 
> the following error:
>
> BeanDefinitionOverrideException: Invalid bean definition with name 
> 'servletRegistrationBean' defined in class path resource 
> [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class]:
>  Cannot register bean definition [Root bean: class [null]; scope=; 
> abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; 
> autowireCandidate=true; primary=false; 
> factoryBeanName=org.apache.camel.component.servlet.springboot.ServletMappingAutoConfiguration;
>  factoryMethodName=servletRegistrationBean; initMethodName=null; 
> destroyMethodName=(inferred); defined in class path resource 
> [org/apache/camel/component/servlet/springboot/ServletMappingAutoConfiguration.class]]
>  for bean 'servletRegistrationBean': There is already [Root bean: class 
> [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; 
> dependencyCheck=0; autowireCandidate=true; primary=false; 
> factoryBeanName=org.apache.camel.component.hystrix.springboot.HystrixMappingAutoConfiguration;
>  factoryMethodName=servletRegistrationBean; initMethodName=null; 
> destroyMethodName=(inferred); defined in class path resource 
> [org/apache/camel/component/hystrix/springboot/HystrixMappingAutoConfiguration.class]]
>  bound.
>
> It works if I change back to the "regular" camel-hystrix dependency. Would 
> that be correct?
>
> Kind regards
> Jesper Duelund Isaksen
>
> -Original Message-
> From: Claus Ibsen 
> Sent: 28. januar 2021 13:30
> To: users@camel.apache.org
> Subject: Re: Spring Boot, Apache Camel and Undertow
>
> Hi
>
> You should use camel-servlet-starter to tie to the undertow from spring boot 
> itself.
>
> On Thu, Jan 28, 2021 at 11:53 AM Jesper Duelund Isaksen 
>  wrote:
> >
> > Hello,
> >
> > In my team we are currently attempting to develop a Spring Boot 2.4.2 
> > gateway application which uses Apache Camel 3.7.1 to expose generic http 
> > routes using the Undertow component and routes using the REST DSL.
> >
> > I assume that we are not correctly configuring the application since given 
> > the pom.xml below and having manually configured the RestComponent to use 
> > undertow as consumer, it seems two embedded Undertow instances are started. 
> > The logs below show this.
> > When the test run they fail since they expect the endpoints to be found on 
> > port 9080.
> >
> > Does anyone know what we are doing wrong or misconfiguring in this case?
> >
> > 2021-01-28 11:33:10.741  INFO 13246 --- [   main] io.undertow   
> >: starting server: Undertow - 2.2.3.Final
> > 2021-01-28 11:33:10.854  INFO 13246 --- [   main] 
> > o.s.b.w.e.undertow.UndertowWebServer : Undertow started on port(s) 9080 
> > (http)
> > ...
> > 2021-01-28 11:33:11.194  INFO 13246 --- [   main] 
> > o.a.c.c.undertow.DefaultUndertowHost : Starting Undertow server on 
> > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2F0.0.0.0%3A0%2F&data=04%7C01%7Cjesper.duelund.isaksen%40systematic.com%7C4ebd5b6bc8ff4f2ae98608d8c3924e1c%7C7f6211b17c5c42778403c0ccbd7f0408%7C0%7C0%7C637474380423648116%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAi

Re: Apache Camel Windows Service stuck in state Stopping (due to RabbitMQ Unknown consumerTag exception)

2021-01-29 Thread Claus Ibsen
Hi

When your app is stuck then you can take a thread dump, which can help
pin point to which thread and where its stuck.

Camel uses a separate thread to shutdown routes, while waiting for
that to complete. And after a timeout then Camel will attempt to force
shutdown.
Don't you see any kind of shutdown logging about waiting for routes to
finish and a timeout was hit or something?

On Fri, Jan 29, 2021 at 9:11 AM Michael Martinsen  wrote:
>
> Hello Camel users
>
> I have a problem with some Apache Camel applications (Spring Boot) that are
> consuming messages from RabbitMQ.
> I am running these applications as Windows Services (using WinSW).
>
> Sometime when I deploy a new application to the Windows server running the
> applications, the following exception is logged:
>
> 2021-01-28 19:57:24,554 WARN
> org.apache.camel.component.rabbitmq.RabbitMQConsumer [Camel (camel-1)
> thread #13 - ShutdownTask] Error occurred while stopping consumer. This
> exception is ignored
> java.io.IOException: Unknown consumerTag
> at com.rabbitmq.client.impl.ChannelN.basicCancel(ChannelN.java:1476)
> at
> com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicCancel(AutorecoveringChannel.java:642)
> at
> org.apache.camel.component.rabbitmq.RabbitConsumer.doStop(RabbitConsumer.java:185)
> at org.apache.camel.support.ServiceSupport.stop(ServiceSupport.java:119)
> at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:142)
> at
> org.apache.camel.util.ServiceHelper.stopAndShutdownService(ServiceHelper.java:205)
> at
> org.apache.camel.component.rabbitmq.RabbitMQConsumer.closeConnectionAndChannel(RabbitMQConsumer.java:146)
> at
> org.apache.camel.component.rabbitmq.RabbitMQConsumer.doSuspend(RabbitMQConsumer.java:161)
> at org.apache.camel.support.ServiceSupport.suspend(ServiceSupport.java:145)
> at
> org.apache.camel.util.ServiceHelper.suspendService(ServiceHelper.java:388)
> at
> org.apache.camel.impl.DefaultShutdownStrategy.suspendNow(DefaultShutdownStrategy.java:401)
> at
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:572)
> at
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> at java.base/java.lang.Thread.run(Thread.java:830)
> 2021-01-28 19:57:24,981 INFO
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
> thread #13 - ShutdownTask] Route: XXX complete, was consuming from:
> rabbitmq://?declare=false&networkRecoveryInterval=3&queue=test.queue
> 2021-01-28 19:57:24,981 INFO
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
> thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
> from: seda://dlq
> 2021-01-28 19:57:24,981 INFO
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
> thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
> from: direct://YYY
> 2021-01-28 19:57:24,981 INFO
> org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
> thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
> from: file://YYY
> 2021-01-28 19:57:24,981 INFO org.apache.camel.impl.DefaultShutdownStrategy
> [RMI TCP Connection(2)-10.0.3.117] Graceful shutdown of 4 routes completed
> in 0 seconds
> 2021-01-28 19:57:24,996 INFO org.apache.camel.impl.DefaultCamelContext [RMI
> TCP Connection(2)-10.0.3.117] Apache Camel 2.25.2 (CamelContext: camel-1)
> uptime 7 days 17 hours
> 2021-01-28 19:57:24,996 INFO org.apache.camel.impl.DefaultCamelContext [RMI
> TCP Connection(2)-10.0.3.117] Apache Camel 2.25.2 (CamelContext: camel-1)
> is shutdown in 0.442 seconds
> 2021-01-28 19:57:25,076 INFO
> org.springframework.scheduling.concurrent.ExecutorConfigurationSupport [RMI
> TCP Connection(2)-10.0.3.117] Shutting down ExecutorService
> 'applicationTaskExecutor'
>
> And that's it.
> Although the exception is only a warning and it states that it's ignored,
> nothing more happens.
> The Windows Service does not stop and it's stuck in state "Stopping"..
> Either the entire Windows server has to be restarted or some manual actions
> have to be taken to stop the Windows Service.
>
> So I am really not sure where to look for a problem - if this is in Apache
> Camel / Spring Boot / RabbitMQ / WinSW...
>
> I found this: https://github.com/spring-projects/spring-amqp/issues/1113
>
> But that relates to the Spring AMQP component which I am not using
> (directly). I am using the Spring Boot Camel RabbitMQ Starter.
>
> I noticed someone writing that this happens when the Camel app is stopped
> BEFORE it has read any messages from the RabbitMQ server.
> That's not what I am seeing - I have seen this in production environments
> several times where th

Apache Camel Windows Service stuck in state Stopping (due to RabbitMQ Unknown consumerTag exception)

2021-01-29 Thread Michael Martinsen
Hello Camel users

I have a problem with some Apache Camel applications (Spring Boot) that are
consuming messages from RabbitMQ.
I am running these applications as Windows Services (using WinSW).

Sometime when I deploy a new application to the Windows server running the
applications, the following exception is logged:

2021-01-28 19:57:24,554 WARN
org.apache.camel.component.rabbitmq.RabbitMQConsumer [Camel (camel-1)
thread #13 - ShutdownTask] Error occurred while stopping consumer. This
exception is ignored
java.io.IOException: Unknown consumerTag
at com.rabbitmq.client.impl.ChannelN.basicCancel(ChannelN.java:1476)
at
com.rabbitmq.client.impl.recovery.AutorecoveringChannel.basicCancel(AutorecoveringChannel.java:642)
at
org.apache.camel.component.rabbitmq.RabbitConsumer.doStop(RabbitConsumer.java:185)
at org.apache.camel.support.ServiceSupport.stop(ServiceSupport.java:119)
at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:142)
at
org.apache.camel.util.ServiceHelper.stopAndShutdownService(ServiceHelper.java:205)
at
org.apache.camel.component.rabbitmq.RabbitMQConsumer.closeConnectionAndChannel(RabbitMQConsumer.java:146)
at
org.apache.camel.component.rabbitmq.RabbitMQConsumer.doSuspend(RabbitMQConsumer.java:161)
at org.apache.camel.support.ServiceSupport.suspend(ServiceSupport.java:145)
at
org.apache.camel.util.ServiceHelper.suspendService(ServiceHelper.java:388)
at
org.apache.camel.impl.DefaultShutdownStrategy.suspendNow(DefaultShutdownStrategy.java:401)
at
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:572)
at
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:830)
2021-01-28 19:57:24,981 INFO
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
thread #13 - ShutdownTask] Route: XXX complete, was consuming from:
rabbitmq://?declare=false&networkRecoveryInterval=3&queue=test.queue
2021-01-28 19:57:24,981 INFO
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
from: seda://dlq
2021-01-28 19:57:24,981 INFO
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
from: direct://YYY
2021-01-28 19:57:24,981 INFO
org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask [Camel (camel-1)
thread #13 - ShutdownTask] Route: XXX shutdown complete, was consuming
from: file://YYY
2021-01-28 19:57:24,981 INFO org.apache.camel.impl.DefaultShutdownStrategy
[RMI TCP Connection(2)-10.0.3.117] Graceful shutdown of 4 routes completed
in 0 seconds
2021-01-28 19:57:24,996 INFO org.apache.camel.impl.DefaultCamelContext [RMI
TCP Connection(2)-10.0.3.117] Apache Camel 2.25.2 (CamelContext: camel-1)
uptime 7 days 17 hours
2021-01-28 19:57:24,996 INFO org.apache.camel.impl.DefaultCamelContext [RMI
TCP Connection(2)-10.0.3.117] Apache Camel 2.25.2 (CamelContext: camel-1)
is shutdown in 0.442 seconds
2021-01-28 19:57:25,076 INFO
org.springframework.scheduling.concurrent.ExecutorConfigurationSupport [RMI
TCP Connection(2)-10.0.3.117] Shutting down ExecutorService
'applicationTaskExecutor'

And that's it.
Although the exception is only a warning and it states that it's ignored,
nothing more happens.
The Windows Service does not stop and it's stuck in state "Stopping"..
Either the entire Windows server has to be restarted or some manual actions
have to be taken to stop the Windows Service.

So I am really not sure where to look for a problem - if this is in Apache
Camel / Spring Boot / RabbitMQ / WinSW...

I found this: https://github.com/spring-projects/spring-amqp/issues/1113

But that relates to the Spring AMQP component which I am not using
(directly). I am using the Spring Boot Camel RabbitMQ Starter.

I noticed someone writing that this happens when the Camel app is stopped
BEFORE it has read any messages from the RabbitMQ server.
That's not what I am seeing - I have seen this in production environments
several times where the Camel apps have been running for months and HAVE
consumed messages.
But I am not sure if this is caused by the RabbitMQ server being retarted
while the Camel apps are running...


Any help is most welcome.

More details about my setup:


Spring Boot App
2.3.5.RELEASE

Apache Camel RabbitMQ Starter:
org.apache.camel
camel-rabbitmq-starter
2.25.2

Configured only from applications.properties using:
camel.component.rabbitmq.hostname=...
camel.component.rabbitmq.port-number=...
camel.component.rabbitmq.username=...
camel.component.rabbitmq.password=...

Using WinWS for Windows Service
WinSW 2.2.0.0 (I know there is