Re: creating routes dynamically

2012-07-06 Thread Henryk Konsek
> You could use a Dynamic Router:

Yeah, I suggest to evaluate Dynamic Router and Recipient List for your
case. In many cases when somebody wants to create routes dynamically
at runtime, she actually needs these two patterns :) .

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


InvalidPayloadException deprecated in 2.10.0

2012-07-06 Thread PJ Walstroem
hello,
I just noticed that InvalidPayloadException is deprecated in 2.10.0. Reading
the source code, the only hint is "// TODO: We should remove this class in
Camel 3.0, and just rely on the other exceptions for type conversion issues"

So what do you suggest to use instead of the InvalidPayloadException?

/pj

--
View this message in context: 
http://camel.465427.n5.nabble.com/InvalidPayloadException-deprecated-in-2-10-0-tp5715592.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: creating routes dynamically

2012-07-06 Thread Sri
Hi ,

I have used in following way  which works creating routes dynamically.

 
ProducerTemplate template=exchange.getContext().createProducerTemplate();
 
Message msg=exchange.getOut();
System.err.println("Out msg headers " + msg.getHeaders());

for(int i=0;i<3;i++){
template.sendBody("jms:incomingData"+i,
exchange.getIn().getBody());
}

may be easy one. How ever I wanted to read the messages from these routes
and But no clue how to inform this routes the which is going to be consumed?

Any Ideas

Sri


--
View this message in context: 
http://camel.465427.n5.nabble.com/creating-routes-dynamically-tp5715557p5715595.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: creating routes dynamically

2012-07-06 Thread Henryk Konsek
> How ever I wanted to read the messages from these routes
> and But no clue how to inform this routes the which is going to be consumed?

I don't get this sentence, could you elaborate it a little bit?

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


Re: IdempotentRepository

2012-07-06 Thread Sam (Stephen Samuel)
"This operation is used if the option eager has been enabled."

Take a look at that, that might be why confirm is not being called.

On Fri, Jul 6, 2012 at 7:17 AM, Christian Lipp wrote:

> Hello!
>
> I am fetching files from a FTP server (severall GB for the next years).
> The files are produced daily in directories which correspond to the date,
> like
>
> -   20120501
> -   20120502
> -   ...
>
> I have only read rights and I am not the only consumer. This means that
> they keep the last month or so on the server and I fetch on a daily base.
> To avoid that I am fetching files twice I want to use an
> IdempotentRepository implementation. I don't want to save each file in a
> database or in a text file because the service will run for years and this
> is just unnecessary data.
>
> What I want to store is the last processed date only. This handles just
> the directories and would mean that I need some other strategy for the
> files. I could combine this approach with the default in memory based
> store. But let just stick to the directories:
>
> I read the directory sorted by file name. The IdempotentRepository is
> called by the FtpConsumer with
>
> - start()
> - contains() for every directory and file
> - add() for files only
>
> and that's it. No stop(), no confirm(). When I have errors, sometimes
> remove() is called. Since the repository is called only with String (the
> full path) I have not information if I deal with directories or files. I
> know it from the structure, but I am not able to implement a generic
> solution.
>
> Anyway the idea is:
>
> - Store the LastProcessedDate inside the repository
> - contains(): if the path contains an already processed date
> ( - add(): if add() jumps to the next directory I set the LastProcessedDate
> to the directory before
>
> The only problem is the last processed directory: even if it is finished I
> do not get the chance to mark it as processed (set LastProcessedDate to its
> value).
>
> So finally my questions: do you think this approach makes sense and if
> yes: how would you deal with the last processed directory?
> If no, how would you solve it?
>
> Thanks and kind regards, Christian
>



-- 
-Sam


Re: Camel Velocity Template throwing error

2012-07-06 Thread Henryk Konsek
> I tried JUnit sample to test velocity in camel given by Claus at
> http://camel.apache.org/velocity.html
>
> And it is failing for me. I am getting following AssertionError:
>
> java.lang.AssertionError: mock://result Received message count. Expected:
> <1> but was: <0>

I copied the code to my IntelliJ and executed it - works like a charm
:) . No assertion error.

Could you provide us minimal Maven module with test which fails on
'mvn test'? I can't help you with bug I cannot reproduce :) .

Laters.

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


Re: Help with newline while writing to the file.

2012-07-06 Thread Henryk Konsek
>Need help adding newline while writing to the file.
> I am writing very large file using Apache Camel's File Component.
> I am using StringBuffer to store very large string and then passing (passing
> string ex.getIn().setBody(stringbuffer.toString()); )  it to the
> file endpoint ()

What about using Stream component [1] for that purpose? Instead of
caching lines in StringBuffer you can send them to the file as they
arrive.

from("seda:linesQueue").to("stream:file?fileName=outputFile");

This is more message-oriented-middleware way of handling large output files :) .

[1] http://camel.apache.org/stream.html

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com


Camel Samba/JCIFS component

2012-07-06 Thread Pontus Ullgren
Hello,

Since Stephen started this week in a spirit of sharing I just wanted
to announce that a camel samba/jcifs component that a college of mine
(Martin Samuelsson) created for an integration project has now been
published on github.
https://github.com/Redpill-Linpro/camel-smb

Current status is that "it works for us" and it still needs some more
polishing especially when it comes to javadoc and unit test cases.

Martin mentioned that after asking about such a component he has been
contacted by others that was interested so by doing this announcement
I hope to reach as many as possible.

Cheers
Pontus Ullgren


AW: IdempotentRepository

2012-07-06 Thread Christian Lipp
Do you mean " eagerMaxMessagesPerPoll" ?
I set it to false, but nothing changed.

In the camel code I could only find

contains in GenericFileConsumer
Add, remove in GenericFileOnCompletion

Regards, CL

-Ursprüngliche Nachricht-
Von: Sam (Stephen Samuel) [mailto:samspad...@gmail.com] 
Gesendet: Freitag, 06. Juli 2012 11:17
An: users@camel.apache.org
Betreff: Re: IdempotentRepository

"This operation is used if the option eager has been enabled."

Take a look at that, that might be why confirm is not being called.

On Fri, Jul 6, 2012 at 7:17 AM, Christian Lipp wrote:

