Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Thanks Christian, I managed to sort out this issue. I'm not sure this is an
optimal way of achieving my objective, but it works.

Having experimented around with a number of options, the following works
for me:

from(file: + autoLoadBaseDir + ?preMove=inprogressmove=.classified)
.routeId(Test-Route)
.loop(fileTypes.length)
.processRef(keFileTypeNameService)
.choice()
.when(header(CamelFileName).contains(header(MyFileType)))
.to(file: + classesBaseDir +
/?autoCreate=truefileName=${header[MyFileType]}/${header[CamelFileName]});

The `keFileTypeNameService` retrieves the `CamelLoopIndex` property from
the exchange. It then uses this to get the file type at that index. It then
just simply set this file type name in the header. The
`keFileTypeNameService` bean is shown below:

@Service( value = keFileTypeNameService )
public class FileTypeNameService implements Processor {

private @Value(${ke.file.types}) String[] fileTypes;

public void process(Exchange exchange) throws Exception {
Integer count = exchange.getProperty(CamelLoopIndex, Integer.class);
String fileType = fileTypes[count];
exchange.getIn().setHeader(MyFileType, fileType);
}




}

I hope this assists someone else.


On Thu, Apr 11, 2013 at 11:18 PM, Christian Mueller 
christian.muel...@gmail.com wrote:

 Try:
 .when(simple(${header[CamelFileName]} contains
 ${header[CamelLoopIndex]}))

 You can find more about the simple language at [1].

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

 Best,
 Christian



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Accessing-CamelLoopIndex-in-route-tp5730719p5730731.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.oke...@gmail.com


Re: Modifying exchange in a Converter?

2013-04-12 Thread Claus Ibsen
Yeah I think its more okay if the types being converted to is a custom
type, eg such as com.foo.mycompany.MyCustomer etc.
And that its documented this happens / so people would know that this
is by design.




On Thu, Apr 11, 2013 at 11:50 AM, sothach phillips@gmail.com wrote:
 Is it considered bad practice to modify the exchange in a converter?
 I feels wrong to me, but sometimes that's the best/only place to say extract
 a business value from an object (e.g., in.body) and make it available to
 other parts of the route (e.g., in.header) that don't need to know the type
 of the body.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Modifying-exchange-in-a-Converter-tp5730710.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Google Drive Component

2013-04-12 Thread Claus Ibsen
Hi Jorge

This sounds great.
I have added a link to the camel-gdrive from the user stories page,
where we link to 3rd party components
http://camel.apache.org/user-stories.html

It takes a bit to sync the update.

And as Christian said, we love contributions, so if the component
becomes stable and you want, then you can consider donating to ASF for
inclusion in the ASF Camel distro.

But happy hacking at githbu, that is a great place to create new components.




On Wed, Apr 10, 2013 at 6:20 PM, Jorge Davison jdavis...@gmail.com wrote:
 Hi All!

 I'm starting the development of Google Drive component to produce and
 consume files to/from a Drive. The current working part is the producer,
 that uploads files to the enpoint. Also, this component doesn't support
 authentication, it only access to the google service via a Access token
 passed.

 Maybe this component can help somebody.

 In the next days i will start the development of the consumer.

 If any one want to fork or improve the code, please be my guest.

 https://github.com/jdavisonc/camel-gdrive

 Jorge Davison
 @jdavisonc



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: JMS Component - Customized messageConverter

2013-04-12 Thread Claus Ibsen
Just add setter methods to your myMessageConverter class, and call the
setter method when you have the runtime information.



On Fri, Apr 12, 2013 at 6:37 AM, AbhishekSamuel
abhisheksamuelr...@gmail.com wrote:
 Hey,

 I understand spring supports it out of the box, but the object information
 is not available at spring initialization time. I have the object
 information at run time and if i cant use the constructor method, at least
 if there is a way of accessing the setter method of myMessageConverter, that
 would help.

 Thanks
 Abhishek




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/JMS-Component-Customized-messageConverter-tp5730725p5730746.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Claus Ibsen
Hi

The code in the configure() method of a RouteBuilder is only executed
once, when Camel startup and build the route from what you defined in
the configure method.

So at runtime you need to use languages
http://camel.apache.org/languages

Or a java bean / camel processor / create your own predicate / etc. to
have this evaluation work.


On Thu, Apr 11, 2013 at 3:17 PM, Okello Nelson cn.oke...@gmail.com wrote:
 Hi guys,

 I have the following route DSL:

 from(file: + autoLoadBaseDir + ?move=.classified)
 .loop(fileTypes.length)
 .choice()

 .when(header(CamelFileName).contains(fileTypes[Integer.valueOf(${CamelLoopIndex})]))
 .to(file: + classesBaseDir + / +
 fileTypes[Integer.valueOf(${CamelLoopIndex})]);

 I'm trying to use the loop index with an array to create a content based
 router. However, the ${CamelLoopIndex} seems like its not being resolved.
 Is there something that I'm doing wrong? Thanks in advance.

 Kind Regards,
 Okello Nelson.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: pollEnrich consumer with selector

2013-04-12 Thread nikagra
Is this an answer to my problem described on  stackoverflow
http://stackoverflow.com/questions/15947523/apache-camel-enrich-message-with-file-content-on-request
  



--
View this message in context: 
http://camel.465427.n5.nabble.com/pollEnrich-consumer-with-selector-tp4939908p5730759.html
Sent from the Camel - Users mailing list archive at Nabble.com.


replace endpoint uri in error handler for testing purposes

2013-04-12 Thread Tomasz Pasierb
Hi,

I'm trying to test a route that has a error handler installed and I cannot find 
a way to replace an enpoint (in the error handler) for which I do not have a 
component in my unit test.

I chose a strategy to test an existing (final) route and modify it (using 
weaving) in the unit test in a way that allows me to test a given 
feature/functionality.


