RE: CSV Parsing

2014-09-11 Thread Ravi Gupta 7
You can try using 
unmarshal
bindy packages=org.fusesource.camel type=Csv /.
/unmarshal

Thanks 
RG
-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Thursday, September 11, 2014 11:10 AM
To: users@camel.apache.org
Subject: Re: CSV Parsing

Hi

You can also use the splitter eip

On Thu, Sep 11, 2014 at 1:44 AM, Matt Raible m...@raibledesigns.com wrote:
 I have a String that's delimited by ~. This string is returned from a
 database query. I'm able to parse it with the following code in my route:

 @Override
 public void configure() throws Exception {
 CsvDataFormat csv = new CsvDataFormat();
 csv.setDelimiter(~);
 ...

 .to(bean:myStoredProcedure)

 .process(myJdbcProcessor)

 .unmarshal(csv)

 .process(mySearchCsvProcessor)

 Today, I encountered a use case where not one string would be returned, but
 multiple strings. To handle this, I've changed myJdbcProcessor to have the
 following:


 ListString results = jdbcTemplate.queryForList(..., String.class);

 if (results.size() == 1) {
 exchange.getIn().setBody(results.get(0), String.class);
 } else {
 exchange.getIn().setBody(results, List.class);
 }

 When the result size is 1, everything works as expected. However, when
 there are multiple results, the csv unmarshal blows up with the following
 error:

 org.apache.camel.InvalidPayloadException: No body available of type:
 java.io.InputStream

 Is it possible to parse multiple lines with unmarshal(csv)?

 I tried the following, but that didn't work b/c it only gets the first line:

 exchange.getIn().setBody(StringUtils.collectionToCommaDelimitedString(results),
 String.class);


 Thanks,

 Matt



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


How to access SAN or NAS using camel

2014-09-11 Thread paragdharmadhikari
Hello Everybody,

We have a scenario where user may FTP the files on network drive (NAS or
SAN). So please let me know if code used to access the files from local
drive would remain same (only by changing the file location) or need any
other modifications in code. (User running the camel process would have
access to network drive)

Also please suggest any link/document available which would help us to
understand better about reading the files from network drive.

Regards
Parag Dharmadhikari



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-access-SAN-or-NAS-using-camel-tp5756312.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to access SAN or NAS using camel

2014-09-11 Thread Willem Jiang
I don’t think you need to any camel code except the file location, as OS 
already take care of it.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On September 11, 2014 at 3:37:10 PM, paragdharmadhikari 
(parag.dharmadhik...@citiustech.com) wrote:
 Hello Everybody,
  
 We have a scenario where user may FTP the files on network drive (NAS or
 SAN). So please let me know if code used to access the files from local
 drive would remain same (only by changing the file location) or need any
 other modifications in code. (User running the camel process would have
 access to network drive)
  
 Also please suggest any link/document available which would help us to
 understand better about reading the files from network drive.
  
 Regards
 Parag Dharmadhikari
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-to-access-SAN-or-NAS-using-camel-tp5756312.html
   
 Sent from the Camel - Users mailing list archive at Nabble.com.
  



Re: Babel: new DSL for Camel

2014-09-11 Thread Claus Ibsen
Hi

Thanks for sharing this. I took the liberty of adding a link to babel
from our user stories page (take a bit to update)
http://camel.apache.org/user-stories.html

And btw we do have a camel-scala component. And we love contributions,
so people with love for Scala is welcome to bring love to this
component.
https://github.com/apache/camel/tree/master/components/camel-scala

On Mon, Sep 8, 2014 at 1:18 PM, Babel chpa...@gmail.com wrote:
 Dear all,

 We have recently open sourced Babel, a new DSL for Camel at
 http://crossing-tech.github.io/babel . Its goal is to provide more type
 safety as well as conciseness to your route definition. The API is written
 in Scala and in a manner which makes it readable for Java developers.

 You may find the sources at https://github.com/Crossing-Tech/babel .

 We look forward to getting your opinion about it.

 Happy hacking!

 For the Babel team,
 Christophe Pache



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Babel-new-DSL-for-Camel-tp5756172.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Apache Camel requestTimeout

2014-09-11 Thread Willem Jiang
requestTimeout means the timeout for waiting for a reply when using the InOut 
Exchange Pattern (in milliseconds).
You can find more information about the requestTimeout option by looking it up 
in the camel-jms[1] wiki page.

[1]https://camel.apache.org/jms

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On September 10, 2014 at 4:00:33 PM, rajiv.jain (rajiv.j...@mjog.com) wrote:
 Hi
  
 I have a CustomProcessor that implements Processor. Below is the example
 code:
  
 public class NotificationRouter extends SpringRouteBuilder {
  
 public void configure() throws Exception {
 Properties properties = new Properties();
 properties.load(ClassLoader.getSystemResourceAsStream(new
 String(camel.properties)));
 ApplicationContext applicationContext = getApplicationContext();
  
 from(properties.getProperty(source)).unmarshal().jaxb(com.example.entities.xml).convertBodyTo(Entity.class)
   
 .multicast()
 .to(direct:x)
 .end();
 from(direct:x).process((ContentEnricherProcessor)
 applicationContext.getBean(contentEnricherProcessor))
 .to(properties.getProperty(activemq.destination));
 }
 }
  
 In the configuration file I have these settings:
  
 source=activemq:queue:notification
 activemq.location=vm://localhost?broker.persistent=false
 activemq.destination=mock:result
  
 In the code these values are picked up. When I place ?requestTimeout like
 this:
  
 source=activemq:queue:deliverynotification?requestTimeout=2000
 activemq.location=vm://localhost?broker.persistent=false
 activemq.destination=mock:result
  
 What does this mean? What does this do?
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Apache-Camel-requestTimeout-tp5756273.html  
 Sent from the Camel - Users mailing list archive at Nabble.com.
  



Apache Camel overriding Exchange.OutOnly behaviour to return body

2014-09-11 Thread camel
Hi

I had an issue with Apache Camel that timeouts for after 20 seconds.

I was getting timeout errors after 20 seconds. I have a custom processor the
implements Processor. I injected a DAO and when finding the data within the
custom processor it took longer to find the data on the Apache Camel side
and it timed out. If I run the same code without Apache Camel it runs
instantly. By doing a SELECT inside the CustomProcessor it took longer to
find the data. 

The memory reference for the DAO are the same, so in the test the data is
fetched immediately and the CustomProcessor hangs for 20 seconds before the
data is receieved and it throws an Exception. 

I figured out that I need to add ?disableReplyTo=true as below:
  source=activemq:queue:notification?disableReplyTo=true

This fixed the timeout issue, but nothing was being added to the queue. When
I request the body of the message it returns the input XML that was sent. By
default, by adding ?disableReplyTo=true sets the ExchangePattern to InOnly.
Is there any way of overriding this to ExchangePattern.OutOnly? I want the
message to be sent to the queue and also I want to get the body of the
message that is set through producerTemplate.requestBody().

What I noted that going from one processor to another the other processor
can access the exchange.setOut() as as exchange.getIn().

I have located the code on Githib: https://github.com/rajivj2/example2

I tried something like this:
public class ContentEnricherProcessor implements Processor {

@Resource
private StatusDAO statusDAO;
private Logger logger;

public ContentEnricherProcessor(StatusDAO statusDAO) {
this.statusDAO = statusDAO;
logger = LoggerFactory.getLogger(ContentEnricherProcessor.class);
}

public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.OutOnly); // by doing
producerTemplate.requestBody() this does not work
Message message = exchange.getIn();
Entity entity = (Entity) message.getBody();
Status status = process(entity);
message.setBody(status);
exchange.setOut(message);
}

