Adding processing per Consumer endpoint

2011-10-30 Thread tkatva
Hi

I was wondering is it possible to add Processor per consumer/target endpoint
? Let's say that I have ftp - producer/source endpoint and multiple targets,
then what I would like to do is process current file differently for each
endpoint. Is that possible or just for the whole route ? 

Also I am interested that is possible to change each endpoints filename ?
For example if I have several target/consumer FTP-endpoints and I would like
to name each endpoint filename differently... Is that possible ? 

Thank you 

Best Regards Tuomas

--
View this message in context: 
http://camel.465427.n5.nabble.com/Adding-processing-per-Consumer-endpoint-tp4949199p4949199.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Creating routes dynamically

2011-10-30 Thread Claus Ibsen
On Sat, Oct 29, 2011 at 7:26 PM, Johm Mac mcdon...@gmail.com wrote:
 The endpoints are strings - nothing prevents you from externalising such
 information (say in a config file) and then build the endpoint urls based on
 values in there that you read in at start-up time.  Processors can be
 equally created 'late'.  If the class you are using has state you can
 insantiate it from within the routebuilder also

 Let me know if you need something more concrete - hopefully this makes sense


Also the RouteBuilder configure method is just java code. So you can
have for loops, if .. else etc. And thus
create a route template, to use to create new dynamic routes.



 On 29/10/2011 06:26, tkatva wrote:

 Hi


 I am newbie with Camel and it seems to be very powerful framework. One
 thing
 that I haven't found out yet is that how can you create routes
 programmatically/dynamically?

 So let's say I created following code :

   camel = new DefaultCamelContext();
                                 camel.addRoutes(new RouteBuilder() {
                                 @Override
                 public void configure() throws Exception {

  from(file:C:\\FtpTestFolders\\FtpOut?delete=true)

  .setHeader(Exchange.FILE_NAME,
 constant(TestiPrkl.txt))
                       .to(file:C:\\FtpTestFolders\\FtpIn)
                        .setHeader(Exchange.FILE_NAME,
 constant(ToinenTestiPrkl.txt))
                        .to(file:C:\\FtpTestFolders\\FtpError);
                         //Here I may or may not want to add other headers,
 endpoints and processors

                             }
                     });

 This is fine but what if I have defined my headers and endpoint in
 somewhere
 else (db/file/etc) and I wan't to create routes based on these
 dynamically.
 The API is quite complex so if someone could post me an example I would
 really appreciate it.

 Thank you

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





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


Re: Adding processing per Consumer endpoint

2011-10-30 Thread Claus Ibsen
On Sat, Oct 29, 2011 at 9:47 PM, tkatva tuomas.ka...@gmail.com wrote:
 Hi

 I was wondering is it possible to add Processor per consumer/target endpoint
 ? Let's say that I have ftp - producer/source endpoint and multiple targets,
 then what I would like to do is process current file differently for each
 endpoint. Is that possible or just for the whole route ?

 Also I am interested that is possible to change each endpoints filename ?
 For example if I have several target/consumer FTP-endpoints and I would like
 to name each endpoint filename differently... Is that possible ?


The file/ftp components will use the file name provided in the
CamelFileName header (if provided) over endpoint configuration.

Alternatively the recipient list EIP allows you to do dynamic to as
in this FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html


 Thank you

 Best Regards Tuomas

 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Adding-processing-per-Consumer-endpoint-tp4949199p4949199.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




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


Re: CamelTestSupport doesn't load Custom TypeConverter

2011-10-30 Thread Claus Ibsen
On Fri, Oct 28, 2011 at 11:04 AM, Frankie.Shen shfwpla...@hotmail.com wrote:
 Camel 2.7

 what do u mean classpath contains my custom typeconverter , the
 xxxconverter.java file is in the src folder


Yeah but the TypeConverter file must also be in the classpath.


 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/CamelTestSupport-doesn-t-load-Custom-TypeConverter-tp4945011p4945405.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/


Two different transactionmanagers on same route

2011-10-30 Thread David Karlsen
Hi.

I have a route with two transactional resources, stripped down it is:

camel:route
camel:from uri={{incoming.filedir}} /
camel:from ref=myQueueEndpoint /
camel:transacted /
camel:to 
uri=jpa:?persistenceUnit=myPersistenceUnitamp;usePersist=true /
/camel:route


How do I apply transactionality for the jpa endpoint in addition to the JMS one?
I do not want to use XA (which would have only one common transactionmanager).
Do I have to split the route in two and pass on the message over a
direct channel and stick in a JPA transactionmanager in the second
one?

--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen


Re: Creating routes dynamically

2011-10-30 Thread Donald Whytock
Be advised, some of the strings used inside RouteBuilder are expected
to be final variables.

Some things about routes can be changed even after they've been
created.  Check out DelegateProcessor.

Don

On Sun, Oct 30, 2011 at 3:52 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 On Sat, Oct 29, 2011 at 7:26 PM, Johm Mac mcdon...@gmail.com wrote:
 The endpoints are strings - nothing prevents you from externalising such
 information (say in a config file) and then build the endpoint urls based on
 values in there that you read in at start-up time.  Processors can be
 equally created 'late'.  If the class you are using has state you can
 insantiate it from within the routebuilder also

 Let me know if you need something more concrete - hopefully this makes sense


 Also the RouteBuilder configure method is just java code. So you can
 have for loops, if .. else etc. And thus
 create a route template, to use to create new dynamic routes.



 On 29/10/2011 06:26, tkatva wrote:

 Hi


 I am newbie with Camel and it seems to be very powerful framework. One
 thing
 that I haven't found out yet is that how can you create routes
 programmatically/dynamically?

 So let's say I created following code :

   camel = new DefaultCamelContext();
                                 camel.addRoutes(new RouteBuilder() {
                                 @Override
                 public void configure() throws Exception {

  from(file:C:\\FtpTestFolders\\FtpOut?delete=true)

  .setHeader(Exchange.FILE_NAME,
 constant(TestiPrkl.txt))
                       .to(file:C:\\FtpTestFolders\\FtpIn)
                        .setHeader(Exchange.FILE_NAME,
 constant(ToinenTestiPrkl.txt))
                        .to(file:C:\\FtpTestFolders\\FtpError);
                         //Here I may or may not want to add other headers,
 endpoints and processors

                             }
                     });

 This is fine but what if I have defined my headers and endpoint in
 somewhere
 else (db/file/etc) and I wan't to create routes based on these
 dynamically.
 The API is quite complex so if someone could post me an example I would
 really appreciate it.

 Thank you

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





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



Re: Validation supporting schemas with includes?

2011-10-30 Thread Christian Müller
I wanted to add the missing unit test for handling multiple schema file,
but it doesn't work. :-(
I made a test where a root schema file imports a nested schema file. Bot
schema file was valid. But I got an exception by starting the route. I
think to support multiple schemas, we have to use
schemaFactory.newSchema(Source[] sources);
instead of
schemaFactory.newSchema(Source source);
but I'm not sure. We have to figure it out...

Feel free to open a JIRA to track this issue as improvement.

Best,
Christian


On Sat, Oct 29, 2011 at 10:04 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 On Fri, Oct 28, 2011 at 1:13 PM, Lars lars.stuev...@ergogroup.no wrote:
  I'm using Camel 2.8.2 and I try to use the Validator with a schema which
  includes other schemas?
  Is this functionality supported?
  If yes, how do I specify the schemas?
 

 Have you tried to include the other schemas from a schema file?
 I assume you can use some sort of xsd:include or xsd:import or whatever
 you do.

 
  Lars Stuevold
 
  --
  View this message in context:
 http://camel.465427.n5.nabble.com/Validation-supporting-schemas-with-includes-tp4945655p4945655.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/



Problem running camel-example-cxf-osgi

2011-10-30 Thread Glen Mazza
Hello, I'm trying to run the Camel 2.8.2 sample camel-example-cxf-osgi 
on Apache Karaf 2.2.4.  Following these instructions: 
https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf-osgi/README.txt, 
I'm able to run the first four of these five commands with no problem:


features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.8.2/xml/features
features:install war
features:install camel-spring
features:install camel-jaxb
features:install camel-cxf

The last command above, however, reports this error:

karaf@root features:install camel-cxf
Error executing command: Could not start bundle 
mvn:org.apache.camel/camel-cxf-transport/2.8.2 in feature(s) 
camel-cxf-2.8.2: Unable to resolve module org.apache.cxf.bundle [137.0] 
because it is exposed to package 'javax.xml.bind.attachment' from 
org.apache.felix.framework [0] and 
org.apache.servicemix.specs.jaxb-api-2.2 [53.0] via two dependency chains.


Chain 1:
  org.apache.cxf.bundle [137.0]
import: (package=javax.xml.bind.attachment)
 |
export: package=javax.xml.bind.attachment
  org.apache.felix.framework [0]

Chain 2:
  org.apache.cxf.bundle [137.0]
import: (package=com.sun.tools.xjc.reader.xmlschema.parser)
 |
export: package=com.sun.tools.xjc.reader.xmlschema.parser; 
uses:=javax.xml.bind

  org.apache.servicemix.bundles.jaxb-xjc [58.0]
import: ((package=javax.xml.bind)(version=2.2.0)(!(version=3.0.0)))
 |
export: package=javax.xml.bind; uses:=javax.xml.bind.attachment
export: package=javax.xml.bind.attachment
  org.apache.servicemix.specs.jaxb-api-2.2 [53.0]

Any idea what the solution would be?

Thanks,
Glen


--
Glen Mazza
Talend - http://www.talend.com/apache
Blog - http://www.jroller.com/gmazza/
Twitter - glenmazza



Re: Validation supporting schemas with includes?

2011-10-30 Thread David Karlsen
The ticket https://issues.apache.org/jira/browse/CAMEL-4361 covers this case.

2011/10/30 Christian Müller christian.muel...@gmail.com:
 I wanted to add the missing unit test for handling multiple schema file,
 but it doesn't work. :-(
 I made a test where a root schema file imports a nested schema file. Bot
 schema file was valid. But I got an exception by starting the route. I
 think to support multiple schemas, we have to use
 schemaFactory.newSchema(Source[] sources);
 instead of
 schemaFactory.newSchema(Source source);
 but I'm not sure. We have to figure it out...

 Feel free to open a JIRA to track this issue as improvement.

 Best,
 Christian


 On Sat, Oct 29, 2011 at 10:04 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 On Fri, Oct 28, 2011 at 1:13 PM, Lars lars.stuev...@ergogroup.no wrote:
  I'm using Camel 2.8.2 and I try to use the Validator with a schema which
  includes other schemas?
  Is this functionality supported?
  If yes, how do I specify the schemas?
 

 Have you tried to include the other schemas from a schema file?
 I assume you can use some sort of xsd:include or xsd:import or whatever
 you do.

 
  Lars Stuevold
 
  --
  View this message in context:
 http://camel.465427.n5.nabble.com/Validation-supporting-schemas-with-includes-tp4945655p4945655.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/





-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen


Re: Problem running camel-example-cxf-osgi

2011-10-30 Thread Daniel Kulp

The README.txt needs updating.   You need to edit the jre.properties and 
comment out a bunch of the javax.* things that are provided by the bundles.   
That would include javax.xml.bind*, javax.jws*, javax.xml.soap*, 
javax.xml.ws*, I think javax.mail, javax.activation.   

Dan

On Sunday, October 30, 2011 7:10:21 PM Glen Mazza wrote:
 Hello, I'm trying to run the Camel 2.8.2 sample camel-example-cxf-osgi
 on Apache Karaf 2.2.4.  Following these instructions:
 https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf-osgi
 /README.txt, I'm able to run the first four of these five commands with no
 problem:
 
 features:addUrl mvn:org.apache.camel.karaf/apache-camel/2.8.2/xml/features
 features:install war
 features:install camel-spring
 features:install camel-jaxb
 features:install camel-cxf
 
 The last command above, however, reports this error:
 
 karaf@root features:install camel-cxf
 Error executing command: Could not start bundle
 mvn:org.apache.camel/camel-cxf-transport/2.8.2 in feature(s)
 camel-cxf-2.8.2: Unable to resolve module org.apache.cxf.bundle [137.0]
 because it is exposed to package 'javax.xml.bind.attachment' from
 org.apache.felix.framework [0] and
 org.apache.servicemix.specs.jaxb-api-2.2 [53.0] via two dependency chains.
 
 Chain 1:
org.apache.cxf.bundle [137.0]
  import: (package=javax.xml.bind.attachment)
 
  export: package=javax.xml.bind.attachment
org.apache.felix.framework [0]
 
 Chain 2:
org.apache.cxf.bundle [137.0]
  import: (package=com.sun.tools.xjc.reader.xmlschema.parser)
 
  export: package=com.sun.tools.xjc.reader.xmlschema.parser;
 uses:=javax.xml.bind
org.apache.servicemix.bundles.jaxb-xjc [58.0]
  import: ((package=javax.xml.bind)(version=2.2.0)(!(version=3.0.0)))
 
  export: package=javax.xml.bind; uses:=javax.xml.bind.attachment
  export: package=javax.xml.bind.attachment
org.apache.servicemix.specs.jaxb-api-2.2 [53.0]
 
 Any idea what the solution would be?
 
 Thanks,
 Glen
-- 
Daniel Kulp
dk...@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com


Re: pollEnrich consumer with selector

2011-10-30 Thread rspeter
Good day Claus,

I did get this dynamic URI working by following the consumer template java
bean example.
Thank you very much for your prompt replies.

Camel components are really powerful and you are a genius indeed.


Regards
Peter


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