The contents of the route builder's configure method are like the following 
(that's of course just a simplification of my code).

public void configure() throws Exception {
errorHandler(deadLetterChannel(oaq:queue:ERROR));

from(oaq:queue:{{inputQueue}})
.to(xslt:someXslFile.xsl)
.to(oaq:queue:{{outputQueue}}).id(outputQueueId);
}

and my test is as follows:

public void regularForeignTransferToBeWrittenToDB() throws Exception {
camelContext.getRouteDefinition(handleForeignTransfers)
.adviceWith(camelContext, new AdviceWithRouteBuilder() {

  @Override
  public void configure() throws Exception {
  replaceFromWith(direct:start);
  weaveById(outputQueueId).replace().to(mock:queue);
  }
  camelContext.start();

  // producer.sendBodyAndHeaders(input, headers);   send some input

  // make some assertions
}

It works fine if I comment out the invocation of errorHandler method.

I'd rather not have the oaq component - I'd like to replace it on the fly in 
my test method. If I have to I'll install a mock compenent for oaq namespace.

Is there a way to weave changes into the error handler or a way of replacing 
the error handler's enpoint uri before the route is actually created in such a 
scenario?


Regards,
Tom


Strange Error with XSLT transformation

2013-04-12 Thread Jothi
Hi all,

I'm facing a strange error when trying to perform an XSLT transformation on
an XML file which I read from the file system. Here is my route:

   
from(direct:processResponse).to(xslt:com/test/processor/response.xsl).to(direct:processedResponse);

from(direct:processedResponse).to(activemq:{{my.queue}});

   
from(file:C:\\Users\\joe\\Desktop\\resp).tracing().convertBodyTo(String.class).to(direct:processResponse);

When I tried to run this simple route, I see the following stack trace in my
log file:

org.apache.camel.ExpectedBodyTypeException: Could not extract IN message
body as type: interface javax.xml.transform.Source body is: ?xml
version=1.0 encoding=UTF-8 standalone=yes?
response
sourceId176722/sourceTradeId
sourceVersion12345/sourceVersion
successY/success
/response

at
org.apache.camel.builder.xml.XsltBuilder.getSource(XsltBuilder.java:346)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:105)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:102)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:72)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:59)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:116)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at
org.apache.camel.processor.Pipeline.process(Pipeline.java:79)[85:org.apache.camel.camel-core:2.8.0.fuse-01-06]
at

Re: Log in file

2013-04-12 Thread Jean Francois LE BESCONT
Thanks for the answer Christian,

After re-read my question, I think that I am not enough specific and not
explain correctly my point. :)

In my case I scan a directory and would like to produce one log ( logEIP )
 file per file processed.

something like :

from(file://C:/test)
 .log(found ${file:name})
 .process(myprocess1)
 .log(end processed1  ${file:name})
 .process(myprocess2)
 .log(end processed2  ${file:name})
.end();

I have a classical log4j.properties

log4j.rootLogger=INFO, A1
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.File=mylogfile.log
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d{dd/MM/ HH\:mm\:ss,SSS}
%-5p [%t] - %m%n


Adn I would like to do something like :

  props.setProperty(log4j.appender.file.File,camel current file name.log);
  LogManager.resetConfiguration();
  PropertyConfigurator.configure(props);
 }

But with no specific process, is it possible ?

thanks







2013/4/11 Christian Müller christian.muel...@gmail.com

 You can configure it in your logging framework.

 Sent from a mobile device
 Am 11.04.2013 13:12 schrieb jeff jflebesc...@gmail.com:

 Hey !

 I think that it is not possible, but is it possible to send log message :


 from(activemq:orders).to(log:com.mycompany.order?level=DEBUG).to(bean:processOrder);

 in a file ?

 Something like :


 from(activemq:orders).to(log:com.mycompany.order?level=DEBUGfile=log/${file:name}.log
 ).to(bean:processOrder);



 Thanks !



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



How to implement concurrent route processing

2013-04-12 Thread Okello Nelson
Hi Guys,

I'm currently working on a project in which I have several routes. To
improve throughput, I'd like to have all the routes executing concurrently.
What I've observed so far is that when one route is executing, the others
do not.

Each route is composed of File, JMS, and JPA endpoints, with possible
additional endpoints later.

Any ideas on how I can implement this will be appreciated very much.

Kind Regards,
Okello Nelson.


Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

2013-04-12 Thread praveenbillampati
Any ideas..?



--
View this message in context: 
http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730768.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: org.apache.cxf.binding.corba.CorbaBindingException: Unable to activate CORBA servant

2013-04-12 Thread ab




--
View this message in context: 
http://camel.465427.n5.nabble.com/org-apache-cxf-binding-corba-CorbaBindingException-Unable-to-activate-CORBA-servant-tp5730665p5730769.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Hi Claus,

Thanks a lot for the insight. My objective was to create a content based
router using information stored in an external file. I inject the
information into an array field using Spring, and so far the route appears
to be working.

But your explanation does give me something to think about, and I guess I
have to test my code further. I'll do so and post back my findings.

Once again, thanks.

Kind Regards,
Okello Nelson.


On Fri, Apr 12, 2013 at 11:28 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 The code in the configure() method of a RouteBuilder is only executed
 once, when Camel startup and build the route from what you defined in
 the configure method.

 So at runtime you need to use languages
 http://camel.apache.org/languages

 Or a java bean / camel processor / create your own predicate / etc. to
 have this evaluation work.


 On Thu, Apr 11, 2013 at 3:17 PM, Okello Nelson cn.oke...@gmail.com
 wrote:
  Hi guys,
 
  I have the following route DSL:
 
  from(file: + autoLoadBaseDir + ?move=.classified)
  .loop(fileTypes.length)
  .choice()
 
 
 .when(header(CamelFileName).contains(fileTypes[Integer.valueOf(${CamelLoopIndex})]))
  .to(file: + classesBaseDir + / +
  fileTypes[Integer.valueOf(${CamelLoopIndex})]);
 
  I'm trying to use the loop index with an array to create a content based
  router. However, the ${CamelLoopIndex} seems like its not being
 resolved.
  Is there something that I'm doing wrong? Thanks in advance.
 
  Kind Regards,
  Okello Nelson.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen




-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.oke...@gmail.com


Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Hi Claus,

Going through you comment again, I notice you've mentioned that the
configure() method of the RouteBuilder is only executed once; when the
route is started.

In my code, I'm executed this method once. The only method I'm calling
repeatedly (for the length of the fileTypes array) is the process()
method of the keFileTypeNameService bean, which I assume is still safe.

Additional insight will be appreciated very much.

Kind Regards,
Okello Nelson.


