I've googled a significant amount on this, and I'm fairly comfortable with JBoss ESB and Camel.
I've defined a Camel Mail endpoint, and my goal is to extract attachments from emails for the purpose of using them for content-based routing.
The Camel integration in JB ESB is a bit of a black box, but basically, the body content of the email is ending up on the message body in the default location as a String. If it's a plaintext or HTML email, this is fine and I can work with it. But if there are multiple attachments, Camel will provide a javax.mail.internet.MimeMultiPart (which is fine)
The problem is that JBoss ESB is trying to "force" this to a String, or so it seems, because the message body default location is literally a string object with the value of e.g. javax.mail.internet.MimeMultipart@100600 When I try to cast the body to a mimeMultipart,via javax.mail.internet.MimeMultipart mime= (MimeMultipart)message.getBody().get();, I get the predictable exception java.lang.ClassCastException: java.lang.String cannot be cast to javax.mail.internet.MimeMultipart
How do I access the different parts of a MIME Multipart message that was inbounded into JBoss ESB using camel mail?
many thanks, AGM
Camel-Mail 2.10
Jboss ESB 5.3.1
Windows Environment
Replicated on colleague's machine
10:39:54,808 INFO [STDOUT] Body Name is org.jboss.soa.esb.message.defaultEntry
10:39:54,809 INFO [STDOUT] Body Class is class java.lang.String
10:39:54,809 INFO [STDOUT] Attempting to display body contents via toString
10:39:54,809 INFO [STDOUT] body value is javax.mail.internet.MimeMultipart@150ce1d
10:39:54,809 INFO [STDOUT] javax.mail.internet.MimeMultipart@150ce1d
10:39:54,809 INFO [STDOUT] class java.lang.String
10:39:54,809 INFO [STDOUT] class java.lang.String
10:39:54,810 ERROR [STDERR] java.lang.ClassCastException: java.lang.String cannot be cast to javax.mail.internet.MimeMultipart
10:39:54,810 ERROR [STDERR] at com.XXX.integration.actions.GetAttachment.process(GetAttachment.java:23)
10:39:54,810 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:667)
10:39:54,810 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:614)
10:39:54,811 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:442)
10:39:54,811 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:587)
10:39:54,811 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
10:39:54,811 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
10:39:54,812 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
10:39:54,812 INFO [STDOUT] FULL SPOOL: