Bindy component: more than one model object per package

2011-09-12 Thread c.spiegel
Is there any way, to tell Camel which model object to use during CSV
unmarshalling? 

Following szenario:
my.package: 
  -ModelObject1 (annotated with @CsvRecord)
  -ModelObject2 (annotated with @CsvRecord)

Both model object are totally different. I'm trying to poll a folder which
includes different formated csv files:

public void configure() throws Exception {
BindyCsvDataFormat dataFormat = new 
BindyCsvDataFormat("my.package");

from("file://data/csv?noop=true").split().body()
.unmarshal(dataFormat).process(new Processor() {

public void process(Exchange exchange) throws Exception {
System.out.println(exchange.getIn());

}
}); 
}

Bindy fails with 
/java.lang.IllegalArgumentException: Some fields are missing (optional or
mandatory), line : 1/
because Bindy tries to bind to the wrong model object. Is there any way, to
tell Bindy to which model object Bindy should bind to? The only workaround a
found, is to put each model object in an own package (what is not very handy
I think).

Thanks for any help.


--
View this message in context: 
http://camel.465427.n5.nabble.com/Bindy-component-more-than-one-model-object-per-package-tp4793295p4793295.html
Sent from the Camel - Users mailing list archive at Nabble.com.


wiretap and doTry / doCatch

2011-09-12 Thread Damian Harvey
Hi all,

As far as I can see wiretap() can't be used with doCatch() as it returns a 
WireTapDefinition rather than a TryDefinition when inside a 
doTry().

Is this intentional? Is the idea to use the new endDoTry()  in a situation like 
this?

