OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"Multiple consumers for the same endpoint is not allowed" for mail endpoints


Hi all,
I am a fairly new Camel user, so most likely the problem exists between 
chair and keyboard, but I have a question about URI uniqueness in the 
context of email providers. I have created some routes in my application 
that draw from several mailboxes on gmail and observed what seemed strange 
behavour.
I'm using camel-core and camel-mail version 2.21.1.
 
As part of a route builder I followed this sequence:
1 Create a MailConfiguration object and setting the username and password 
on it.
  MailConfiguration conf = new MailConfiguration();
  conf.setUsername(...
2 Create a MailComponent with the CamelContext.
  MailComponent component = new MailComponent(camelContext);
3 Set the MailComponent's configuration from the MailConfiguration object.
  component.setConfiguration(conf);
4 Creating the endpoint by passing a URI 
like "imaps://imap.gmail.com:993" to it.
  Endpoint exampleEndpoint = component.createEndpoint(uri);
 
Apparently because every endpoint created like so has the same URI, this 
is a problem. Each additional route, after the first, added caused a now 
familiar error message:
"Multiple consumers for the same endpoint is not allowed"
 
I solved the problem by adding the username to the URI and not to the 
MailConfiguration.
 
My question is why the configuration beyond the URI is not taken into 
account when deciding on the uniqueness of endpoints? Maybe there is a 
better way for me to deal with this issue. My motivation for taking the 
above approach was to leak as little information as possible into the 
logs.
 
  Thanks in advance,
 
-P.J. McKenna.