> Hello!
>
> I am fetching files from a FTP server (severall GB for the next years).
> The files are produced daily in directories which correspond to the 
> date, like
>
> -   20120501
> -   20120502
> -   ...
>
> I have only read rights and I am not the only consumer. This means 
> that they keep the last month or so on the server and I fetch on a daily base.
> To avoid that I am fetching files twice I want to use an 
> IdempotentRepository implementation. I don't want to save each file in 
> a database or in a text file because the service will run for years 
> and this is just unnecessary data.
>
> What I want to store is the last processed date only. This handles 
> just the directories and would mean that I need some other strategy 
> for the files. I could combine this approach with the default in 
> memory based store. But let just stick to the directories:
>
> I read the directory sorted by file name. The IdempotentRepository is 
> called by the FtpConsumer with
>
> - start()
> - contains() for every directory and file
> - add() for files only
>
> and that's it. No stop(), no confirm(). When I have errors, sometimes
> remove() is called. Since the repository is called only with String 
> (the full path) I have not information if I deal with directories or 
> files. I know it from the structure, but I am not able to implement a 
> generic solution.
>
> Anyway the idea is:
>
> - Store the LastProcessedDate inside the repository
> - contains(): if the path contains an already processed date
> ( - add(): if add() jumps to the next directory I set the 
> LastProcessedDate to the directory before
>
> The only problem is the last processed directory: even if it is 
> finished I do not get the chance to mark it as processed (set 
> LastProcessedDate to its value).
>
> So finally my questions: do you think this approach makes sense and if
> yes: how would you deal with the last processed directory?
> If no, how would you solve it?
>
> Thanks and kind regards, Christian
>



--
-Sam


Assigning File names to exchanges generated from split

2012-07-06 Thread somnath
Hi,

My Camel route looks like below
from("file:/camel/inbox?noop=true&delay=48")
.autoStartup(true)

.aggregate(simple(ANY_LITERAL),(OMAggregationStrategy)context.getBean("om-aggregation-strategy")).completionFromBatchConsumer()
.beanRef("om-processor", "process")
.split(body()).parallelProcessing()
*   .setHeader(Exchange.FILE_NAME).simple("${exchangeId}.csv")*
.to("file:/camel/outbox?flatten=true");

I want to be able to generate more meaningful names to the files rather than
the one assigned through the setHeader line which basically is the exchange
ID. The processor can spit out the various components of the name which I
can assign to a bean in the processor bean. Is there a way I can access this
bean in the setHeader section?

-Somnath

--
View this message in context: 
http://camel.465427.n5.nabble.com/Assigning-File-names-to-exchanges-generated-from-split-tp5715603.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Filter and Aggregation Completion

2012-07-06 Thread somnath
Hi,

My requirement is 
1) Read a file location and extract only those files that have "End
Date=Today's Date" as one of the headers.
2) Combine all of these files and generate a single file out of it.

When I tried with 
from("file:/camel/inbox?noop=true")
.filter().method("my-filter", "readyToProcess") // Has the
logic described in requirement (1)
.aggregate(simple(ANY_LITERAL),new
MyAggregator()).completionFromBatchConsumer()
.beanRef("my-processor", "process")
.to("file:/camel/outbox?flatten=true");

The program never enters the my-processor bean class and hence the files are
not generated at all.

When removed the filter logic to the aggregate class it worked cleanly
from("file:/camel/inbox?noop=true")
.aggregate(simple(ANY_LITERAL),new
MyAggregator()).completionFromBatchConsumer()
.beanRef("my-processor", "process")
.to("file:/camel/outbox?flatten=true");

Is this an expected behaviour?

-Somnath


--
View this message in context: 
http://camel.465427.n5.nabble.com/Filter-and-Aggregation-Completion-tp5715604.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: IdempotentRepository

2012-07-06 Thread Marco Westermann

Hi,

I had a very similar problem. I wrote a little bean which writes the 
last number processed to a file. Another method gives me the last number 
processed.


regards, Marco

Am 06.07.2012 11:53, schrieb Christian Lipp:

Do you mean " eagerMaxMessagesPerPoll" ?
I set it to false, but nothing changed.

In the camel code I could only find

contains in GenericFileConsumer
Add, remove in GenericFileOnCompletion

Regards, CL

-Ursprüngliche Nachricht-
Von: Sam (Stephen Samuel) [mailto:samspad...@gmail.com]
Gesendet: Freitag, 06. Juli 2012 11:17
An: users@camel.apache.org
Betreff: Re: IdempotentRepository

"This operation is used if the option eager has been enabled."

Take a look at that, that might be why confirm is not being called.

On Fri, Jul 6, 2012 at 7:17 AM, Christian Lippwrote:


Hello!

I am fetching files from a FTP server (severall GB for the next years).
The files are produced daily in directories which correspond to the
date, like

-   20120501
-   20120502
-   ...

I have only read rights and I am not the only consumer. This means
that they keep the last month or so on the server and I fetch on a daily base.
To avoid that I am fetching files twice I want to use an
IdempotentRepository implementation. I don't want to save each file in
a database or in a text file because the service will run for years
and this is just unnecessary data.

What I want to store is the last processed date only. This handles
just the directories and would mean that I need some other strategy
for the files. I could combine this approach with the default in
memory based store. But let just stick to the directories:

I read the directory sorted by file name. The IdempotentRepository is
called by the FtpConsumer with

- start()
- contains() for every directory and file
- add() for files only

and that's it. No stop(), no confirm(). When I have errors, sometimes
remove() is called. Since the repository is called only with String
(the full path) I have not information if I deal with directories or
files. I know it from the structure, but I am not able to implement a
generic solution.

Anyway the idea is:

- Store the LastProcessedDate inside the repository
- contains(): if the path contains an already processed date
(


--
-Sam





FTP misses few bytes when downloading files

2012-07-06 Thread Nafees
Hi All,

I am using FTP component to download files from FTP server to my local
folder, but it is missing 2 bytes of data for few files. 

My FTP url will be like this:
{0}://{1}@{2}/{3}?password={4}&passiveMode={5}&pollStrategy=#optimerPoll&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=1&localWorkDirectory=/tmp&idempotent=true

My File URL is 
{0}://{1}?noop={2}&autoCreate=false

 why it is unable to download files correctly. Please help me out.

Thanks & Regards
Nafees

--
View this message in context: 
http://camel.465427.n5.nabble.com/FTP-misses-few-bytes-when-downloading-files-tp5715593.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: FTP misses few bytes when downloading files

2012-07-06 Thread Claus Ibsen
Hi

Maybe you need to use binary transfer mode, binary=true
http://camel.apache.org/ftp2

On Fri, Jul 6, 2012 at 10:25 AM, Nafees  wrote:
> Hi All,
>
> I am using FTP component to download files from FTP server to my local
> folder, but it is missing 2 bytes of data for few files.
>
> My FTP url will be like this:
> {0}://{1}@{2}/{3}?password={4}&passiveMode={5}&pollStrategy=#optimerPoll&throwExceptionOnConnectFailed=true&maximumReconnectAttempts=1&localWorkDirectory=/tmp&idempotent=true
>
> My File URL is
> {0}://{1}?noop={2}&autoCreate=false
>
>  why it is unable to download files correctly. Please help me out.
>
> Thanks & Regards
> Nafees
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/FTP-misses-few-bytes-when-downloading-files-tp5715593.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.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Filter and Aggregation Completion

2012-07-06 Thread Pontus Ullgren
Just a quick guess.

Since you are filtering out messages from the batch the aggregator
will not reach a decision that the batch is completed.
The completeion from batch will wait for ALL message to arrive.
See section "Using Batch Consumer" on this page
http://camel.apache.org/aggregator.html

You should probably use some other means to verify that the batch is
complete such as a custom PredicateAggregationCollection.


// Pontus


On Fri, Jul 6, 2012 at 12:06 PM, somnath  wrote:
> Hi,
>
> My requirement is
> 1) Read a file location and extract only those files that have "End
> Date=Today's Date" as one of the headers.
> 2) Combine all of these files and generate a single file out of it.
>
> When I tried with
> from("file:/camel/inbox?noop=true")
> .filter().method("my-filter", "readyToProcess") // Has the
> logic described in requirement (1)
> .aggregate(simple(ANY_LITERAL),new
> MyAggregator()).completionFromBatchConsumer()
> .beanRef("my-processor", "process")
> .to("file:/camel/outbox?flatten=true");
>
> The program never enters the my-processor bean class and hence the files are
> not generated at all.
>
> When removed the filter logic to the aggregate class it worked cleanly
> from("file:/camel/inbox?noop=true")
> .aggregate(simple(ANY_LITERAL),new
> MyAggregator()).completionFromBatchConsumer()
> .beanRef("my-processor", "process")
> .to("file:/camel/outbox?flatten=true");
>
> Is this an expected behaviour?
>
> -Somnath
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Filter-and-Aggregation-Completion-tp5715604.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: IdempotentRepository

2012-07-06 Thread Sam (Stephen Samuel)
eagerMaxMessagesPerPoll needs to be set to true.

On Fri, Jul 6, 2012 at 10:53 AM, Christian Lipp wrote:

> Do you mean " eagerMaxMessagesPerPoll" ?
> I set it to false, but nothing changed.
>
> In the camel code I could only find
>
> contains in GenericFileConsumer
> Add, remove in GenericFileOnCompletion
>
> Regards, CL
>
> -Ursprüngliche Nachricht-
> Von: Sam (Stephen Samuel) [mailto:samspad...@gmail.com]
> Gesendet: Freitag, 06. Juli 2012 11:17
> An: users@camel.apache.org
> Betreff: Re: IdempotentRepository
>
> "This operation is used if the option eager has been enabled."
>
> Take a look at that, that might be why confirm is not being called.
>
> On Fri, Jul 6, 2012 at 7:17 AM, Christian Lipp  >wrote:
>
> > Hello!
> >
> > I am fetching files from a FTP server (severall GB for the next years).
> > The files are produced daily in directories which correspond to the
> > date, like
> >
> > -   20120501
> > -   20120502
> > -   ...
> >
> > I have only read rights and I am not the only consumer. This means
> > that they keep the last month or so on the server and I fetch on a daily
> base.
> > To avoid that I am fetching files twice I want to use an
> > IdempotentRepository implementation. I don't want to save each file in
> > a database or in a text file because the service will run for years
> > and this is just unnecessary data.
> >
> > What I want to store is the last processed date only. This handles
> > just the directories and would mean that I need some other strategy
> > for the files. I could combine this approach with the default in
> > memory based store. But let just stick to the directories:
> >
> > I read the directory sorted by file name. The IdempotentRepository is
> > called by the FtpConsumer with
> >
> > - start()
> > - contains() for every directory and file
> > - add() for files only
> >
> > and that's it. No stop(), no confirm(). When I have errors, sometimes
> > remove() is called. Since the repository is called only with String
> > (the full path) I have not information if I deal with directories or
> > files. I know it from the structure, but I am not able to implement a
> > generic solution.
> >
> > Anyway the idea is:
> >
> > - Store the LastProcessedDate inside the repository
> > - contains(): if the path contains an already processed date
> > ( > - add(): if add() jumps to the next directory I set the
> > LastProcessedDate to the directory before
> >
> > The only problem is the last processed directory: even if it is
> > finished I do not get the chance to mark it as processed (set
> > LastProcessedDate to its value).
> >
> > So finally my questions: do you think this approach makes sense and if
> > yes: how would you deal with the last processed directory?
> > If no, how would you solve it?
> >
> > Thanks and kind regards, Christian
> >
>
>
>
> --
> -Sam
>



-- 
-Sam


Re: Filter and Aggregation Completion

2012-07-06 Thread Pontus Ullgren
Just figured out that in newer version of Camel you set the predicate
by calling
 from("file:/camel/inbox?noop=true")
  .aggregate().setCompletionPredicate(new Predicate() {...})

Seems like the aggregator page need some TLC .

// Pontus


On Fri, Jul 6, 2012 at 1:04 PM, Pontus Ullgren  wrote:
> Just a quick guess.
>
> Since you are filtering out messages from the batch the aggregator
> will not reach a decision that the batch is completed.
> The completeion from batch will wait for ALL message to arrive.
> See section "Using Batch Consumer" on this page
> http://camel.apache.org/aggregator.html
>
> You should probably use some other means to verify that the batch is
> complete such as a custom PredicateAggregationCollection.
>
>
> // Pontus
>
>
> On Fri, Jul 6, 2012 at 12:06 PM, somnath  wrote:
>> Hi,
>>
>> My requirement is
>> 1) Read a file location and extract only those files that have "End
>> Date=Today's Date" as one of the headers.
>> 2) Combine all of these files and generate a single file out of it.
>>
>> When I tried with
>> from("file:/camel/inbox?noop=true")
>> .filter().method("my-filter", "readyToProcess") // Has the
>> logic described in requirement (1)
>> .aggregate(simple(ANY_LITERAL),new
>> MyAggregator()).completionFromBatchConsumer()
>> .beanRef("my-processor", "process")
>> .to("file:/camel/outbox?flatten=true");
>>
>> The program never enters the my-processor bean class and hence the files are
>> not generated at all.
>>
>> When removed the filter logic to the aggregate class it worked cleanly
>> from("file:/camel/inbox?noop=true")
>> .aggregate(simple(ANY_LITERAL),new
>> MyAggregator()).completionFromBatchConsumer()
>> .beanRef("my-processor", "process")
>> .to("file:/camel/outbox?flatten=true");
>>
>> Is this an expected behaviour?
>>
>> -Somnath
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Filter-and-Aggregation-Completion-tp5715604.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.


AW: IdempotentRepository

2012-07-06 Thread Christian Lipp
My problem is that the number (date) is in the directory, not in the file.
So I only know that I am finished when it moves to a new directory which 
doesn't work at the end.

Regards, Christian

-Ursprüngliche Nachricht-
Von: Marco Westermann [mailto:marwesterm...@gmx.de] 
Gesendet: Freitag, 06. Juli 2012 12:10
An: users@camel.apache.org
Betreff: Re: IdempotentRepository

Hi,

I had a very similar problem. I wrote a little bean which writes the last 
number processed to a file. Another method gives me the last number processed.

regards, Marco

Am 06.07.2012 11:53, schrieb Christian Lipp:
> Do you mean " eagerMaxMessagesPerPoll" ?
> I set it to false, but nothing changed.
>
> In the camel code I could only find
>
> contains in GenericFileConsumer
> Add, remove in GenericFileOnCompletion
>
> Regards, CL
>
> -Ursprüngliche Nachricht-
> Von: Sam (Stephen Samuel) [mailto:samspad...@gmail.com]
> Gesendet: Freitag, 06. Juli 2012 11:17
> An: users@camel.apache.org
> Betreff: Re: IdempotentRepository
>
> "This operation is used if the option eager has been enabled."
>
> Take a look at that, that might be why confirm is not being called.
>
> On Fri, Jul 6, 2012 at 7:17 AM, Christian Lippwrote:
>
>> Hello!
>>
>> I am fetching files from a FTP server (severall GB for the next years).
>> The files are produced daily in directories which correspond to the 
>> date, like
>>
>> -   20120501
>> -   20120502
>> -   ...
>>
>> I have only read rights and I am not the only consumer. This means 
>> that they keep the last month or so on the server and I fetch on a daily 
>> base.
>> To avoid that I am fetching files twice I want to use an 
>> IdempotentRepository implementation. I don't want to save each file 
>> in a database or in a text file because the service will run for 
>> years and this is just unnecessary data.
>>
>> What I want to store is the last processed date only. This handles 
>> just the directories and would mean that I need some other strategy 
>> for the files. I could combine this approach with the default in 
>> memory based store. But let just stick to the directories:
>>
>> I read the directory sorted by file name. The IdempotentRepository is 
>> called by the FtpConsumer with
>>
>> - start()
>> - contains() for every directory and file
>> - add() for files only
>>
>> and that's it. No stop(), no confirm(). When I have errors, sometimes
>> remove() is called. Since the repository is called only with String 
>> (the full path) I have not information if I deal with directories or 
>> files. I know it from the structure, but I am not able to implement a 
>> generic solution.
>>
>> Anyway the idea is:
>>
>> - Store the LastProcessedDate inside the repository
>> - contains(): if the path contains an already processed date
>> (> - add(): if add() jumps to the next directory I set the 
>> LastProcessedDate to the directory before
>>
>> The only problem is the last processed directory: even if it is 
>> finished I do not get the chance to mark it as processed (set 
>> LastProcessedDate to its value).
>>
>> So finally my questions: do you think this approach makes sense and 
>> if
>> yes: how would you deal with the last processed directory?
>> If no, how would you solve it?
>>
>> Thanks and kind regards, Christian
>>
>
>
> --
> -Sam
>



AW: IdempotentRepository

2012-07-06 Thread Christian Lipp
eagerMaxMessagesPerPoll is true by default, so it doesn't change anything to 
set it.
There was no difference for true/false.

Regards, Christian

-Ursprüngliche Nachricht-
Von: Sam (Stephen Samuel) [mailto:samspad...@gmail.com] 
Gesendet: Freitag, 06. Juli 2012 13:13
An: users@camel.apache.org
Betreff: Re: IdempotentRepository

eagerMaxMessagesPerPoll needs to be set to true.

On Fri, Jul 6, 2012 at 10:53 AM, Christian Lipp wrote:

> Do you mean " eagerMaxMessagesPerPoll" ?
> I set it to false, but nothing changed.
>
> In the camel code I could only find
>
> contains in GenericFileConsumer
> Add, remove in GenericFileOnCompletion
>
> Regards, CL
>
> -Ursprüngliche Nachricht-
> Von: Sam (Stephen Samuel) [mailto:samspad...@gmail.com]
> Gesendet: Freitag, 06. Juli 2012 11:17
> An: users@camel.apache.org
> Betreff: Re: IdempotentRepository
>
> "This operation is used if the option eager has been enabled."
>
> Take a look at that, that might be why confirm is not being called.
>
> On Fri, Jul 6, 2012 at 7:17 AM, Christian Lipp  >wrote:
>
> > Hello!
> >
> > I am fetching files from a FTP server (severall GB for the next years).
> > The files are produced daily in directories which correspond to the 
> > date, like
> >
> > -   20120501
> > -   20120502
> > -   ...
> >
> > I have only read rights and I am not the only consumer. This means 
> > that they keep the last month or so on the server and I fetch on a 
> > daily
> base.
> > To avoid that I am fetching files twice I want to use an 
> > IdempotentRepository implementation. I don't want to save each file 
> > in a database or in a text file because the service will run for 
> > years and this is just unnecessary data.
> >
> > What I want to store is the last processed date only. This handles 
> > just the directories and would mean that I need some other strategy 
> > for the files. I could combine this approach with the default in 
> > memory based store. But let just stick to the directories:
> >
> > I read the directory sorted by file name. The IdempotentRepository 
> > is called by the FtpConsumer with
> >
> > - start()
> > - contains() for every directory and file
> > - add() for files only
> >
> > and that's it. No stop(), no confirm(). When I have errors, 
> > sometimes
> > remove() is called. Since the repository is called only with String 
> > (the full path) I have not information if I deal with directories or 
> > files. I know it from the structure, but I am not able to implement 
> > a generic solution.
> >
> > Anyway the idea is:
> >
> > - Store the LastProcessedDate inside the repository
> > - contains(): if the path contains an already processed date
> > ( > - add(): if add() jumps to the next directory I set the 
> > LastProcessedDate to the directory before
> >
> > The only problem is the last processed directory: even if it is 
> > finished I do not get the chance to mark it as processed (set 
> > LastProcessedDate to its value).
> >
> > So finally my questions: do you think this approach makes sense and 
> > if
> > yes: how would you deal with the last processed directory?
> > If no, how would you solve it?
> >
> > Thanks and kind regards, Christian
> >
>
>
>
> --
> -Sam
>



--
-Sam


[file2/ftp2]Source file not deleted after using a combination of file2 component and ftp2 component with templates

2012-07-06 Thread Aida
Hello,

I'm having trouble when working with producerTemplate and consumerTemplate
in the following scenary:

1. I read a file from a local directory with a consumerTemplate. The only
options I'm using are: {fileName, charset, intialDelay, delay}
2. I copy that file to an ftp directory using a producerTemplate.

At the end of the process, the source file (the one that I read from a local
directory) is not deleted. If in the second step I use a file component
instead of an ftp component it works as expected.

When the file is not deleted, I have this trace in the console:
2012-07-06 13:35:40,815 WARN
[org.apache.camel.component.file.GenericFileOnCompletion] - Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException - Error
renaming file from
C:\desarrollo\sources\energy-template\processes\camel\target\testProcessAndDelete\file.txt
to target\testProcessAndDelete\.camel\file.txt]
org.apache.camel.component.file.GenericFileOperationFailedException: Error
renaming file from
C:\desarrollo\sources\energy-template\processes\camel\target\testProcessAndDelete\file.txt
to target\testProcessAndDelete\.camel\file.txt
at
org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
at
org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
at
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
at
org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
at
org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
...
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.io.IOException: Renaming file from:
C:\desarrollo\sources\energy-template\processes\camel\target\testProcessAndDelete\file.txt
to: target\testProcessAndDelete\.camel\file.txt failed due cannot delete
from file:
C:\desarrollo\sources\energy-template\processes\camel\target\testProcessAndDelete\file.txt
after copy succeeded
at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:362)
at
org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
... 94 more