I hope you can help. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Apache-Camel-overriding-Exchange-OutOnly-behaviour-to-return-body-tp5756319.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Re: Re: Re: Re: Camel Bindy: parse a BigDecimal number with a given pattern

2014-09-11 Thread Charles Moulliard
Hi Tom,

As camel-2.14 is ready for the vote, you could perhaps make a test with the
Bindy modification to confirm ?


https://repository.apache.org/content/repositories/orgapachecamel-1012/org/apache/camel/apache-camel/2.14.0/

Regards,


On Wed, Aug 27, 2014 at 7:56 AM, Charles Moulliard ch0...@gmail.com wrote:

 Hi Tom,

 I will document that when we define the decimal  grouping separators,
 then the pattern is mandatory.

 Regards,


 On Tue, Aug 26, 2014 at 7:26 PM, a_bli...@web.de wrote:

 Hi Charles,

 I've tested the current master with the following result:
 - @DataField(pos = 6, required = true, precision = 2, pattern =
 #,###.##)
   - works perfectly with my numbers

 - @DataField(pos = 6, required = true, precision = 2, groupingSeparator =
 ,, decimalSeparator = .)
   - throws a NumberFormatException

 - @DataField(pos = 6, required = true, precision = 2, pattern =
 #,###.##, groupingSeparator = ,, decimalSeparator = .)
   - also works

 If this is the expected behavior, then every thing is fine I guess.
 I'm happy with that change and I would use option 1 (pattern only).

 Thank you for your work.
 Best regards.




 --
 Charles Moulliard
 Apache Committer / Architect @RedHat
 Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io




-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io


Re: Babel: new DSL for Camel

2014-09-11 Thread Babel
Hello

Thanks for your link, Claus! It's already online.

Camel-Scala is really interesting and I hope Babel is a nice alternative a
bit between the regular Java DSL and Camel-Scala with some added value as
type safety.

Thanks again and all the Best!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Babel-new-DSL-for-Camel-tp5756172p5756339.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Hawt.io Camel plugin - 2 questions

2014-09-11 Thread Edmondo Porcu
Dear all,

How does Camel Hawt.io plugin retrieves the routes definitions that it
draws?

Are the definitions exposed through jmx (can't find them)

Also, a custom processor could have an icon of an existing one?

Best

Edmondo


Re: Hawt.io Camel plugin - 2 questions

2014-09-11 Thread Claus Ibsen
Hi

Its maybe better to ask on the hawtio community such as its user group
of github issue tracker
http://hawt.io/community/index.html

Short answer: Yes hawtio uses the JMX api from Apache Camel (no magic).

On Thu, Sep 11, 2014 at 4:54 PM, Edmondo Porcu edmondo.po...@gmail.com wrote:
 Dear all,

 How does Camel Hawt.io plugin retrieves the routes definitions that it
 draws?

 Are the definitions exposed through jmx (can't find them)

 Also, a custom processor could have an icon of an existing one?

 Best

 Edmondo



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: HTTP Basic Authentication

2014-09-11 Thread sayed_india
Hello,

Thanks a lot for the response.Will try and let you know.
please share a sample code snippet.

However the same code works for me at server side for CXF-SOAP so why not
for CXF-REST ?



Regards,
Sayed



--
View this message in context: 
http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756346.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Hawt.io Camel plugin - 2 questions

2014-09-11 Thread edmondo1984
What gets exposed is the Route definition, is that correct? 

Can you please point me towards the relevant code? Thank you



--
View this message in context: 
http://camel.465427.n5.nabble.com/Hawt-io-Camel-plugin-2-questions-tp5756344p5756349.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel User Interface

2014-09-11 Thread jgcorne
Are there any open source or commercial UI products out there that allow one
to development a camel route visually.  





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


Re: Hawt.io Camel plugin - 2 questions

2014-09-11 Thread Claus Ibsen
Hi

Camel has these JMX MBeans that any tooling can use
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/api/management/mbean/package-summary.html

There is an operation on the camel context and route mbeans, to dump
the route in xml format, which is what hawtio uses to draw the routes.

Likewise the karaf Camel commands uses the jmx api as well for some of
its commands.

On Thu, Sep 11, 2014 at 5:47 PM, edmondo1984 edmondo.po...@gmail.com wrote:
 What gets exposed is the Route definition, is that correct?

 Can you please point me towards the relevant code? Thank you



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Hawt-io-Camel-plugin-2-questions-tp5756344p5756349.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Camel User Interface

2014-09-11 Thread Claus Ibsen
Hi

You can find some Camel tooling on the user stories page
http://camel.apache.org/user-stories.html

The ones I am involved with are
- Fuse IDE
- hawtio
- fabric8

... which all allows to develop Camel routes visually, where they edit
the XML format (spring or blueprint).

Fuse IDE is Eclipse based, and the others are web based.

They are all free and open source. Fuse IDE is Eclipse licensed and
the others are ASL licensed.
And you can get commercial from Red Hat.

I recorded a video of Fuse IDE in action as part of developing Camel
apps for OpenShift with Fabric. Just in case people wanna quickly get
a taste for the editor. Mind that the next release has a Eclipse
debugger for Camel development.
https://vimeo.com/album/2635012/video/104004136

Lars who is the main developer on Fuse IDE has a blog series about
Fuse IDE which can be a good idea to check out:
http://lhein.blogspot.de/

And here is a video showing hawtio/fabric8 where you can use the web
tooling to edit / develop a Camel route (about 10 min into the video)
https://vimeo.com/album/2635012/video/94514302

Mind that this video is using not the latest version of hawtio/fabric
which keeps being improved.




On Thu, Sep 11, 2014 at 5:36 PM, jgcorne james.corn...@gmail.com wrote:
 Are there any open source or commercial UI products out there that allow one
 to development a camel route visually.





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



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Programmatic CXF Endpoint

2014-09-11 Thread jjathman
We are trying to use the CXF component to send web services requests were the
endpoint we will send to is not known ahead of time. Since we are not able
to configure these endpoints we are trying to create these endpoints
dynamically. I suppose my first question is whether or not this is the
correct way to solve this problem. Should we create a new CXFEndpoint object
each time we are sending to a new remote server?

For example, when we receive an incoming message, we will then need to
create 1 to many outgoing messages that we will not know the endpoint of
until runtime.

Second question is how to enable SSL support on these programmatically
created endpoints. I've tried the normal HTTP Conduit configuration but that
doesn't seem to be used when the endpoint is created programmatically. Is
that true or do I have something configured incorrectly?

I realize this is pretty complicated, if there's anything I can do to help
clarify this, please let me know. Thank you so much!



--
View this message in context: 
http://camel.465427.n5.nabble.com/Programmatic-CXF-Endpoint-tp5756368.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How Do I Stop The Camel ?

2014-09-11 Thread dharshan
I have run below code and run it 

  Main main = new Main();
main.enableHangupSupport();
FileCopyRouterBuilder fileCopy=new FileCopyRouterBuilder();
fileCopy.initFileProcess(D:\\InBox,D:\\OutBox);
main.addRouteBuilder(fileCopy);
main.run(a);
  
Now I need to stop the Camel ? How Do I do it this ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-Do-I-Stop-The-Camel-tp5756386.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Why does RouteDefinition have from methods?

2014-09-11 Thread toomanyedwards
Hey all,
  I'm still climbing the learning curve on Camel terminology, etc.  It makes
sense to me that I start defining a route by calling RouteBuilder.from and
get a RouteDefinition which I can then use to continue to define my route. 
What makes less sense to me is that RouteDefinition itself has from
methods on it so I can do something like:

myRouteDefinition = routeBuilder.from(direct:foo);
myRouteDefinition.to(direct:doSomething);

myRouteDefinition.from(direct:buzz);  
myRouteDefinition.to(direct:doSomethingElse);

Conceptually, I think of a RouteDefinition as defining one route, but in the
example above we can use the same RouteDefinition to essentially define two
completely unrelated routes from what I can tell.  What's the use case for
this vs using the routeBuilder again to create a completely new
RouteDefinition for the buzz route. i.e. -
routeBuilder.from(direct:buzz)


I have been loving Camel so far.  Thanks in advance for helping clear up
this confusion for me so I can understand more about it.

-e



--
View this message in context: 
http://camel.465427.n5.nabble.com/Why-does-RouteDefinition-have-from-methods-tp5756370.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel User Interface

2014-09-11 Thread jgcorne
Claus,

Thanks for the feedback!

Jimmy




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


Re: Download camel-extra / Hibernate component.

2014-09-11 Thread Bejjanki, Yuvanaga
Hi, iam getting below error.

Failed to resolve endpoint: 
hibernate://com.broadridge.workflow.model.CaseMaster?delay=10s
due to: No component found with scheme: hibernate

Dependency specified is 'camel-hibernate:2.13.1'

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

Re: How Do I Stop The Camel ?

2014-09-11 Thread Claus Ibsen
Hi

Just stop the JVM using ctrl + c.
Or call stop() on the main.

On Fri, Sep 12, 2014 at 7:00 AM, dharshan cdharsh...@gmail.com wrote:
 I have run below code and run it

   Main main = new Main();
 main.enableHangupSupport();
 FileCopyRouterBuilder fileCopy=new FileCopyRouterBuilder();
 fileCopy.initFileProcess(D:\\InBox,D:\\OutBox);
 main.addRouteBuilder(fileCopy);
 main.run(a);

 Now I need to stop the Camel ? How Do I do it this ?



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-Do-I-Stop-The-Camel-tp5756386.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Why does RouteDefinition have from methods?

2014-09-11 Thread Claus Ibsen
A route definition can have more inputs, so when you call from 2 or
more times, its multiple inputs to the same route. Though that is not
so commonly used as people most often have only 1 input to a route,
and hence only use from once.

On Fri, Sep 12, 2014 at 12:54 AM, toomanyedwards
toomanyedwa...@gmail.com wrote:
 Hey all,
   I'm still climbing the learning curve on Camel terminology, etc.  It makes
 sense to me that I start defining a route by calling RouteBuilder.from and
 get a RouteDefinition which I can then use to continue to define my route.
 What makes less sense to me is that RouteDefinition itself has from
 methods on it so I can do something like:

 myRouteDefinition = routeBuilder.from(direct:foo);
 myRouteDefinition.to(direct:doSomething);

 myRouteDefinition.from(direct:buzz);
 myRouteDefinition.to(direct:doSomethingElse);

 Conceptually, I think of a RouteDefinition as defining one route, but in the
 example above we can use the same RouteDefinition to essentially define two
 completely unrelated routes from what I can tell.  What's the use case for
 this vs using the routeBuilder again to create a completely new
 RouteDefinition for the buzz route. i.e. -
 routeBuilder.from(direct:buzz)


 I have been loving Camel so far.  Thanks in advance for helping clear up
 this confusion for me so I can understand more about it.

 -e



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Why-does-RouteDefinition-have-from-methods-tp5756370.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: HTTP Basic Authentication

2014-09-11 Thread sayed_india
Hello,
Sorry I was referring to the Java Interceptor code above mentioned which
works fine for CXF SOAP.

Cann't we make it for CXF-REST?

Thanks,
Sayed



--
View this message in context: 
http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756392.html
Sent from the Camel - Users mailing list archive at Nabble.com.