On Fri, Apr 12, 2013 at 4:52 PM, Okello Nelson cn.oke...@gmail.com wrote:

 Hi Claus,

 Thanks a lot for the insight. My objective was to create a content based
 router using information stored in an external file. I inject the
 information into an array field using Spring, and so far the route appears
 to be working.

 But your explanation does give me something to think about, and I guess I
 have to test my code further. I'll do so and post back my findings.

 Once again, thanks.

 Kind Regards,
 Okello Nelson.


 On Fri, Apr 12, 2013 at 11:28 AM, Claus Ibsen claus.ib...@gmail.comwrote:

 Hi

 The code in the configure() method of a RouteBuilder is only executed
 once, when Camel startup and build the route from what you defined in
 the configure method.

 So at runtime you need to use languages
 http://camel.apache.org/languages

 Or a java bean / camel processor / create your own predicate / etc. to
 have this evaluation work.


 On Thu, Apr 11, 2013 at 3:17 PM, Okello Nelson cn.oke...@gmail.com
 wrote:
  Hi guys,
 
  I have the following route DSL:
 
  from(file: + autoLoadBaseDir + ?move=.classified)
  .loop(fileTypes.length)
  .choice()
 
 
 .when(header(CamelFileName).contains(fileTypes[Integer.valueOf(${CamelLoopIndex})]))
  .to(file: + classesBaseDir + / +
  fileTypes[Integer.valueOf(${CamelLoopIndex})]);
 
  I'm trying to use the loop index with an array to create a content based
  router. However, the ${CamelLoopIndex} seems like its not being
 resolved.
  Is there something that I'm doing wrong? Thanks in advance.
 
  Kind Regards,
  Okello Nelson.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen




 --
 Kind Regards,
 Okello Nelson
 +254 722 137 826
 cn.oke...@gmail.com




-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.oke...@gmail.com


Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Claus Ibsen
Hi

Do you mean its the loop that calls the process X times. If so yeah,
that is working correctly as designed.

Calling the process() method of a org.apache.camel.Processor is
actually what the Camel routing engine does at runtime. In fact each
of these EIPs you may use in the routes, are implemented as a Camel
Processor.



On Fri, Apr 12, 2013 at 3:57 PM, Okello Nelson cn.oke...@gmail.com wrote:
 Hi Claus,

 Going through you comment again, I notice you've mentioned that the
 configure() method of the RouteBuilder is only executed once; when the
 route is started.

 In my code, I'm executed this method once. The only method I'm calling
 repeatedly (for the length of the fileTypes array) is the process()
 method of the keFileTypeNameService bean, which I assume is still safe.

 Additional insight will be appreciated very much.

 Kind Regards,
 Okello Nelson.


 On Fri, Apr 12, 2013 at 4:52 PM, Okello Nelson cn.oke...@gmail.com wrote:

 Hi Claus,

 Thanks a lot for the insight. My objective was to create a content based
 router using information stored in an external file. I inject the
 information into an array field using Spring, and so far the route appears
 to be working.

 But your explanation does give me something to think about, and I guess I
 have to test my code further. I'll do so and post back my findings.

 Once again, thanks.

 Kind Regards,
 Okello Nelson.


 On Fri, Apr 12, 2013 at 11:28 AM, Claus Ibsen claus.ib...@gmail.comwrote:

 Hi

 The code in the configure() method of a RouteBuilder is only executed
 once, when Camel startup and build the route from what you defined in
 the configure method.

 So at runtime you need to use languages
 http://camel.apache.org/languages

 Or a java bean / camel processor / create your own predicate / etc. to
 have this evaluation work.


 On Thu, Apr 11, 2013 at 3:17 PM, Okello Nelson cn.oke...@gmail.com
 wrote:
  Hi guys,
 
  I have the following route DSL:
 
  from(file: + autoLoadBaseDir + ?move=.classified)
  .loop(fileTypes.length)
  .choice()
 
 
 .when(header(CamelFileName).contains(fileTypes[Integer.valueOf(${CamelLoopIndex})]))
  .to(file: + classesBaseDir + / +
  fileTypes[Integer.valueOf(${CamelLoopIndex})]);
 
  I'm trying to use the loop index with an array to create a content based
  router. However, the ${CamelLoopIndex} seems like its not being
 resolved.
  Is there something that I'm doing wrong? Thanks in advance.
 
  Kind Regards,
  Okello Nelson.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen




 --
 Kind Regards,
 Okello Nelson
 +254 722 137 826
 cn.oke...@gmail.com




 --
 Kind Regards,
 Okello Nelson
 +254 722 137 826
 cn.oke...@gmail.com



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Hi Claus,

Yes, it's the loop calling the process X times. I implemented it that but I
wasn't sure its the best way to do it. Thanks a lot.

Kind Regards,
Okello Nelson.


On Fri, Apr 12, 2013 at 5:26 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Do you mean its the loop that calls the process X times. If so yeah,
 that is working correctly as designed.

 Calling the process() method of a org.apache.camel.Processor is
 actually what the Camel routing engine does at runtime. In fact each
 of these EIPs you may use in the routes, are implemented as a Camel
 Processor.



 On Fri, Apr 12, 2013 at 3:57 PM, Okello Nelson cn.oke...@gmail.com
 wrote:
  Hi Claus,
 
  Going through you comment again, I notice you've mentioned that the
  configure() method of the RouteBuilder is only executed once; when
 the
  route is started.
 
  In my code, I'm executed this method once. The only method I'm calling
  repeatedly (for the length of the fileTypes array) is the process()
  method of the keFileTypeNameService bean, which I assume is still safe.
 
  Additional insight will be appreciated very much.
 
  Kind Regards,
  Okello Nelson.
 
 
  On Fri, Apr 12, 2013 at 4:52 PM, Okello Nelson cn.oke...@gmail.com
 wrote:
 
  Hi Claus,
 
  Thanks a lot for the insight. My objective was to create a content based
  router using information stored in an external file. I inject the
  information into an array field using Spring, and so far the route
 appears
  to be working.
 
  But your explanation does give me something to think about, and I guess
 I
  have to test my code further. I'll do so and post back my findings.
 
  Once again, thanks.
 
  Kind Regards,
  Okello Nelson.
 
 
  On Fri, Apr 12, 2013 at 11:28 AM, Claus Ibsen claus.ib...@gmail.com
 wrote:
 
  Hi
 
  The code in the configure() method of a RouteBuilder is only executed
  once, when Camel startup and build the route from what you defined in
  the configure method.
 
  So at runtime you need to use languages
  http://camel.apache.org/languages
 
  Or a java bean / camel processor / create your own predicate / etc. to
  have this evaluation work.
 
 
  On Thu, Apr 11, 2013 at 3:17 PM, Okello Nelson cn.oke...@gmail.com
  wrote:
   Hi guys,
  
   I have the following route DSL:
  
   from(file: + autoLoadBaseDir + ?move=.classified)
   .loop(fileTypes.length)
   .choice()
  
  
 
 .when(header(CamelFileName).contains(fileTypes[Integer.valueOf(${CamelLoopIndex})]))
   .to(file: + classesBaseDir + / +
   fileTypes[Integer.valueOf(${CamelLoopIndex})]);
  
   I'm trying to use the loop index with an array to create a content
 based
   router. However, the ${CamelLoopIndex} seems like its not being
  resolved.
   Is there something that I'm doing wrong? Thanks in advance.
  
   Kind Regards,
   Okello Nelson.
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  FuseSource is now part of Red Hat
  Email: cib...@redhat.com
  Web: http://fusesource.com
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
 
 
 
 
  --
  Kind Regards,
  Okello Nelson
  +254 722 137 826
  cn.oke...@gmail.com
 
 
 
 
  --
  Kind Regards,
  Okello Nelson
  +254 722 137 826
  cn.oke...@gmail.com



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen




-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.oke...@gmail.com


Re: Issue with Handling SoapFault

2013-04-12 Thread shyenuganti
Hi Willem,

I am using a CXF end point in POJO mode. Here is my endpoint definition : 

public static final String POLICY_WEBSERVICE_CALL = 
cxf:bean:policyClient?defaultOperationName=getAccountInformation;

This is not a producer template call. Does camel encapsulate a soapFault
from CXF end point into a CamelExecutionException?

So, the global exception handler intercepts all the endpoints. Will this
exception handler be fired first before the inroute soapFault exception
handler that I have in my route?





--
View this message in context: 
http://camel.465427.n5.nabble.com/Issue-with-Handling-SoapFault-tp5730718p5730774.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Claus Ibsen
Hi

Well use the loop in the route if its sort make sense to have it
there, as it kinda stand out in the route, so people seeing the route,
can see its looping.

Though if its not important, you can just do a for loop in the java
code in the processor.



On Fri, Apr 12, 2013 at 4:30 PM, Okello Nelson cn.oke...@gmail.com wrote:
 Hi Claus,

 Yes, it's the loop calling the process X times. I implemented it that but I
 wasn't sure its the best way to do it. Thanks a lot.

 Kind Regards,
 Okello Nelson.


 On Fri, Apr 12, 2013 at 5:26 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Do you mean its the loop that calls the process X times. If so yeah,
 that is working correctly as designed.

 Calling the process() method of a org.apache.camel.Processor is
 actually what the Camel routing engine does at runtime. In fact each
 of these EIPs you may use in the routes, are implemented as a Camel
 Processor.



 On Fri, Apr 12, 2013 at 3:57 PM, Okello Nelson cn.oke...@gmail.com
 wrote:
  Hi Claus,
 
  Going through you comment again, I notice you've mentioned that the
  configure() method of the RouteBuilder is only executed once; when
 the
  route is started.
 
  In my code, I'm executed this method once. The only method I'm calling
  repeatedly (for the length of the fileTypes array) is the process()
  method of the keFileTypeNameService bean, which I assume is still safe.
 
  Additional insight will be appreciated very much.
 
  Kind Regards,
  Okello Nelson.
 
 
  On Fri, Apr 12, 2013 at 4:52 PM, Okello Nelson cn.oke...@gmail.com
 wrote:
 
  Hi Claus,
 
  Thanks a lot for the insight. My objective was to create a content based
  router using information stored in an external file. I inject the
  information into an array field using Spring, and so far the route
 appears
  to be working.
 
  But your explanation does give me something to think about, and I guess
 I
  have to test my code further. I'll do so and post back my findings.
 
  Once again, thanks.
 
  Kind Regards,
  Okello Nelson.
 
 
  On Fri, Apr 12, 2013 at 11:28 AM, Claus Ibsen claus.ib...@gmail.com
 wrote:
 
  Hi
 
  The code in the configure() method of a RouteBuilder is only executed
  once, when Camel startup and build the route from what you defined in
  the configure method.
 
  So at runtime you need to use languages
  http://camel.apache.org/languages
 
  Or a java bean / camel processor / create your own predicate / etc. to
  have this evaluation work.
 
 
  On Thu, Apr 11, 2013 at 3:17 PM, Okello Nelson cn.oke...@gmail.com
  wrote:
   Hi guys,
  
   I have the following route DSL:
  
   from(file: + autoLoadBaseDir + ?move=.classified)
   .loop(fileTypes.length)
   .choice()
  
  
 
 .when(header(CamelFileName).contains(fileTypes[Integer.valueOf(${CamelLoopIndex})]))
   .to(file: + classesBaseDir + / +
   fileTypes[Integer.valueOf(${CamelLoopIndex})]);
  
   I'm trying to use the loop index with an array to create a content
 based
   router. However, the ${CamelLoopIndex} seems like its not being
  resolved.
   Is there something that I'm doing wrong? Thanks in advance.
  
   Kind Regards,
   Okello Nelson.
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  FuseSource is now part of Red Hat
  Email: cib...@redhat.com
  Web: http://fusesource.com
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
 
 
 
 
  --
  Kind Regards,
  Okello Nelson
  +254 722 137 826
  cn.oke...@gmail.com
 
 
 
 
  --
  Kind Regards,
  Okello Nelson
  +254 722 137 826
  cn.oke...@gmail.com



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen




 --
 Kind Regards,
 Okello Nelson
 +254 722 137 826
 cn.oke...@gmail.com



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Accessing CamelLoopIndex in route

2013-04-12 Thread Okello Nelson
Hi Claus,

I use the loop to retrieve the destinations for the content based router.
The destinations are less than 10 but there's no way of telling in advance
which ones they will be.

So, I thought using a loop to dynamically build the destination makes more
sense. I tried dynamic routes, and other options but they couldn't fit my
usecase.

Kind Regards,
Okello Nelson.


On Fri, Apr 12, 2013 at 5:34 PM, Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Well use the loop in the route if its sort make sense to have it
 there, as it kinda stand out in the route, so people seeing the route,
 can see its looping.

 Though if its not important, you can just do a for loop in the java
 code in the processor.



 On Fri, Apr 12, 2013 at 4:30 PM, Okello Nelson cn.oke...@gmail.com
 wrote:
  Hi Claus,
 
  Yes, it's the loop calling the process X times. I implemented it that
 but I
  wasn't sure its the best way to do it. Thanks a lot.
 
  Kind Regards,
  Okello Nelson.
 
 
  On Fri, Apr 12, 2013 at 5:26 PM, Claus Ibsen claus.ib...@gmail.com
 wrote:
 
  Hi
 
  Do you mean its the loop that calls the process X times. If so yeah,
  that is working correctly as designed.
 
  Calling the process() method of a org.apache.camel.Processor is
  actually what the Camel routing engine does at runtime. In fact each
  of these EIPs you may use in the routes, are implemented as a Camel
  Processor.
 
 
 
  On Fri, Apr 12, 2013 at 3:57 PM, Okello Nelson cn.oke...@gmail.com
  wrote:
   Hi Claus,
  
   Going through you comment again, I notice you've mentioned that the
   configure() method of the RouteBuilder is only executed once; when
  the
   route is started.
  
   In my code, I'm executed this method once. The only method I'm calling
   repeatedly (for the length of the fileTypes array) is the
 process()
   method of the keFileTypeNameService bean, which I assume is still
 safe.
  
   Additional insight will be appreciated very much.
  
   Kind Regards,
   Okello Nelson.
  
  
   On Fri, Apr 12, 2013 at 4:52 PM, Okello Nelson cn.oke...@gmail.com
  wrote:
  
   Hi Claus,
  
   Thanks a lot for the insight. My objective was to create a content
 based
   router using information stored in an external file. I inject the
   information into an array field using Spring, and so far the route
  appears
   to be working.
  
   But your explanation does give me something to think about, and I
 guess
  I
   have to test my code further. I'll do so and post back my findings.
  
   Once again, thanks.
  
   Kind Regards,
   Okello Nelson.
  
  
   On Fri, Apr 12, 2013 at 11:28 AM, Claus Ibsen claus.ib...@gmail.com
  wrote:
  
   Hi
  
   The code in the configure() method of a RouteBuilder is only
 executed
   once, when Camel startup and build the route from what you defined
 in
   the configure method.
  
   So at runtime you need to use languages
   http://camel.apache.org/languages
  
   Or a java bean / camel processor / create your own predicate / etc.
 to
   have this evaluation work.
  
  
   On Thu, Apr 11, 2013 at 3:17 PM, Okello Nelson cn.oke...@gmail.com
 
   wrote:
Hi guys,
   
I have the following route DSL:
   
from(file: + autoLoadBaseDir + ?move=.classified)
.loop(fileTypes.length)
.choice()
   
   
  
 
 .when(header(CamelFileName).contains(fileTypes[Integer.valueOf(${CamelLoopIndex})]))
.to(file: + classesBaseDir + / +
fileTypes[Integer.valueOf(${CamelLoopIndex})]);
   
I'm trying to use the loop index with an array to create a content
  based
router. However, the ${CamelLoopIndex} seems like its not being
   resolved.
Is there something that I'm doing wrong? Thanks in advance.
   
Kind Regards,
Okello Nelson.
  
  
  
   --
   Claus Ibsen
   -
   Red Hat, Inc.
   FuseSource is now part of Red Hat
   Email: cib...@redhat.com
   Web: http://fusesource.com
   Twitter: davsclaus
   Blog: http://davsclaus.com
   Author of Camel in Action: http://www.manning.com/ibsen
  
  
  
  
   --
   Kind Regards,
   Okello Nelson
   +254 722 137 826
   cn.oke...@gmail.com
  
  
  
  
   --
   Kind Regards,
   Okello Nelson
   +254 722 137 826
   cn.oke...@gmail.com
 
 
 
  --
  Claus Ibsen
  -
  Red Hat, Inc.
  FuseSource is now part of Red Hat
  Email: cib...@redhat.com
  Web: http://fusesource.com
  Twitter: davsclaus
  Blog: http://davsclaus.com
  Author of Camel in Action: http://www.manning.com/ibsen
 
 
 
 
  --
  Kind Regards,
  Okello Nelson
  +254 722 137 826
  cn.oke...@gmail.com



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen




-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.oke...@gmail.com


No features available in Service Mix(Camel)

2013-04-12 Thread bru1900
I am not able to install any features on the karaf console.

When i do a a  features:list. I get the error No features available.

Attaching a screen shot of the error !

I am trying to access the admin console, and want to install that feature.
Any help is highly appreciated !

Thank you!
http://camel.465427.n5.nabble.com/file/n5730777/servicemix_error.png 



--
View this message in context: 
http://camel.465427.n5.nabble.com/No-features-available-in-Service-Mix-Camel-tp5730777.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Is there a way to programmatically get the the downstream endpoint from a custom Processor?

2013-04-12 Thread Chris Wolf
The reason I asked is because now I have to set default Endpoint or URI in
the producer template - it would be nice if the default setting would be
the next down-stream endpoint.


On Thu, Apr 11, 2013 at 8:53 PM, Willem jiang willem.ji...@gmail.comwrote:

 ProducerTemplate can send the exchange to any other endpoints.
 Processor is decoupled with the camel route, I don't think you can get the
 downstream endpoint from the custom Processor itself.


 --
 Willem Jiang

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Web: http://www.fusesource.com | http://www.redhat.com
 Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
 (English)
   http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
 Twitter: willemjiang
 Weibo: 姜宁willem





 On Friday, April 12, 2013 at 8:08 AM, Chris Wolf wrote:

  Hello,
 
  I'm implementing a custom Processor - it will have a ProducerTemplate,
  which will always
  send to the next Endpoint, downstream - why do I have to set the
  defaultEndpoint
  or defaultEndpointURI? That guarantees hardcoding. Isn't there someway to
  indicate,
  upon CamelContext.createProducerTemplate() to imply next downstream
  Endpoint?
 
  It's not a show-stopper, I can explicitly configure the Producer
  defaultEndpoint, but I don't
  know why it can't default to the next down-stream consuming endpoint...
 
  Thanks,
 
  Chris





Re: Is there a standard, DSL way to put message body in registry?

2013-04-12 Thread Chris Wolf
Right - ok, that sounds good.  I forgot that a property value can be an
object not just a String.


On Thu, Apr 11, 2013 at 9:46 PM, Willem jiang willem.ji...@gmail.comwrote:

 If you put a object into the exchange properties, you can lookup it later
 in other processor.


 --
 Willem Jiang

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Web: http://www.fusesource.com | http://www.redhat.com
 Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
 (English)
   http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
 Twitter: willemjiang
 Weibo: 姜宁willem





 On Thursday, April 11, 2013 at 10:41 PM, Chris Wolf wrote:

  I know I could implement a custom Processor, but I was wondering if there
  was a Java and Spring DSL way to put objects in the registry and lookup
  them up later.
 
  Thanks,
 
 
  Chris





Re: Strange Error with XSLT transformation

2013-04-12 Thread Raul Kripalani
On Fri, Apr 12, 2013 at 12:17 PM, Jothi codeintheo...@gmail.com wrote:

 ?xml
 version=1.0 encoding=UTF-8 standalone=yes?
 response
 sourceId176722/sourceTradeId
 sourceVersion12345/sourceVersion
 successY/success
 /response


Your XML is badly formed. Notice the opening and closing tags of the
sourceId element.

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk


I'm confused about FTP option localWorkDirectory

2013-04-12 Thread Chris Wolf
I read the documentation:
http://camel.apache.org/ftp.html

and want to FTP large files, as such, I don't want the entire file
loaded into memory - I thought the localWorkDirectory option would
allow this.  That web page says,
It will download the remote file directly to a local file stream. The
java.io.File handle is then used as the Exchange body.

Well, that's not what I'm seeing - what I see is that the body is of type

, BodyType:org.apache.camel.component.file.remote.RemoteFile
, Body:[Body is file based: RemoteFile[giant_dataset.csv]]

...but I expected it to be of type java.io.File, like the local
file:// component and like the ftp documentation says.

When stepping through the code, I see that the file *is* being
downloaded to the work dir.
If I look at the various fields of RemoteFile in the debugger, I don't
see anything indicating a file path which includes the local work
directory.

So how, exactly, does the localWorkDirectory mechanism work and is it
true that it won't load the whole file into memory?  Why isn't the
exchange body of type java.io.File or java.io.InputStream? - I'm
confused - please help...

-Chris


Re: Log in file

2013-04-12 Thread Raul Kripalani
Hi Jean Francois,

What you need is exactly the SiftAppender, which will log to a different
file depending on some dynamic parameter in the Mapped Diagnostic Context
(MDC).

Use this appender from log4j: org.apache.log4j.sift.MDCSiftingAppender.

In the Camel route, write a custom processor that sets an MDC parameter
named camel.filename with the CamelFileName header as the value.

In your log4j configuration, you can then configure your MDCSiftingAppender
like this:

   log4j.appender.sift.appender.file=log/$\\{camel.filename\\}.log

Here's a blog post showing how SMX achieves per-bundle logging [1], which
can serve as a reference.

Remember that the MDC context is attached to a thread, so when the thread
is reused by the Camel File endpont, it'll still have the old MDC context.
I suggest you do some housekeeping and clean up the MDC property after the
last log output in the route (by inserting another Processor straight
after, or using an AsyncCallback like in
org.apache.camel.impl.MDCUnitOfWork).

Hope this helps.

[1]
http://jason-sherman.blogspot.com.es/2012/06/serivcemix-configuring-sift-appender.html
.

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Fri, Apr 12, 2013 at 1:23 PM, Jean Francois LE BESCONT 
jflebesc...@gmail.com wrote:

 Thanks for the answer Christian,

 After re-read my question, I think that I am not enough specific and not
 explain correctly my point. :)

 In my case I scan a directory and would like to produce one log ( logEIP )
  file per file processed.

 something like :

 from(file://C:/test)
  .log(found ${file:name})
  .process(myprocess1)
  .log(end processed1  ${file:name})
  .process(myprocess2)
  .log(end processed2  ${file:name})
 .end();

 I have a classical log4j.properties

 log4j.rootLogger=INFO, A1
 log4j.appender.A1=org.apache.log4j.FileAppender
 log4j.appender.A1.File=mylogfile.log
 log4j.appender.A1.layout=org.apache.log4j.PatternLayout
 log4j.appender.A1.layout.ConversionPattern=%d{dd/MM/ HH\:mm\:ss,SSS}
 %-5p [%t] - %m%n


 Adn I would like to do something like :

   props.setProperty(log4j.appender.file.File,camel current file
 name.log);
   LogManager.resetConfiguration();
   PropertyConfigurator.configure(props);
  }

 But with no specific process, is it possible ?

 thanks







 2013/4/11 Christian Müller christian.muel...@gmail.com

  You can configure it in your logging framework.
 
  Sent from a mobile device
  Am 11.04.2013 13:12 schrieb jeff jflebesc...@gmail.com:
 
  Hey !
 
  I think that it is not possible, but is it possible to send log message :
 
 
 
 from(activemq:orders).to(log:com.mycompany.order?level=DEBUG).to(bean:processOrder);
 
  in a file ?
 
  Something like :
 
 
 
 from(activemq:orders).to(log:com.mycompany.order?level=DEBUGfile=log/${file:name}.log
  ).to(bean:processOrder);
 
 
 
  Thanks !
 
 
 
  --
  View this message in context:
  http://camel.465427.n5.nabble.com/Log-in-file-tp5730713.html
  Sent from the Camel - Users mailing list archive at Nabble.com.
 



Re: Is there a way to programmatically get the the downstream endpoint from a custom Processor?

2013-04-12 Thread Raul Kripalani
One solution is to parametrize the downstream endpoint in the Registry.

from(...).process(new MyProcessor()).to(myDownstreamEndpoint);

where myDownstreamEndpoint is a bean property of type String that gets
injected via Spring or Blueprint during the route initialization.

It should always have the same bean name in all contexts, e.g.
(myDownstreamEndpoint), so then from MyProcessor you can do the following
lookup:

String uri = exchange.getRegistry().lookup(myDownstreamEndpoint,
String.class);

The condition is, of course, that all Camel Contexts using this processor
must have this property in their Application/Blueprint Contexts.

Hope that helps,

*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk

On Fri, Apr 12, 2013 at 4:36 PM, Chris Wolf cwolf.a...@gmail.com wrote:

 The reason I asked is because now I have to set default Endpoint or URI in
 the producer template - it would be nice if the default setting would be
 the next down-stream endpoint.


 On Thu, Apr 11, 2013 at 8:53 PM, Willem jiang willem.ji...@gmail.com
 wrote:

  ProducerTemplate can send the exchange to any other endpoints.
  Processor is decoupled with the camel route, I don't think you can get
 the
  downstream endpoint from the custom Processor itself.
 
 
  --
  Willem Jiang
 
  Red Hat, Inc.
  FuseSource is now part of Red Hat
  Web: http://www.fusesource.com | http://www.redhat.com
  Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
  (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
  Twitter: willemjiang
  Weibo: 姜宁willem
 
 
 
 
 
  On Friday, April 12, 2013 at 8:08 AM, Chris Wolf wrote:
 
   Hello,
  
   I'm implementing a custom Processor - it will have a ProducerTemplate,
   which will always
   send to the next Endpoint, downstream - why do I have to set the
   defaultEndpoint
   or defaultEndpointURI? That guarantees hardcoding. Isn't there someway
 to
   indicate,
   upon CamelContext.createProducerTemplate() to imply next downstream
   Endpoint?
  
   It's not a show-stopper, I can explicitly configure the Producer
   defaultEndpoint, but I don't
   know why it can't default to the next down-stream consuming endpoint...
  
   Thanks,
  
   Chris
 
 
 



Re: Is there a way to programmatically get the the downstream endpoint from a custom Processor?

2013-04-12 Thread Chris Wolf
I can see how that would work, but if I'm going to register the
down-stream endpoint,
I may as well just set the ProducerTemplate, but it's an interesting idea..

On Fri, Apr 12, 2013 at 12:35 PM, Raul Kripalani r...@evosent.com wrote:
 One solution is to parametrize the downstream endpoint in the Registry.

 from(...).process(new MyProcessor()).to(myDownstreamEndpoint);

 where myDownstreamEndpoint is a bean property of type String that gets
 injected via Spring or Blueprint during the route initialization.

 It should always have the same bean name in all contexts, e.g.
 (myDownstreamEndpoint), so then from MyProcessor you can do the following
 lookup:

 String uri = exchange.getRegistry().lookup(myDownstreamEndpoint,
 String.class);

 The condition is, of course, that all Camel Contexts using this processor
 must have this property in their Application/Blueprint Contexts.

 Hope that helps,

 *Raúl Kripalani*
 Enterprise Architect, Open Source Integration specialist, Program
 Manager | Apache
 Camel Committer
 http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
 http://blog.raulkr.net | twitter: @raulvk

 On Fri, Apr 12, 2013 at 4:36 PM, Chris Wolf cwolf.a...@gmail.com wrote:

 The reason I asked is because now I have to set default Endpoint or URI in
 the producer template - it would be nice if the default setting would be
 the next down-stream endpoint.


 On Thu, Apr 11, 2013 at 8:53 PM, Willem jiang willem.ji...@gmail.com
 wrote:

  ProducerTemplate can send the exchange to any other endpoints.
  Processor is decoupled with the camel route, I don't think you can get
 the
  downstream endpoint from the custom Processor itself.
 
 
  --
  Willem Jiang
 
  Red Hat, Inc.
  FuseSource is now part of Red Hat
  Web: http://www.fusesource.com | http://www.redhat.com
  Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
  (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
  Twitter: willemjiang
  Weibo: 姜宁willem
 
 
 
 
 
  On Friday, April 12, 2013 at 8:08 AM, Chris Wolf wrote:
 
   Hello,
  
   I'm implementing a custom Processor - it will have a ProducerTemplate,
   which will always
   send to the next Endpoint, downstream - why do I have to set the
   defaultEndpoint
   or defaultEndpointURI? That guarantees hardcoding. Isn't there someway
 to
   indicate,
   upon CamelContext.createProducerTemplate() to imply next downstream
   Endpoint?
  
   It's not a show-stopper, I can explicitly configure the Producer
   defaultEndpoint, but I don't
   know why it can't default to the next down-stream consuming endpoint...
  
   Thanks,
  
   Chris
 
 
 



Re: I'm confused about FTP option localWorkDirectory

2013-04-12 Thread Chris Wolf
Ok, I forgot about implicit type conversion.  I can see that if
RemoteFile gets routed to,
for example, a bean method with signature public void
processFile(InputStream input),
that Camel will convert RemoteFile to BufferedInputStream.  I also was
able to get
a valid java.io.File instance by calling .convertBodyTo(File.class);

Ok, I'm good to go...

Thanks,

Chris

On Fri, Apr 12, 2013 at 12:25 PM, Chris Wolf cwolf.a...@gmail.com wrote:
 I read the documentation:
 http://camel.apache.org/ftp.html

 and want to FTP large files, as such, I don't want the entire file
 loaded into memory - I thought the localWorkDirectory option would
 allow this.  That web page says,
 It will download the remote file directly to a local file stream. The
 java.io.File handle is then used as the Exchange body.

 Well, that's not what I'm seeing - what I see is that the body is of type

 , BodyType:org.apache.camel.component.file.remote.RemoteFile
 , Body:[Body is file based: RemoteFile[giant_dataset.csv]]

 ...but I expected it to be of type java.io.File, like the local
 file:// component and like the ftp documentation says.

 When stepping through the code, I see that the file *is* being
 downloaded to the work dir.
 If I look at the various fields of RemoteFile in the debugger, I don't
 see anything indicating a file path which includes the local work
 directory.

 So how, exactly, does the localWorkDirectory mechanism work and is it
 true that it won't load the whole file into memory?  Why isn't the
 exchange body of type java.io.File or java.io.InputStream? - I'm
 confused - please help...

 -Chris


Re: Is there a standard, DSL way to put message body in registry?

2013-04-12 Thread Christian Müller
The same for headers...

Sent from a mobile device
Am 12.04.2013 17:38 schrieb Chris Wolf cwolf.a...@gmail.com:

 Right - ok, that sounds good.  I forgot that a property value can be an
 object not just a String.


 On Thu, Apr 11, 2013 at 9:46 PM, Willem jiang willem.ji...@gmail.com
 wrote:

  If you put a object into the exchange properties, you can lookup it later
  in other processor.
 
 
  --
  Willem Jiang
 
  Red Hat, Inc.
  FuseSource is now part of Red Hat
  Web: http://www.fusesource.com | http://www.redhat.com
  Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/)
  (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
  Twitter: willemjiang
  Weibo: 姜宁willem
 
 
 
 
 
  On Thursday, April 11, 2013 at 10:41 PM, Chris Wolf wrote:
 
   I know I could implement a custom Processor, but I was wondering if
 there
   was a Java and Spring DSL way to put objects in the registry and lookup
   them up later.
  
   Thanks,
  
  
   Chris
 
 
 



Re: How to implement concurrent route processing

2013-04-12 Thread Christian Müller
The camel routes are executed concurrently.

Best,
Christian

Sent from a mobile device
Am 12.04.2013 15:21 schrieb Okello Nelson cn.oke...@gmail.com:

 Hi Guys,

 I'm currently working on a project in which I have several routes. To
 improve throughput, I'd like to have all the routes executing concurrently.
 What I've observed so far is that when one route is executing, the others
 do not.

 Each route is composed of File, JMS, and JPA endpoints, with possible
 additional endpoints later.

 Any ideas on how I can implement this will be appreciated very much.

 Kind Regards,
 Okello Nelson.



Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

2013-04-12 Thread Magnus Palmér
The from jms destination is not valid syntax for a WMQ object when looking
at your route configuration but I guess that is not the exact one since the
error log you provided talks about something else.

The problem is that there is a listener setup failure that will cause a
retry every 5 seconds due to
org.springframework.jms.listener.DefaultMessageListenerContainer if I
understand the code correctly (looking in camel-jms 2.11 and spring-.jms
3.1.4

I guess you can do as Claus suggested in the link from your first question
and configure an exceptionListener.

Although I wonder if it would be in place to
let org.apache.camel.component.jms.DefaultJmsMessageListenerContainer
override the handleListenerSetupFailure method from
o.s.j.l.DefaultMessageListenerContainer so that Camels errorhandler can
handle the error instead?

I am not used to work with these low level JMS details so not sure though.


2013/4/12 praveenbillampati praveenbillamp...@gmail.com

 Any ideas..?



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730768.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Brgds, Magnus Palmér


Re: How to implement concurrent route processing

2013-04-12 Thread Okello Nelson
Hi Christian,

I think the problem was with my file sizes. When i started splitting the
files into smaller chunks before feeding to the queues, i started seeing
the concurrent execution.

This started me thinking: is it possible for the file component to start
processing several files at the same time. I think that, in my setup, it
processes one file then goes on to the next one. This is quite a hold up
when the files are big.

Kind Regards
 On Apr 13, 2013 2:00 AM, Christian Müller christian.muel...@gmail.com
wrote:

 The camel routes are executed concurrently.

 Best,
 Christian

 Sent from a mobile device
 Am 12.04.2013 15:21 schrieb Okello Nelson cn.oke...@gmail.com:

  Hi Guys,
 
  I'm currently working on a project in which I have several routes. To
  improve throughput, I'd like to have all the routes executing
 concurrently.
  What I've observed so far is that when one route is executing, the others
  do not.
 
  Each route is composed of File, JMS, and JPA endpoints, with possible
  additional endpoints later.
 
  Any ideas on how I can implement this will be appreciated very much.
 
  Kind Regards,
  Okello Nelson.
 



Re: org.springframework.jms.InvalidDestinationException while trying to place a message on queue

2013-04-12 Thread praveenbillampati
Route is able to listen on the from queue correctly.  

I tried keeping exception listener, however it is not listening the
exception. Below is the configuration.

package com.aaa.bbb.ccc;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;

public class JMSExceptionListener implements ExceptionListener {
public JMSExceptionListener() {
super();
System.out.println(started exception listener);
}

@Override
public void onException(JMSException ex) {
System.out.println(EXCEPTION CAUGHT::: + ex.getMessage());
}
}
 bean id=jmsExceptionListener
class=com.aaa.bbb.ccc.JMSExceptionListener /

 bean id=jmsDestResolver
class=org.springframework.jms.support.destination.JndiDestinationResolver
/

 bean id=jndiTemplate class=org.springframework.jndi.JndiTemplate /

 bean id=mqConnectionFactory
class=org.springframework.jndi.JndiObjectFactoryBean
property name=jndiTemplate ref=jndiTemplate /
property name=jndiName value=java:comp/env/jms/xyz/xyzQCF /
property name=resourceRef value=true /
  /bean

 bean id=jmsTransactionManager
class=org.springframework.jms.connection.JmsTransactionManager
property name=connectionFactory ref=mqConnectionFactory /
  /bean
 
 bean id=mqConfig
class=org.apache.camel.component.jms.JmsConfiguration
property name=connectionFactory ref=mqConnectionFactory /
property name=transactionManager ref=jmsTransactionManager /
property name=transacted value=true /
property name=destinationResolver ref=jmsDestResolver /
property name=exceptionListener ref=jmsExceptionListener /
  /bean

 bean id=mqjms class=org.apache.camel.component.jms.JmsComponent
property name=configuration ref=mqConfig /
  /bean

I could see the initialization of exception listener, but it is not getting
invoked on the exception.

Is this missing something?

Thanks
Praveen




--
View this message in context: 
http://camel.465427.n5.nabble.com/org-springframework-jms-InvalidDestinationException-while-trying-to-place-a-message-on-queue-tp5730697p5730796.html
Sent from the Camel - Users mailing list archive at Nabble.com.