If I set the option delete=true then the beggining of the trace is this one:
2012-07-06 13:34:45,199 WARN
[org.apache.camel.component.file.GenericFileOnCompletion] - Caused by:
[org.apache.camel.component.file.GenericFileOperationFailedException -
Cannot delete file: GenericFile[file.txt]]
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
delete file: GenericFile[file.txt]
at
org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy.commit(GenericFileDeleteProcessStrategy.java:82)
at
org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
at
org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
at
org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
at
org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
...


I attach a simple test that reproduces what is happening to me (the only
thing that the test needs to work is to change the ftp endpoint
configuration apart from editing the package of the class). 

I have been thinking that using a bean that uses the
org.apache.camel.util.FileUtil to explicity delete the file would be an
option, but since camel It's supposed to do that and in the trace I have
seen that camel already uses that library I don´t know which is the better
way to do this.

Thanks in advance.

Attachment: 
http://camel.465427.n5.nabble.com/file/n5715615/FileConsumingTest.java
FileConsumingTest.java 

  Aida.

--
View this message in context: 
http://camel.465427.n5.nabble.com/file2-ftp2-Source-file-not-deleted-after-using-a-combination-of-file2-component-and-ftp2-component-ws-tp5715615.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Filter and Aggregation Completion

2012-07-06 Thread Claus Ibsen
On Fri, Jul 6, 2012 at 1:17 PM, Pontus Ullgren  wrote:
> Just figured out that in newer version of Camel you set the predicate
> by calling
>  from("file:/camel/inbox?noop=true")
>   .aggregate().setCompletionPredicate(new Predicate() {...})
>
> Seems like the aggregator page need some TLC .
>

No, please read the documentation.

On the top of the page
http://camel.apache.org/aggregator.html


> // Pontus
>
>
> On Fri, Jul 6, 2012 at 1:04 PM, Pontus Ullgren  wrote:
>> Just a quick guess.
>>
>> Since you are filtering out messages from the batch the aggregator
>> will not reach a decision that the batch is completed.
>> The completeion from batch will wait for ALL message to arrive.
>> See section "Using Batch Consumer" on this page
>> http://camel.apache.org/aggregator.html
>>
>> You should probably use some other means to verify that the batch is
>> complete such as a custom PredicateAggregationCollection.
>>
>>
>> // Pontus
>>
>>
>> On Fri, Jul 6, 2012 at 12:06 PM, somnath  wrote:
>>> Hi,
>>>
>>> My requirement is
>>> 1) Read a file location and extract only those files that have "End
>>> Date=Today's Date" as one of the headers.
>>> 2) Combine all of these files and generate a single file out of it.
>>>
>>> When I tried with
>>> from("file:/camel/inbox?noop=true")
>>> .filter().method("my-filter", "readyToProcess") // Has the
>>> logic described in requirement (1)
>>> .aggregate(simple(ANY_LITERAL),new
>>> MyAggregator()).completionFromBatchConsumer()
>>> .beanRef("my-processor", "process")
>>> .to("file:/camel/outbox?flatten=true");
>>>
>>> The program never enters the my-processor bean class and hence the files are
>>> not generated at all.
>>>
>>> When removed the filter logic to the aggregate class it worked cleanly
>>> from("file:/camel/inbox?noop=true")
>>> .aggregate(simple(ANY_LITERAL),new
>>> MyAggregator()).completionFromBatchConsumer()
>>> .beanRef("my-processor", "process")
>>> .to("file:/camel/outbox?flatten=true");
>>>
>>> Is this an expected behaviour?
>>>
>>> -Somnath
>>>
>>>
>>> --
>>> View this message in context: 
>>> http://camel.465427.n5.nabble.com/Filter-and-Aggregation-Completion-tp5715604.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.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Assigning File names to exchanges generated from split

2012-07-06 Thread Claus Ibsen
Hi

You can call a bean in the setHeader so the result of the bean is the
header value.


On Fri, Jul 6, 2012 at 11:55 AM, somnath  wrote:
> Hi,
>
> My Camel route looks like below
> from("file:/camel/inbox?noop=true&delay=48")
> .autoStartup(true)
>
> .aggregate(simple(ANY_LITERAL),(OMAggregationStrategy)context.getBean("om-aggregation-strategy")).completionFromBatchConsumer()
> .beanRef("om-processor", "process")
> .split(body()).parallelProcessing()
> *   .setHeader(Exchange.FILE_NAME).simple("${exchangeId}.csv")*
> .to("file:/camel/outbox?flatten=true");
>
> I want to be able to generate more meaningful names to the files rather than
> the one assigned through the setHeader line which basically is the exchange
> ID. The processor can spit out the various components of the name which I
> can assign to a bean in the processor bean. Is there a way I can access this
> bean in the setHeader section?
>
> -Somnath
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Assigning-File-names-to-exchanges-generated-from-split-tp5715603.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.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: [file2/ftp2]Source file not deleted after using a combination of file2 component and ftp2 component with templates

2012-07-06 Thread Claus Ibsen
Hi

When using files on windows, make sure that if you use any custom code
that read the file using a stream ,such af FileInputStream, etc. you
must close the stream.

On windows the file cannot be moved/deleted if that occurs. So double
check your own code first.


On Fri, Jul 6, 2012 at 1:55 PM, Aida  wrote:
> Hello,
>
> I'm having trouble when working with producerTemplate and consumerTemplate
> in the following scenary:
>
> 1. I read a file from a local directory with a consumerTemplate. The only
> options I'm using are: {fileName, charset, intialDelay, delay}
> 2. I copy that file to an ftp directory using a producerTemplate.
>
> At the end of the process, the source file (the one that I read from a local
> directory) is not deleted. If in the second step I use a file component
> instead of an ftp component it works as expected.
>
> When the file is not deleted, I have this trace in the console:
> 2012-07-06 13:35:40,815 WARN
> [org.apache.camel.component.file.GenericFileOnCompletion] - Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException - Error
> renaming file from
> C:\desarrollo\sources\energy-template\processes\camel\target\testProcessAndDelete\file.txt
> to target\testProcessAndDelete\.camel\file.txt]
> org.apache.camel.component.file.GenericFileOperationFailedException: Error
> renaming file from
> C:\desarrollo\sources\energy-template\processes\camel\target\testProcessAndDelete\file.txt
> to target\testProcessAndDelete\.camel\file.txt
> at
> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:72)
> at
> org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.renameFile(GenericFileProcessStrategySupport.java:107)
> at
> org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.commit(GenericFileRenameProcessStrategy.java:86)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
> ...
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: java.io.IOException: Renaming file from:
> C:\desarrollo\sources\energy-template\processes\camel\target\testProcessAndDelete\file.txt
> to: target\testProcessAndDelete\.camel\file.txt failed due cannot delete
> from file:
> C:\desarrollo\sources\energy-template\processes\camel\target\testProcessAndDelete\file.txt
> after copy succeeded
> at org.apache.camel.util.FileUtil.renameFile(FileUtil.java:362)
> at
> org.apache.camel.component.file.FileOperations.renameFile(FileOperations.java:70)
> ... 94 more
>
>
>
> If I set the option delete=true then the beggining of the trace is this one:
> 2012-07-06 13:34:45,199 WARN
> [org.apache.camel.component.file.GenericFileOnCompletion] - Caused by:
> [org.apache.camel.component.file.GenericFileOperationFailedException -
> Cannot delete file: GenericFile[file.txt]]
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> delete file: GenericFile[file.txt]
> at
> org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy.commit(GenericFileDeleteProcessStrategy.java:82)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.processStrategyCommit(GenericFileOnCompletion.java:132)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onCompletion(GenericFileOnCompletion.java:82)
> at
> org.apache.camel.component.file.GenericFileOnCompletion.onComplete(GenericFileOnCompletion.java:53)
> at
> org.apache.camel.util.UnitOfWorkHelper.doneSynchronizations(UnitOfWorkHelper.java:55)
> ...
>
>
> I attach a simple test that reproduces what is happening to me (the only
> thing that the test needs to work is to change the ftp endpoint
> configuration apart from editing the package of the class).
>
> I have been thinking that using a bean that uses the
> org.apache.camel.util.FileUtil to explicity delete the file would be an
> option, but since camel It's supposed to do that and in the trace I have
> seen that camel already uses that library I don´t know which is the better
> way to do this.
>
> Thanks in advance.
>
> Attachment:
> http://camel.465427.n5.nabble.com/file/n5715615/FileConsumingTest.java
> FileConsumingTest.java
>
>   Aida.
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/file2-ftp2-Source-file-not-deleted-after-using-a-combination-of-file2-component-and-ftp2-component-ws-tp5715615.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.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: IdempotentRepository

2012-07-06 Thread Claus Ibsen
Hi

You can use a filter, and then some custom logic (eg a pojo) and
return true|false to accept the file.
Then you dont need the idempotent pattern.

And from Camel 2.10 onwards the filter is now also invoked for
directories. So you can skip traversing down in directories you do not
want to.


On Fri, Jul 6, 2012 at 8:17 AM, Christian Lipp  wrote:
> Hello!
>
> I am fetching files from a FTP server (severall GB for the next years). The 
> files are produced daily in directories which correspond to the date, like
>
> -   20120501
> -   20120502
> -   ...
>
> I have only read rights and I am not the only consumer. This means that they 
> keep the last month or so on the server and I fetch on a daily base. To avoid 
> that I am fetching files twice I want to use an IdempotentRepository 
> implementation. I don't want to save each file in a database or in a text 
> file because the service will run for years and this is just unnecessary data.
>
> What I want to store is the last processed date only. This handles just the 
> directories and would mean that I need some other strategy for the files. I 
> could combine this approach with the default in memory based store. But let 
> just stick to the directories:
>
> I read the directory sorted by file name. The IdempotentRepository is called 
> by the FtpConsumer with
>
> - start()
> - contains() for every directory and file
> - add() for files only
>
> and that's it. No stop(), no confirm(). When I have errors, sometimes 
> remove() is called. Since the repository is called only with String (the full 
> path) I have not information if I deal with directories or files. I know it 
> from the structure, but I am not able to implement a generic solution.
>
> Anyway the idea is:
>
> - Store the LastProcessedDate inside the repository
> - contains(): if the path contains an already processed date 
> ( - add(): if add() jumps to the next directory I set the LastProcessedDate to 
> the directory before
>
> The only problem is the last processed directory: even if it is finished I do 
> not get the chance to mark it as processed (set LastProcessedDate to its 
> value).
>
> So finally my questions: do you think this approach makes sense and if yes: 
> how would you deal with the last processed directory?
> If no, how would you solve it?
>
> Thanks and kind regards, Christian



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


Re: Camel Samba/JCIFS component

2012-07-06 Thread Claus Ibsen
Hi

Thanks for sharing. I added a link to this project from our user
stories page (takes a bit to sync to html pages)
https://cwiki.apache.org/confluence/display/CAMEL/User+Stories

On Fri, Jul 6, 2012 at 11:51 AM, Pontus Ullgren  wrote:
> Hello,
>
> Since Stephen started this week in a spirit of sharing I just wanted
> to announce that a camel samba/jcifs component that a college of mine
> (Martin Samuelsson) created for an integration project has now been
> published on github.
> https://github.com/Redpill-Linpro/camel-smb
>
> Current status is that "it works for us" and it still needs some more
> polishing especially when it comes to javadoc and unit test cases.
>
> Martin mentioned that after asking about such a component he has been
> contacted by others that was interested so by doing this announcement
> I hope to reach as many as possible.
>
> Cheers
> Pontus Ullgren



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


Problems with dynamic seda-routes in 2.10.0

2012-07-06 Thread Hartmut Lang
Hi,

i have a problem with dynamically adding/removing seda-routes with the latest 
camel 2.10.0 release. It works for me with 2.9.2.

My setup:
- i have a dynmicRouter and i add and remove new seda-routes (from seda to 
http) on a specific registration/deregistration event in my system
- the first time the route is created, it works
- after the route is deleted and the same seda-route is created again, it is 
not working. No messages are forwarded via this route

The code i use to remove the route is:
camelContext.stopRoute(routeId, 5, TimeUnit.SECONDS);
camelContext.removeRoute(routeId);
>From the Camel Mbeans i observe one different behaviour between 2.9.2 and 
>2.10.0.
- in 2.9.2 only the SedaConsumer is removed when the route is removed, the 
sedaConsumer-threadpool does still exist. But the new route creates a new 
seda-threadpool
- in 2.10.0 both the SedaConsumer and the seda-Threadpool are removed.

Any hints what is going wrong?

Hartmut


Re: [file2/ftp2]Source file not deleted after using a combination of file2 component and ftp2 component with templates

2012-07-06 Thread Aida
Thanks for your quick response Claus.

I have checked the test I uploaded, it´s true that there is a
FileOutputStream but it has its "close()" method. In addition for
double-checking I removed all references to any *Stream to check that even
then the test fails.

Strangely this only happens when the file I read is copied to an ftp dir, if
I use a file endpoint in this step, the behaviour is the expected.

Thank you.

--
View this message in context: 
http://camel.465427.n5.nabble.com/file2-ftp2-Source-file-not-deleted-after-using-a-combination-of-file2-component-and-ftp2-component-ws-tp5715615p5715627.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Attributes from RouteBuilder as beans in route

2012-07-06 Thread Hilde
Hello!

We use the Java DSL to model Camel Routes.
The RouteBuilder class that we use for this very Route has an attribute and
we would like to use this
attribute as a bean inside the Route.

Here is the code snippet:

public class CreateScriptRoute extends RouteBuilder {
...
private ScriptParams params;

@Override
public void configure() throws Exception {
from("direct:createScriptTransformDBInit")
.routeId("createScriptTransformDBInit")
.bean(params) // that fails!!!
.choice()

...

}

However when I try I get the following error:

Caused by: java.lang.IllegalArgumentException: bean, ref or beanType must be
provided
at
org.apache.camel.model.BeanDefinition.createProcessor(BeanDefinition.java:202)
at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:441)
at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:179)

Is there a way to use the attribute in the bean section of the Route anyway?
I need that instance
because it is injected especially for testing.

Cheers
Hilde

--
View this message in context: 
http://camel.465427.n5.nabble.com/Attributes-from-RouteBuilder-as-beans-in-route-tp5715628.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Attributes from RouteBuilder as beans in route

2012-07-06 Thread Claus Ibsen
Hi

Make sure to set the params attribue before Camel is starting, so its != null

On Fri, Jul 6, 2012 at 4:04 PM, Hilde  wrote:
> Hello!
>
> We use the Java DSL to model Camel Routes.
> The RouteBuilder class that we use for this very Route has an attribute and
> we would like to use this
> attribute as a bean inside the Route.
>
> Here is the code snippet:
>
> public class CreateScriptRoute extends RouteBuilder {
> ...
> private ScriptParams params;
>
> @Override
> public void configure() throws Exception {
> from("direct:createScriptTransformDBInit")
> .routeId("createScriptTransformDBInit")
> .bean(params) // that fails!!!
> .choice()
>
> ...
>
> }
>
> However when I try I get the following error:
>
> Caused by: java.lang.IllegalArgumentException: bean, ref or beanType must be
> provided
> at
> org.apache.camel.model.BeanDefinition.createProcessor(BeanDefinition.java:202)
> at
> org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:441)
> at
> org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:179)
>
> Is there a way to use the attribute in the bean section of the Route anyway?
> I need that instance
> because it is injected especially for testing.
>
> Cheers
> Hilde
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Attributes-from-RouteBuilder-as-beans-in-route-tp5715628.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.com
Author of Camel in Action: http://www.manning.com/ibsen


Aggregator Exchange.MULTICAST_COMPLETE recipientList

2012-07-06 Thread Marco Crivellaro
Hi,
I am currently using a recipientList with parallel processing and streaming
option with a custom aggregator strategy.

Exchange.MULTICAST_COMPLETE property read on aggregation seems to rely on
the recipient list order instead of the order in which they are aggregated.

For instance if in recipient list there are ENDPOINT1,ENDPOINT2,ENDPOINT3

and they complete processing (hits aggregator)in following order
ENDPOINT2,ENDPOINT3,ENDPOINT1

the property Exchange.MULTICAST_COMPLETE on each exchange (newExhange param)
will be populated as
false,true,false same is for Exchange.MULTICAST_INDEX.


Is there a built in way to know which is the last aggregation exchange in
such situation?

--
View this message in context: 
http://camel.465427.n5.nabble.com/Aggregator-Exchange-MULTICAST-COMPLETE-recipientList-tp5715630.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Aggregator Exchange.MULTICAST_COMPLETE recipientList

2012-07-06 Thread Claus Ibsen
On Fri, Jul 6, 2012 at 4:41 PM, Marco Crivellaro  wrote:
> Hi,
> I am currently using a recipientList with parallel processing and streaming
> option with a custom aggregator strategy.
>
> Exchange.MULTICAST_COMPLETE property read on aggregation seems to rely on
> the recipient list order instead of the order in which they are aggregated.
>
> For instance if in recipient list there are ENDPOINT1,ENDPOINT2,ENDPOINT3
>
> and they complete processing (hits aggregator)in following order
> ENDPOINT2,ENDPOINT3,ENDPOINT1
>
> the property Exchange.MULTICAST_COMPLETE on each exchange (newExhange param)
> will be populated as
> false,true,false same is for Exchange.MULTICAST_INDEX.
>
>
> Is there a built in way to know which is the last aggregation exchange in
> such situation?
>

No because you use parallel so the order can be random. You would need
to count the number of times you have aggregated and compare with the
SIZE property. Then you know its the last one.


> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Aggregator-Exchange-MULTICAST-COMPLETE-recipientList-tp5715630.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.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Bean binding @Body and Exchange

2012-07-06 Thread dealbitte
Dear Claus Ibsen,

The issue got resolved. But it is unclear how it got fixed. I did few things
(see below) and I am not sure which one did the trick.

re-built the osgi-bundles that provided services (createXML and printXML)
Executed osgi:refresh (karaf@root> osgi:refresh)
restarted karaf

and I cannot reproduce the exception anymore. May be you have an idea.

thank you for time,
Rakesh





--
View this message in context: 
http://camel.465427.n5.nabble.com/Bean-binding-Body-and-Exchange-tp5715529p5715632.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Choosing DSL Java or Spring

2012-07-06 Thread Sri
Hi All,

Which id DSL is good for project. Java DSL or Spring.  I have used java
earlier how ever want to try Spring DSL in the current project. is there any
disadvantages using Spring DSL.

Regards
Sri

--
View this message in context: 
http://camel.465427.n5.nabble.com/Choosing-DSL-Java-or-Spring-tp5715633.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Choosing DSL Java or Spring

2012-07-06 Thread Sam (Stephen Samuel)
IMO

Pro Spring:

Can edit it "outside" the build, and by non-devs

Pro DSL:

Code completion / type checking
Easier refactoring.

BTW We just switched from spring to dsl.

On Fri, Jul 6, 2012 at 4:31 PM, Sri  wrote:

> Hi All,
>
> Which id DSL is good for project. Java DSL or Spring.  I have used java
> earlier how ever want to try Spring DSL in the current project. is there
> any
> disadvantages using Spring DSL.
>
> Regards
> Sri
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Choosing-DSL-Java-or-Spring-tp5715633.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
-Sam


Re: Choosing DSL Java or Spring

2012-07-06 Thread thomas barker
I much prefer java dsl for maintainability.  Spring DSL is fine for small,
simple routes that will never grow.  As a response to the previous, I am
not sure I would use Camel if maintenance was done by non-devs.

On Fri, Jul 6, 2012 at 11:35 AM, Sam (Stephen Samuel)
wrote:

> IMO
>
> Pro Spring:
>
> Can edit it "outside" the build, and by non-devs
>
> Pro DSL:
>
> Code completion / type checking
> Easier refactoring.
>
> BTW We just switched from spring to dsl.
>
> On Fri, Jul 6, 2012 at 4:31 PM, Sri  wrote:
>
> > Hi All,
> >
> > Which id DSL is good for project. Java DSL or Spring.  I have used java
> > earlier how ever want to try Spring DSL in the current project. is there
> > any
> > disadvantages using Spring DSL.
> >
> > Regards
> > Sri
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Choosing-DSL-Java-or-Spring-tp5715633.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
>
> --
> -Sam
>


how to hide user and password in sftp in for statement

2012-07-06 Thread David Capwell
Hi, I am trying to use camel to get data out of an sftp end point.  At the
moment I have two issues. First, I want to hide the username and password.
 Second I would like to be able to reuse the uri and allow the sftp's
directory to be paramiterized.  Going over the docs online, I don't see a
clear way to do this.  I have found
http://camel.465427.n5.nabble.com/Using-dynamic-parameter-values-in-XML-DSL-Route-td4414073.htmltalk
about using header and recipientList to allows params, but that only
effects the to, is there another way to do this in from (can't use direct
since we won't know the routes till runtime)?

Below is my current XML for this (java code is not using spring):

http://camel.apache.org/schema/spring"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd";>

  


  inbox/${in.header.CamelFileName}



  



thanks for your time reading this email


Dynamic queue name from header property.

2012-07-06 Thread dube
Hello

I need to dynamically route my messages to queues using camel based off a
header property.  I need to do this in a way where I can append the value of
that header to a high level qualifier (HLQ) and have the message routed to
that queue.  Understanding that I need to add some validation logic,  I've
figured out a way to do this, but it seems kind of messy. Can someone tell
me if there is a more direct way of accomplishing what I'm doing below?


Example Camel Route



 activemq:queue:HLQ.${in.header.Q_NAME}



FINAL_DESTINATION



The result I would be expecting is that the producing application sets a JMS
header property Q_NAME.  The route reads that and produces it to a queue
named HLQ..

So if the header Q_NAME = OUTPUT.QUEUE then the message would be produced to
HLQ.OUTPUT.QUEUE

Thanks!

--
View this message in context: 
http://camel.465427.n5.nabble.com/Dynamic-queue-name-from-header-property-tp5715644.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Dynamic queue name from header property.

2012-07-06 Thread boday
you shouldn't need to set/get the extra header value, you can also just do
this...




activemq:queue:HLQ.${in.header.Q_NAME}




dube wrote
> 
> Hello
> 
> I need to dynamically route my messages to queues using camel based off a
> header property.  I need to do this in a way where I can append the value
> of that header to a high level qualifier (HLQ) and have the message routed
> to that queue.  Understanding that I need to add some validation logic, 
> I've figured out a way to do this, but it seems kind of messy. Can someone
> tell me if there is a more direct way of accomplishing what I'm doing
> below?
> 
>   
>   Example Camel Route
>   
>   
>   
> 
> activemq:queue:HLQ.${in.header.Q_NAME}
> 
>   
>   
>   FINAL_DESTINATION
>   
>   
> 
> The result I would be expecting is that the producing application sets a
> JMS header property Q_NAME.  The route reads that and produces it to a
> queue named HLQ..
> 
> So if the header Q_NAME = OUTPUT.QUEUE then the message would be produced
> to HLQ.OUTPUT.QUEUE
> 
> Thanks!
> 


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

--
View this message in context: 
http://camel.465427.n5.nabble.com/Dynamic-queue-name-from-header-property-tp5715644p5715645.html
Sent from the Camel - Users mailing list archive at Nabble.com.