I'm using camel-mail to consume mail message via imaps from Google mail. The
route & processor is set up basically like this:
class MyProcessor implements Processor {
@Autowired
private CamelContext camelContext;
@PostConstruct
public void initialize() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() {
from("imaps://[email protected]&password=...&delete=false&unseen=true&consumer.delay=5000&ignoreUnsupportedCharset=true")
.process(MyProcessor.this);
}
});
}
public void process(Exchange exchange) throws Exception {
// ...this works fine
}
}
Generally speaking, this works perfectly. But...on occasion, I see this
type of exception pop up:
WARNING; 10-Jul-2011 21:16:38; tid:9; DefaultPollingConsumerPollStra
tegy rollback; Consumer
Consumer[imaps://imap.googlemail.com?consumer.delay=5000&delete=false&ignoreUnsupportedCharset=true&password=...&unseen=true&username=support%40mycompany.com]
could not poll endpoint:
imaps://imap.googlemail.com?consumer.delay=5000&delete=false&ignoreUnsupportedCharset=true&password=...&unseen=true&username=support%40mycompany.com
caused by: A663 NO System error (Failure)
javax.mail.MessagingException: A742 NO System error (Failure);
nested exception is:
com.sun.mail.iap.CommandFailedException: A663 NO System error
(Failure)
at com.sun.mail.imap.IMAPFolder.open(IMAPFolder.java:1004)
at
org.apache.camel.component.mail.MailConsumer.poll(MailConsumer.java:106)
at
org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.sun.mail.iap.CommandFailedException: A742 NO System error
(Failure)
at com.sun.mail.iap.Protocol.handleResult(Protocol.java:341)
at
com.sun.mail.imap.protocol.IMAPProtocol.select(IMAPProtocol.java:655)
at com.sun.mail.imap.IMAPFolder.open(IMAPFolder.java:928)
... 11 more
At times, this will keep happening iteration after iteration...but the
"A742" code (whatever that is) increments itself...by two at a time, it
seems. i.e. the next time it happens it'll be A744, then A746, and so on.
I'm not 100% sure what's happening, but Google mail may be rate limiting me
or something. Any insight into that particular error would be much
appreciated.
But what I'm really after is...everything I've read on the web suggests that
once you see that error from Google, it's best to close the connection and
reconnect. That, as far as I know, is something I can't easily do using
camel-mail.
I suspect you'll suggest writing an exception handler that stops the route,
then restarts the route. But is there anything camel-mail itself can do in
a more self-maintaining way, short of that sort of a route stop/start? i.e.
a "reconnectOnException=true|false" property? Or even a
"reconnectAfterIterations=nnn" or "maxConnectionLifeSeconds=nnn" property
that would force the connection to be closed and reestablished after some
number of iterations or seconds.
What do you think?
-----
Dan Checkoway
dcheckoway -at- gmail
--
View this message in context:
http://camel.465427.n5.nabble.com/camel-mail-need-to-force-a-close-reconnect-tp4572997p4572997.html
Sent from the Camel - Users mailing list archive at Nabble.com.