(I'm using 2.8)

Thanks,

Damian.



This communication (and any attachments) is directed in confidence to the 
addressee(s) listed above, and may not otherwise be distributed, copied or 
used. The contents of this communication may also be subject to privilege, and 
all rights to that privilege are expressly claimed and not waived. If you have 
received this communication in error, please notify us by reply e-mail or by 
telephone and delete this communication (and any attachments) without making a 
copy.

Before opening or using attachments, you should check them for viruses and 
defects. We do not accept liability in connection with computer virus, data 
corruption, delay, interruption, unauthorised access or unauthorised amendment.


Re: Bindy component: more than one model object per package

2011-09-12 Thread Claus Ibsen
Hi

We would like to improve this in the future, either Camel 3.0, or earlier.
However we would like to avoid any big breakings and thus we need to
be a bit careful on the 2.x branch. For 3.0 we can of course make
bigger changes if it is indeed needed.

So you can have multiple model objects in the same package, and then
just pin point the "main" class in the DataFormat.
For example as JAXB works.

I think there is a JIRA ticket in there already for this.


On Mon, Sep 12, 2011 at 9:02 AM, c.spiegel  wrote:
> Is there any way, to tell Camel which model object to use during CSV
> unmarshalling?
>
> Following szenario:
> my.package:
>  -ModelObject1 (annotated with @CsvRecord)
>  -ModelObject2 (annotated with @CsvRecord)
>
> Both model object are totally different. I'm trying to poll a folder which
> includes different formated csv files:
>
> public void configure() throws Exception {
>                BindyCsvDataFormat dataFormat = new 
> BindyCsvDataFormat("my.package");
>
>                from("file://data/csv?noop=true").split().body()
>                .unmarshal(dataFormat).process(new Processor() {
>
>                public void process(Exchange exchange) throws Exception {
>                        System.out.println(exchange.getIn());
>
>                }
>        });
> }
>
> Bindy fails with
> /java.lang.IllegalArgumentException: Some fields are missing (optional or
> mandatory), line : 1/
> because Bindy tries to bind to the wrong model object. Is there any way, to
> tell Bindy to which model object Bindy should bind to? The only workaround a
> found, is to put each model object in an own package (what is not very handy
> I think).
>
> Thanks for any help.
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Bindy-component-more-than-one-model-object-per-package-tp4793295p4793295.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: wiretap and doTry / doCatch

2011-09-12 Thread Claus Ibsen
On Mon, Sep 12, 2011 at 9:04 AM, Damian Harvey  wrote:
> Hi all,
>
> As far as I can see wiretap() can't be used with doCatch() as it returns a 
> WireTapDefinition rather than a TryDefinition when inside a 
> doTry().
>
> Is this intentional? Is the idea to use the new endDoTry()  in a situation 
> like this?
>

Yeah the Java programming language has some limitations how far you
can go with simulating a DSL in Java.
So in some cases you need to use endXXX to "help Java".


> (I'm using 2.8)
>
> Thanks,
>
> Damian.
>
> 
>
> This communication (and any attachments) is directed in confidence to the 
> addressee(s) listed above, and may not otherwise be distributed, copied or 
> used. The contents of this communication may also be subject to privilege, 
> and all rights to that privilege are expressly claimed and not waived. If you 
> have received this communication in error, please notify us by reply e-mail 
> or by telephone and delete this communication (and any attachments) without 
> making a copy.
>
> Before opening or using attachments, you should check them for viruses and 
> defects. We do not accept liability in connection with computer virus, data 
> corruption, delay, interruption, unauthorised access or unauthorised 
> amendment.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: unmarshal(CsvDataFormat). different behavior for one or multiples lines.

2011-09-12 Thread Claus Ibsen
Hi

I have created a ticket
https://issues.apache.org/jira/browse/CAMEL-4440

On Thu, Sep 8, 2011 at 8:20 AM, Claus Ibsen  wrote:
> On Wed, Sep 7, 2011 at 4:57 PM, dportabella  
> wrote:
>> unmarshal(CsvDataFormat) produces a List>,
>> however, it the CSV file has only one line, it produces List instead
>> of List>.
>>
>> We don't know in advance how many lines the CSV file will have,
>> that could be zero, one, or more than one,
>> and we should expect to receive always a List>.
>>
>> Is there an option to always receive a List> even if
>> there is only one line?
>> We didn't find any documentation about this in the website:
>> http://camel.apache.org/csv.html
>>
>
> I guess it would make sense to align this so the camel-csv always uses
> the same way.
>
> Fell free to create a JIRA ticket about this.
> http://camel.apache.org/support
>
>
>
>>
>> Regards,
>> David
>>
>>
>> 
>> import org.apache.camel.*;
>> import org.apache.commons.csv.CSVStrategy;
>>
>> class Test {
>>    public static void main(String args[]) throws Exception {
>>        CsvDataFormat csv = new CsvDataFormat();
>>        csv.setAutogenColumns(false);
>>        CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
>>        strategy.setDelimiter(',');
>>        csv.setStrategy(strategy);
>>
>>        CamelContext context = new DefaultCamelContext();
>>
>>        context.addRoutes(new RouteBuilder() {
>>            public void configure() {
>>                from("file:files/inbox")
>>                .unmarshal(csv)
>>                .process(new MyLog());
>>            }
>>        });
>>    }
>> }
>>
>> class MyLog implements Processor {
>>    public void process(Exchange exchange) throws Exception {
>>        List> data = (List>)
>> exchange.getIn().getBody();
>>        for (List line : data) {
>>            System.out.println(String.format("TEST %s - %s - %s",
>> line.get(0), line.get(1), line.get(2)));
>>        }
>>    }
>> }
>> 
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/unmarshal-CsvDataFormat-different-behavior-for-one-or-multiples-lines-tp4778814p4778814.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: Bindy component: more than one model object per package

2011-09-12 Thread c.spiegel

Claus Ibsen-2 wrote:
> 
> So you can have multiple model objects in the same package, and then
> just pin point the "main" class in the DataFormat.
> For example as JAXB works.
> 

Will this feature be included in future releases or is this still possible?

--
View this message in context: 
http://camel.465427.n5.nabble.com/Bindy-component-more-than-one-model-object-per-package-tp4793295p4793417.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Missing properties on exception

2011-09-12 Thread Claus Ibsen
Hi

You can try storing that JMSCorrelationID as a property directly on
the Exchange instead of the Message.
Then it ought to be kept safe.

exchange.setProperty("xxx", value);


On Tue, Sep 6, 2011 at 6:25 PM, pkleczka  wrote:
> Hello
>
> *Problem*: When an incoming message arrives in my queue, I copy the message
> ID into the JMSCorrelationID on header before routing to other internal
> queues. When my exception handling engages, the property disappears.
>
> Below is the method signature for the bean I am calling when the exception
> happens:
> *public String transform(String message)*
>
> Below is the XML for my route:
>
>
> In my exception handler, I call a bean to "wrap" the original message in
> some additional XML (including my JMSCorrelationID). The signature for that
> method is:
> *public void respond(Exchange exchange, Exception exception)*
>
> In that method, I pull the JMSCorrelationID as follows:
> *exchange.getIn().getHeader("JMSCorrelationID");*
>
> In another error handler, that uses a try/catch block, I get back a non-null
> JMSCorrelationID. I am at a loss as to why I am getting a null on the
> onException handler.  Any pointers are appreciated.
>
> Thanks,
> Peter
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Missing-properties-on-exception-tp4775029p4775029.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Re: [ camel ] XML Namespace and Xpath injection

2011-09-12 Thread Marcin Cylke

On 09/12/2011 02:21 PM, atouret.nos...@free.fr wrote:

Hello,
I'm trying to inject a value in bean trough an xpath injection as following :


public void audit(@XPath("/Envelope/Body/getToken/username/text()") 
String id, @Body String body) {
logger.info("Id :"+id );
logger.info("Body = "+body);
}

Unfortunately, all the elements are fully qualified by a namespace.


You can pass namespaces to @XPath annotation, or create your own 
annotation, with namespaces included:


@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
@LanguageAnnotation(language = "xpath", factory = 
XpathExpressionAnnotationFactoryImproved.class)

public @interface StXpath {
String value();

// You can add the namespaces as the default value of the annotation
	NamespacePrefix[] namespaces() default { @NamespacePrefix(prefix = 
"st", uri = "http://example.pl/service/schemas";) };


Class resultType() default String.class;
}




Re: XML Namespace and Xpath injection

2011-09-12 Thread Claus Ibsen
The @XPath annotation has an attribute to set namespaces.

There is an example in Camel in Action book p118


On Mon, Sep 12, 2011 at 2:21 PM,   wrote:
> Hello,
> I'm trying to inject a value in bean trough an xpath injection as following :
>
>
>        public void audit(@XPath("/Envelope/Body/getToken/username/text()") 
> String id, @Body String body) {
>                logger.info("Id :"+id );
>                logger.info("Body = "+body);
>        }
>
> Unfortunately, all the elements are fully qualified by a namespace.
>
> http://schemas.xmlsoap.org/soap/envelope/"; 
> xmlns:tok="http://mynamespace";>
>   
>   
>      
>         
>         mylogin
>      
>   
> 
>
> I tried to lookup the element value by this xpath query 
> /Envelope/Body/getToken/username/text() or 
> /soapenv:Envelope/soapenv:Body/tok:getToken/tok:username/text(), but both 
> doesn't work.
>
> I guess the problem is that the namespace context is missing.
> How to specify the namespace context ? In the xml file ? In the java class by 
> an annotation ?
>
> Thanks in advance for your help.
>
> Regards
> Alexandre Touret
>
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Calling shell script from Camel

2011-09-12 Thread jeevan.koteshwara
Hi,
I have a requirement, where I need to call a shell script (for zipping
and unzipping files with associated passwords if any) from the route.

I have chosen exec component to do so. I have seen exec:java or exec:perl to
execute respective java or perl files/scripts. Is there any direct way to
execute the shell script using exec (similar to exex:java or exec:perl etc).
Or do I need to provide the the file path of the shell script to be
executed.

for ex:

from(src).to("exec:/opt/script/compress.sh");

Also, I am using ExecBinding.EXEC_COMMAND_ARGS to pass the arguments
dynamically to the shell script.

Please suggest, is this approach is the best approach or not. Is there any
other solutions available for the same.

Thanks and Regards,
Jeevan Mithyantha. 

--
View this message in context: 
http://camel.465427.n5.nabble.com/Calling-shell-script-from-Camel-tp4794335p4794335.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Bindy component: more than one model object per package

2011-09-12 Thread Claus Ibsen
On Mon, Sep 12, 2011 at 9:52 AM, c.spiegel  wrote:
>
> Claus Ibsen-2 wrote:
>>
>> So you can have multiple model objects in the same package, and then
>> just pin point the "main" class in the DataFormat.
>> For example as JAXB works.
>>
>
> Will this feature be included in future releases or is this still possible?
>

In future releases.

> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Bindy-component-more-than-one-model-object-per-package-tp4793295p4793417.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/


Global onCompletion

2011-09-12 Thread OrackBahama
Hi,

although I've read several posts for this, I'm quite unsure if the
"onCompletion" construct will fit my needs.
As far as I've understood, this is a hook that's called after completion of
the route (when defined in front of the "from" ...).

I'll explain my problem in the following example. 
I want to process the files in a directory and every file should result in
one log entry - successful or not.
Then, after all files have been processed, the logfile should be closed and
transferred back to the customer.

Assume, we have 100 files -> then the logfile contains 100 lines.
Question: If I restrict the messages per poll (let's say twenty) - will that
result in 5 calls of "onCompletion" (and 5 logfiles with 20 lines) ? Is that
meant with "UnitOfWork" ?

public class CompletionTestRouteBuilder extends RouteBuilder
{
 
/*
   * 
   * @throws Exception 
  
/
  @Override
  public void configure() throws Exception
  {
onCompletion()
  // close whole logfile and transfer it to customer
  // contains one line per processed file
  // purpose: one logfile per directory poll/UnitOfWork
  ...
;
 
from( "file:C:/tmp/inbox" //  + "?maxMessagesPerPoll=20"
)
 
 // process file and write log entry per-file in logfile
 ...   
 .to( "file:C:/tmp/outbox" )
;
  }
}


Hopefully someone could explain a bit - thanks in advance !

Best regards

--
View this message in context: 
http://camel.465427.n5.nabble.com/Global-onCompletion-tp4794456p4794456.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Global onCompletion

2011-09-12 Thread Donald Whytock
I believe OnCompletion is called on each exchange.  One file should be
one exchange, so each file would generate a call to OnCompletion.

If polling is restricted to 20 files at a time, that should still be
20 exchanges, resulting in 20 calls to OnCompletion.

Don

On Mon, Sep 12, 2011 at 10:45 AM, OrackBahama  wrote:
> Hi,
>
> although I've read several posts for this, I'm quite unsure if the
> "onCompletion" construct will fit my needs.
> As far as I've understood, this is a hook that's called after completion of
> the route (when defined in front of the "from" ...).
>
> I'll explain my problem in the following example.
> I want to process the files in a directory and every file should result in
> one log entry - successful or not.
> Then, after all files have been processed, the logfile should be closed and
> transferred back to the customer.
>
> Assume, we have 100 files -> then the logfile contains 100 lines.
> Question: If I restrict the messages per poll (let's say twenty) - will that
> result in 5 calls of "onCompletion" (and 5 logfiles with 20 lines) ? Is that
> meant with "UnitOfWork" ?
>
> public class CompletionTestRouteBuilder extends RouteBuilder
> {
>
> /*
>   *
>   * @throws Exception
>
> /
>  @Override
>  public void configure() throws Exception
>  {
>    onCompletion()
>      // close whole logfile and transfer it to customer
>      // contains one line per processed file
>      // purpose: one logfile per directory poll/UnitOfWork
>      ...
>    ;
>
>    from( "file:C:/tmp/inbox" //  + "?maxMessagesPerPoll=20"
>        )
>
>     // process file and write log entry per-file in logfile
>     ...
>     .to( "file:C:/tmp/outbox" )
>    ;
>  }
> }
>
>
> Hopefully someone could explain a bit - thanks in advance !
>
> Best regards
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Global-onCompletion-tp4794456p4794456.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


No consumers available for direct endpoint on start.

2011-09-12 Thread bbuzzard
I'm receiving files from an ActiveMQ queue, directing the files to a direct
endpoint which in turns sends the files back to a output ActiveMQ queue. 
This works great and I haven't had problems until last Friday when I made a
modification to the camel.xml file.  When I restarted ActiveMQ I checked the
logs and it indicates that camel could not find the direct:DstAs2 end, but a
few minutes later it did find it and automatically started working
perfectly.  I'll attach a snippet of my log so you can see what I see.
http://camel.465427.n5.nabble.com/file/n4794889/DIRECT_ERROR.txt
DIRECT_ERROR.txt 

I assume that the message was inflight between the inbound queue and the
direct:DstAs2 end point, but the direct:DstAs2 end point was not completely
up yet.  Can anyone explain to me how this happens?  More importantly how to
avoid it?

--
View this message in context: 
http://camel.465427.n5.nabble.com/No-consumers-available-for-direct-endpoint-on-start-tp4794889p4794889.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Global onCompletion

2011-09-12 Thread boday
one way to do this is to use the  http://camel.apache.org/aggregator2.html
aggregator 's completionFromBatchConsumer mode.  This will allow you to
group exchanges together based on the size of the file batch, etc...

from("file:inbound?maxMessagesPerPoll=20")
.process(...)
.aggregator(constant(true),
MyAggregationStrategy()).completionFromBatchConsumer()
.to("log:finishedBatch");


OrackBahama wrote:
> 
> Hi,
> 
> although I've read several posts for this, I'm quite unsure if the
> "onCompletion" construct will fit my needs.
> As far as I've understood, this is a hook that's called after completion
> of the route (when defined in front of the "from" ...).
> 
> I'll explain my problem in the following example. 
> I want to process the files in a directory and every file should result in
> one log entry - successful or not.
> Then, after all files have been processed, the logfile should be closed
> and transferred back to the customer.
> 
> Assume, we have 100 files -> then the logfile contains 100 lines.
> Question: If I restrict the messages per poll (let's say twenty) - will
> that result in 5 calls of "onCompletion" (and 5 logfiles with 20 lines) ?
> Is that meant with "UnitOfWork" ?
> 
> public class CompletionTestRouteBuilder extends RouteBuilder
> {
>  
> /*
>* 
>* @throws Exception 
>   
> /
>   @Override
>   public void configure() throws Exception
>   {
> onCompletion()
>   // close whole logfile and transfer it to customer
>   // contains one line per processed file
>   // purpose: one logfile per directory poll/UnitOfWork
>   ...
> ;
>  
> from( "file:C:/tmp/inbox" //  + "?maxMessagesPerPoll=20"
> )
>  
>  // process file and write log entry per-file in logfile
>  ...   
>  .to( "file:C:/tmp/outbox" )
> ;
>   }
> }
> 
> 
> Hopefully someone could explain a bit - thanks in advance !
> 
> Best regards
> 


-
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/Global-onCompletion-tp4794456p4795874.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: No consumers available for direct endpoint on start.

2011-09-12 Thread boday
try specifying an explicit 
http://camel.apache.org/configuring-route-startup-ordering-and-autostartup.html
startup order  to your routes to make sure the direct consumer route is
started prior to the route that reads from the queue...


bbuzzard wrote:
> 
> I'm receiving files from an ActiveMQ queue, directing the files to a
> direct endpoint which in turns sends the files back to a output ActiveMQ
> queue.  This works great and I haven't had problems until last Friday when
> I made a modification to the camel.xml file.  When I restarted ActiveMQ I
> checked the logs and it indicates that camel could not find the
> direct:DstAs2 end, but a few minutes later it did find it and
> automatically started working perfectly.  I'll attach a snippet of my log
> so you can see what I see.
> http://camel.465427.n5.nabble.com/file/n4794889/DIRECT_ERROR.txt
> DIRECT_ERROR.txt 
> 
> I assume that the message was inflight between the inbound queue and the
> direct:DstAs2 end point, but the direct:DstAs2 end point was not
> completely up yet.  Can anyone explain to me how this happens?  More
> importantly how to avoid it?
> 


-
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/No-consumers-available-for-direct-endpoint-on-start-tp4794889p4795886.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Calling shell script from Camel

2011-09-12 Thread boday
yep, you should be able to call a shell script directly like this...


jeevan.koteshwara wrote:
> 
> Hi,
> I have a requirement, where I need to call a shell script (for zipping
> and unzipping files with associated passwords if any) from the route.
> 
> I have chosen exec component to do so. I have seen exec:java or exec:perl
> to execute respective java or perl files/scripts. Is there any direct way
> to execute the shell script using exec (similar to exex:java or exec:perl
> etc). Or do I need to provide the the file path of the shell script to be
> executed.
> 
> for ex:
> 
> from(src).to("exec:/opt/script/compress.sh");
> 
> Also, I am using ExecBinding.EXEC_COMMAND_ARGS to pass the arguments
> dynamically to the shell script.
> 
> Please suggest, is this approach is the best approach or not. Is there any
> other solutions available for the same.
> 
> Thanks and Regards,
> Jeevan Mithyantha.
> 


-
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/Calling-shell-script-from-Camel-tp4794335p4795990.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel mail imap :javax.mail.FolderClosedException

2011-09-12 Thread kevin707
Hi,

We are using imap to consume mail with route:
   
from("imap://username@host?password=pass&consumer.delay=5000&unseen=true&fetchSize=100&delete=true").process(new
OrderQueryProcessor()).to("seda:email_process")

private class OrderQueryProcessor implements Processor {
  public void process(Exchange exchange) throws Exception {
String id = exchange.getIn().getHeader("from", String.class);
exchange.getIn().setBody((id + "   " +
exchange.getIn().getBody(String.class)).encodeAsBase64());
  }
}


All is fine and except for :javax.mail.FolderClosedException

 Caused by: [javax.mail.FolderClosedException - null]
javax.mail.FolderClosedException
at com.sun.mail.imap.IMAPMessage.getProtocol(IMAPMessage.java:133)
at com.sun.mail.imap.IMAPMessage.setFlags(IMAPMessage.java:843)
at javax.mail.Message.setFlag(Message.java:565)
at
org.apache.camel.component.mail.MailConsumer.processCommit(MailConsumer.java:268)
at
org.apache.camel.component.mail.MailConsumer$1.onComplete(MailConsumer.java:172)
at
org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
at 
org.apache.camel.impl.DefaultUnitOfWork.done(DefaultUnitOfWork.java:172)
at
org.apache.camel.processor.UnitOfWorkProcessor.doneUow(UnitOfWorkProcessor.java:121)
at
org.apache.camel.processor.UnitOfWorkProcessor.access$000(UnitOfWorkProcessor.java:36)
at
org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:106)
at
org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:262)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:330)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
at
org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:169)
at 
org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:111)
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)


Please advice.

kevin



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-imap-javax-mail-FolderClosedException-tp4796608p4796608.html
Sent from the Camel - Users mailing list archive at Nabble.com.