Re: Filtering of mbeans in mbean server of camel

2011-08-30 Thread Sachin
Thanks for the reply. I will try both the options. Hope it works 

--
View this message in context: 
http://camel.465427.n5.nabble.com/Filtering-of-mbeans-in-mbean-server-of-camel-tp4726520p4748940.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Question regarding Using Thread.Sleep()

2011-08-30 Thread shekher.awasthi
Hi All,

While working with Camel things are going find but have a doubt about using
Thread.sleep()
I have the following code
public void executeRoute(String routeName) throws Exception{
  resetStatus();
camelContext.startRoute(routeName);
Thread.sleep(8000); 
}

Now its working fine but when i remove Thread.sleep(8000) it seems that
route is not getting executed,
My problem is i am not sure how much time a route can take for e.g if i am
picking things from local file system sleep time will be different and in
case from FTP/HTTP or any other remote call time calculations will be
entirety different

Is there any way to do it in more efficient manner as currently time i am
using to make thread sleep is purely on my assumptions and not with ant
specific calculative way

Thanks in advance
Umesh

--
View this message in context: 
http://camel.465427.n5.nabble.com/Question-regarding-Using-Thread-Sleep-tp4748986p4748986.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Splitting a collection and writing to files

2011-08-30 Thread Sander Mak
Since you don't specify a unique file name for each output of the
split (for example by setting the org.apache.camel.file.name header to
a unique name) I suppose the output file is overwritten for each
string, ending with the last output?

On Tue, Aug 30, 2011 at 9:30 AM, Jan Strube j...@deriva.de wrote:
 Hello,

 I´m trying to split an ArrayListString and writing each element to it´s
 own file like in this simplified example:



 The log prints each item but only three is saved to a file. Wht am I doing
 wrong?

 Thanks,
 Jan

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Splitting-a-collection-and-writing-to-files-tp4749171p4749171.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Splitting a collection and writing to files

2011-08-30 Thread Jan Strube
Yes, you are right. For example, the following works:


--
View this message in context: 
http://camel.465427.n5.nabble.com/Splitting-a-collection-and-writing-to-files-tp4749171p4749273.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: What are the differences between using preMove and readLock=rename

2011-08-30 Thread bbuzzard
When I first read your response I guess I missed the part about preMove
happens after the readLock has determined it's ok to consume the file.  So
if readLock=none then it might be possible for the preMove to move a file
that was still being written to.  Is that correct?

--
View this message in context: 
http://camel.465427.n5.nabble.com/What-are-the-differences-between-using-preMove-and-readLock-rename-tp4747269p4749777.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: What are the differences between using preMove and readLock=rename

2011-08-30 Thread Claus Ibsen
On Tue, Aug 30, 2011 at 2:03 PM, bbuzzard
billy.buzz...@bnsflogistics.com wrote:
 When I first read your response I guess I missed the part about preMove
 happens after the readLock has determined it's ok to consume the file.  So
 if readLock=none then it might be possible for the preMove to move a file
 that was still being written to.  Is that correct?


Yes.

The readLock also have a timeout option, so you can have Camel wait a
bit trying to obtain the read-lock.

And only of the lock is acquired, Camel will process the file, which
means only at this point in time,
the preMove is being executed.




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/What-are-the-differences-between-using-preMove-and-readLock-rename-tp4747269p4749777.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/


Activemq dynamic endpoint configuration

2011-08-30 Thread kal2420
Hey, 

I am new to camel and curious to know if there is a simpler way of doing
dynamic activemq selector uri.  Here is what I am trying to do:

public class TestRouteBuilder extends SpringRouteBuilder {

   boolean isready = false;
   public void configure() {
 from(timer://foo?period=6000).process(new Processor() {
 if(isready){
 //generate dynamic uri based on current state 
// read from activemq using dynamic selectoruri
   //  If message is read mark ready to false and process 
the 
message
  //  If no more messages to be processed, suspend / pause  
the
route so we don’t keep polling.  Some other route will resume this route if
there are more messages to be processed
}
});
}
}


I understand that dynamic selector uri can be changed through jmx or
endpoint configuration, what I am trying to understand here is : 

1)  Is there a way to check if route is ready to process new message, before
we start reading the message from the activemq? 
2)  If I have to create a custom endpoint, what would be a good endpoint to
extend? 
3)  Can you point me to a good unittest or documentation that would help 
with
dynamic selector uri and with check to see if ready to process new message. 

Thanks in advance for all your help. 

Kal



--
View this message in context: 
http://camel.465427.n5.nabble.com/Activemq-dynamic-endpoint-configuration-tp4749853p4749853.html
Sent from the Camel - Users mailing list archive at Nabble.com.


random sort in FTP pooling

2011-08-30 Thread Sorin Silaghi
Hi all,


  We wrote a read lock strategy that allows us to use multiple
FTP consumers for the same directory. The problem we are facing now is that
when using multiple consumers they all go for the same file in the list. To
solve this we would need FTP consumers to go after a random file from the
directory.

  I wrote a Comparator that returns a random value and I thought
we could use it to sort the file list. I know it's not the most elegant
solution but it works fine with Collections.sort(). The problem is Camel
doesn't seem to use it. It doesn't even pick it up actually.

  My question is what would be the best way to do this (any
other suggestions besides the random comparator) and anybody has any idea
why this wouldn't work?


Sorin.


Re: random sort in FTP pooling

2011-08-30 Thread Claus Ibsen
Hi

Have you seen this unit test which uses a custom comparator
https://svn.apache.org/repos/asf/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java

On Tue, Aug 30, 2011 at 3:25 PM, Sorin Silaghi sorin7...@gmail.com wrote:
 Hi all,


              We wrote a read lock strategy that allows us to use multiple
 FTP consumers for the same directory. The problem we are facing now is that
 when using multiple consumers they all go for the same file in the list. To
 solve this we would need FTP consumers to go after a random file from the
 directory.

              I wrote a Comparator that returns a random value and I thought
 we could use it to sort the file list. I know it's not the most elegant
 solution but it works fine with Collections.sort(). The problem is Camel
 doesn't seem to use it. It doesn't even pick it up actually.

              My question is what would be the best way to do this (any
 other suggestions besides the random comparator) and anybody has any idea
 why this wouldn't work?


 Sorin.




-- 
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: random sort in FTP pooling

2011-08-30 Thread Sorin Silaghi
Hi,


   I did some debugging and I think I figured it out: we also
have maxMessagesPerPoll=1 set on that endpoint. This means that the consumer
generates a list of 1 elements that it then tries to sort.


   We are using maxMessagesPerPoll=1 because we have multiple routes
connected through NMR (it's all deployed in ServiceMix) and we had problems
with the FTP connector. I remember there was also a different (better)
solution but at the time we thought that this works well enough for now. I
guess it's time to revisit the old solution.


thanks,
 Sorin.


ps: should we submit a patch with this read lock strategy? We would love it
if this became part of Camel.

On Tue, Aug 30, 2011 at 4:51 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Have you seen this unit test which uses a custom comparator

 https://svn.apache.org/repos/asf/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FromFtpRemoteFileSorterTest.java

 On Tue, Aug 30, 2011 at 3:25 PM, Sorin Silaghi sorin7...@gmail.com
 wrote:
  Hi all,
 
 
   We wrote a read lock strategy that allows us to use multiple
  FTP consumers for the same directory. The problem we are facing now is
 that
  when using multiple consumers they all go for the same file in the list.
 To
  solve this we would need FTP consumers to go after a random file from the
  directory.
 
   I wrote a Comparator that returns a random value and I
 thought
  we could use it to sort the file list. I know it's not the most elegant
  solution but it works fine with Collections.sort(). The problem is Camel
  doesn't seem to use it. It doesn't even pick it up actually.
 
   My question is what would be the best way to do this (any
  other suggestions besides the random comparator) and anybody has any idea
  why this wouldn't work?
 
 
  Sorin.
 



 --
 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/



Reading multiple files at a time

2011-08-30 Thread jeevan.koteshwara
Hi,
   I am trying read multiple files from a directory at a time within my
camel route.

E.g.

from(src).bean(abc.class).to(dest)

In the above route, source is a directory which would contain 2-3 files in
it. If I run this route, then camel will process one file at a time and will
route it to the destination. But, my requirement needs reading the contents
of all the files at a time (where I need to merge the contents form
different file, with some additional activities on the contents), so that in
my bean class, the camel Exchange object holds contents from all the files
within the source directory.

Is there any options to read the contents of all files at a single shot?

I did some google..but didnt get any clue.

Thanks and Regards,
Jeevan Mithyantha.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Reading-multiple-files-at-a-time-tp4750809p4750809.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Reading multiple files at a time

2011-08-30 Thread Mathieu Lalonde

Hi Jeevan,

It sounds like you need the Aggregator Enterprise Integration Pattern (EIP).
http://camel.apache.org/aggregator.html

Cheers,
Mathieu


 Date: Tue, 30 Aug 2011 09:53:26 -0700
 From: jeevan.koteshw...@gmail.com
 To: users@camel.apache.org
 Subject: Reading multiple files at a time

 Hi,
 I am trying read multiple files from a directory at a time within my
 camel route.

 E.g.

 from(src).bean(abc.class).to(dest)

 In the above route, source is a directory which would contain 2-3 files in
 it. If I run this route, then camel will process one file at a time and will
 route it to the destination. But, my requirement needs reading the contents
 of all the files at a time (where I need to merge the contents form
 different file, with some additional activities on the contents), so that in
 my bean class, the camel Exchange object holds contents from all the files
 within the source directory.

 Is there any options to read the contents of all files at a single shot?

 I did some google..but didnt get any clue.

 Thanks and Regards,
 Jeevan Mithyantha.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Reading-multiple-files-at-a-time-tp4750809p4750809.html
 Sent from the Camel - Users mailing list archive at Nabble.com.
  

custom MDC property

2011-08-30 Thread David Tombs
Hello Camel Folks,

I'd like to add an MDC property to our logs that is generated from a
few JMS headers. (It would provide more immediately useful information
than Exchange ID.) I'm not sure how to add the property, though, since
it's not one of the five  properties supported out-of-the-box[1].

Any suggestions on the best way to do this?

My current idea is to manually add it to the MDC with a processor and
remove it using synchronization callbacks in the UnitOfWork, but I
don't know Camel in enough depth to be confident in that solution. :)

I'd appreciate any thoughts.

Thank in advance,
David

[1] http://camel.apache.org/mdc-logging.html

-- 
Wise men _still_ seek Him.


Re: Any good component tests to start with

2011-08-30 Thread E.Gherardini
Thanks for the reply. I will follow your advices.

--
View this message in context: 
http://camel.465427.n5.nabble.com/Any-good-component-tests-to-start-with-tp4671227p4751574.html
Sent from the Camel - Users mailing list archive at Nabble.com.


autostartup

2011-08-30 Thread Damian Harvey
The docs say that you can set whether to autostart a route based on a boolean, 
string or property

from(activemq:queue:special).autoStartup(startupRoute).to(file://backup);

However it looks like autoStartup() has been removed (or never was in) the 
fluent API for RouteDefinition. What is the recommended way to decide whether 
to autoStart a route based on a property?

My requirement is that we are wanting to replace an existing integration 
platform one route at a time so would like to startup Camel with several routes 
shutdown but be able to change a properties file and have them autoStart.

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: autostartup

2011-08-30 Thread Willem Jiang

Hi

Which version of Camel are you using ?
I just checked the current trunk code (Camel 2.9-SNAPSHOT), and found 
there is an autoStartup() fluent API can be used.



On 8/31/11 8:06 AM, Damian Harvey wrote:

The docs say that you can set whether to autostart a route based on a boolean, 
string or property

from(activemq:queue:special).autoStartup(startupRoute).to(file://backup);

However it looks like autoStartup() has been removed (or never was in) the 
fluent API for RouteDefinition. What is the recommended way to decide whether 
to autoStart a route based on a property?

My requirement is that we are wanting to replace an existing integration 
platform one route at a time so would like to startup Camel with several routes 
shutdown but be able to change a properties file and have them autoStart.

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.




--
Willem
--
FuseSource
Web: http://www.fusesource.com
Blog:http://willemjiang.blogspot.com (English)
 http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang