Hi,
IIn the below route configurations I am reading the email from Gmail and
then directing to a Cmel bean using seda endpoint. I close the connection
on every poll as a best practice.
While reading the email body in the bean 'imapPreProcessor' I get an
exception as below. Kindly help me.
Exception:
Inside process Error handler with exception {}
org.apache.camel.StreamCacheException: Error during type conversion from
type: jakarta.mail.internet.MimeMultipart to the required type:
org.apache.camel.StreamCache with value
jakarta.mail.internet.MimeMultipart@533502fd due to
org.apache.camel.TypeConversionException: Error during type conversion from
type: jakarta.mail.internet.MimeMultipart to the required type:
org.apache.camel.StreamCache with value
jakarta.mail.internet.MimeMultipart@533502fd due to
jakarta.mail.FolderClosedException: jakarta.mail.FolderClosedException;
from("imaps://" + IMAP_HOST + ":" + IMAP_PORT + "/" + IMAP_FOLDER +
"?accessToken=" + OAUTH_ACCESS_TOKEN +
"&oauth2.enabled=true" + // Enable OAuth2 authentication
"&disconnect=true" +
"&closeFolder=true" +
"&consumer.delay=5000" + // Check for new emails every 5
seconds
.routeId(WSCommonConstants.IMAP_ROUTE_ID)
.autoStartup(true)
.choice()
.when(method(PatternValidator.class, "isValid"))
.to("seda:gotoalart")
.otherwise()
.to("seda:gotoabcd")
.end();// Closes primary choice block;
from("seda:gotoabcd?concurrentConsumers="+commonabcdConsumers)
.routeId("emailProcessChain")
.autoStartup(true)
.process(emailValidationProcessor)
.choice()
.when(simple("${header.validatedUser} != null && ${header.action} ==
null"))
.process(imapPreProcessor) // StreamCacheException is coming here
.otherwise()
.process(authenticationFailedProcessor)
.to("direct:gotothirdstep");
Regards,
Amarnath