Re: Using Camel to quickly execute just one route?

2017-02-08 Thread Zoran Regvart
Hi Christian,
bare in mind that you can have control if you use direct component, so
having Camel context/routes started, doesn't mean that it needs to
poll in the background, you can do that on demand,

HTH,

zoran

On Tue, Feb 7, 2017 at 10:56 PM, Christian Brunotte  wrote:
> Hello
>
> I'd like to integrate Apache Camel into an existing project and just
> use some of it's endpoint capabilities (ftp, file, sftp etc.) to
> fetch some files and maybe validate them a bit.
>
> I don't want Camel to act as the main controller that dispatches
> everything in the background.
>
> Is it possible to use Camel in a very simplistic and lean way like e.g.:
>
> RouteBuilder simpleRoute = new RouteBuilder() {
> @Override
> public void configure() {
> 
> from("file://src/main/resources/inputs/?include=input.*\\.txt&noop=true")
> .convertBodyTo(String.class)
> .validate(body().regex("..."));
> }
> };
>
> String result = 
> CamelContext.createSimpleConsumerTemplate(simpleRoute).receiveBody(String.class);
>
> Currently it seems that I still have to add the route to the CamelContext,
> start it, then call my ConsumerTemplate and after that stop the context.
>
> Best Regards
>
> -christian-



-- 
Zoran Regvart


Re: Camel filter didn't work

2017-02-08 Thread shubho
yes you are right..i find the missing jar for spring. But still i am getting
error.I think its beacause of camel.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-filter-didn-t-work-tp5793594p5793644.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel filter didn't work

2017-02-08 Thread shubho
Now i am getting this error


14:43:53,236 ERROR [org.springframework.web.context.ContextLoader] (MSC
service thread 1-7) Context initialization failed:
org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route rout3:
Route(route3)[[From[file:\\home\41\test\Respfiles?f... because of Failed to
resolve endpoint:
file://%5C%5Chome%5C41%5Ctest%5CRespfiles?filter=%23myFilter%3Bdelete%3Dtrue
due to: Could not find a suitable setter for property: filter as there isn't
a setter method with same type: java.lang.String nor type conversion
possible: No type converter available to convert from type: java.lang.String
to the required type: org.apache.camel.component.file.GenericFileFilter with
value #myFilter;delete=true
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1690)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:138)
[camel-spring-2.17.3.jar:2.17.3]
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:340)
[camel-spring-2.17.3.jar:2.17.3]
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
[org.springframework.context-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:324)
[org.springframework.context-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:929)
[org.springframework.context-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)
[org.springframework.context-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
[org.springframework.web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
[org.springframework.web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
[org.springframework.web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
at
org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392)
[jbossweb-7.0.13.Final.jar:]
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3850)
[jbossweb-7.0.13.Final.jar:]
at
org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
[rt.jar:1.7.0_67]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
[rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route3: Route(route3)[[From[file:\\home\41\test\Respfiles?f... because
of Failed to resolve endpoint:
file://%5C%5Chome%5C41%5Ctest%5CRespfiles?filter=%23myFilter%3Bdelete%3Dtrue
due to: Could not find a suitable setter for property: filter as there isn't
a setter method with same type: java.lang.String nor type conversion
possible: No type converter available to convert from type: java.lang.String
to the required type: org.apache.camel.component.file.GenericFileFilter with
value #myFilter;delete=true
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:974)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3301)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3024)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2854)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2850)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2873)
[camel-core-2.17.3.jar:2.17.3]
at
org.apache.camel.impl.DefaultCam

Camel XML DSL for File transfer to endpoint on Condition

2017-02-08 Thread j_pramanik_ind
Hi All,

Is there any mechanism to handle file transfer from source folder to target
endpoint on the basis of specific condition ? In my case I'm using Apache
Camel 2.14.2 version in my application to handle incoming files for its
processing. I need to check a condition through java code in database table
data if it returns TRUE only then the routing process should work.


Here is my XML DSL -

   









java.io.IOException

java.lang.IllegalStateException

java.lang.Exception


  

 My requirement is to apply condition on the below XML DSL statement -

 
 Is this possible ? 

 Kindly let me know. As this is urgently required.

Thanks in advance.

Jayanta P.

 







--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-XML-DSL-for-File-transfer-to-endpoint-on-Condition-tp5793651.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Evaluate JsonPath on string inside a Map

2017-02-08 Thread Frank Wein

Hi all,
I wonder how I can achieve the following: I want to evaluate a JsonPath 
predicate in a when() expression on a string, which is inside a 
Map/MapMessage. If possible, this should be done with the Camel Java 
DSL. The original message should not be modified, I only want to 
evaluate the JsonPath expression on this specific spring. It looks to me 
I have to combine a simple(body[jsonString]) expression with a 
jsonpath(...) expression, but I'm not really sure how to do that. Or is 
there another approach which would work better for this type of problem? 
Someone can give me a hint?


Best regards
Frank



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Using Camel to quickly execute just one route?

2017-02-08 Thread Christian Brunotte
Hello Zoran

So what you propose is (in pseudocode):

RouteBuilder builder = new RouteBuilder() {
from("direct:start")
.enrich("file://src/main/resources/inputs/test.txt")
...
.to("direct:result");
}

CamelContext camel = new DefaultCamelContext();
camel.addRoutes(simpleRoute);
camel.start();
camel.createProducer().send("direct:start");
String result = camel.createConsumer().receiveBody("direct:result", 
String.class);
camel.stop();

That would start the Camel Engine but it would wait for a command
("direct:start") before it does anything and then would have to be
manually be polled, correct?

Best Regards,

-christian-

Am Wed, 8 Feb 2017 09:41:24 +0100
schrieb Zoran Regvart :

> Hi Christian,
> bare in mind that you can have control if you use direct component, so
> having Camel context/routes started, doesn't mean that it needs to
> poll in the background, you can do that on demand,
> 
> HTH,
> 
> zoran
> 
> On Tue, Feb 7, 2017 at 10:56 PM, Christian Brunotte  wrote:
> > Hello
> >
> > I'd like to integrate Apache Camel into an existing project and just
> > use some of it's endpoint capabilities (ftp, file, sftp etc.) to
> > fetch some files and maybe validate them a bit.
> >
> > I don't want Camel to act as the main controller that dispatches
> > everything in the background.
> >
> > Is it possible to use Camel in a very simplistic and lean way like e.g.:
> >
> > RouteBuilder simpleRoute = new RouteBuilder() {
> > @Override
> > public void configure() {
> > 
> > from("file://src/main/resources/inputs/?include=input.*\\.txt&noop=true")
> > .convertBodyTo(String.class)
> > .validate(body().regex("..."));
> > }
> > };
> >
> > String result = 
> > CamelContext.createSimpleConsumerTemplate(simpleRoute).receiveBody(String.class);
> >
> > Currently it seems that I still have to add the route to the CamelContext,
> > start it, then call my ConsumerTemplate and after that stop the context.
> >
> > Best Regards
> >
> > -christian-
> 
> 
> 


Re: Kafka Producer Serialization Error

2017-02-08 Thread Ravindra Godbole
I am also not able to understand the error but after this change it works.

.routeId(routeId).marshal().json(JsonLibrary.Jackson,
Map.class).convertBodyTo(String.class)

On Wed, Feb 8, 2017 at 4:26 AM, Webster  wrote:

> I am new to camel and kafka.
> I am using Camel 2.18.2 with Kafka 0.10.1.1
>
> I am getting this error and don't understand why:
> org.apache.kafka.common.errors.SerializationException: Can't convert value
> of class [B to class org.apache.kafka.common.
> serialization.StringSerializer
> specified in value.serializer
>
>
> I have the following route:
> from("direct://toEnrichEmail")
> .routeId(routeId).marshal().json(JsonLibrary.Jackson, Map.class)
> .log(LoggingLevel.INFO, "Sending to Kafka: ${body}")
> .to("kafka:localhost:9092?topic=enrich-email&requestRequiredAcks=-1");
>
> The code that actually sends to the route:
> ProducerTemplate template = kafkaProducerFactory.
> getProducerTemplate();
> logger.debug("Sending message type: {}, to uri: {}, route:
> {}",
> wimsConfiguration.getMessageType(),
> wimsConfiguration.getDirectUri(),
> wimsConfiguration.getRouteName());
> Mapheaders = new HashMap<>(); // added
> because the examples
> do
> headers.put(KafkaConstants.PARTITION_KEY, 0);
> headers.put(KafkaConstants.KEY, "1");
> template.sendBodyAndHeaders(wimsConfiguration.
> getDirectUri(),
> wimsConfiguration.getWimsMessage(), headers);
>
>
> The log message in the route shows that the message is a proper JSON
> string,
> the default serializer is string, So why is it complaining that it cannot
> serialize?
>
> I looked through the camel kafka component test cases and this looks like
> it
> should work
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Kafka-Producer-Serialization-Error-tp5793630.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
- Ravi

*[ View My Youtube Channel ] *

Phone: +91 *98 509 760 91*


Re: Using Camel to quickly execute just one route?

2017-02-08 Thread Condello, Giovanni
Hi,
There's no need for two routes, unless your use case is more complex
than the example you provided.

You can just use something like this:

context.start();

/* Now camel is ready */

ProducerTemplate template = context.createProducerTemplate();

String result = template.requestBody("direct:blah", null, String.class);

/* This will block until your route produces something */


context.stop()


2017-02-08 11:57 GMT+01:00 Christian Brunotte :
> Hello Zoran
>
> So what you propose is (in pseudocode):
>
> RouteBuilder builder = new RouteBuilder() {
> from("direct:start")
> .enrich("file://src/main/resources/inputs/test.txt")
> ...
> .to("direct:result");
> }
>
> CamelContext camel = new DefaultCamelContext();
> camel.addRoutes(simpleRoute);
> camel.start();
> camel.createProducer().send("direct:start");
> String result = camel.createConsumer().receiveBody("direct:result", 
> String.class);
> camel.stop();
>
> That would start the Camel Engine but it would wait for a command
> ("direct:start") before it does anything and then would have to be
> manually be polled, correct?
>
> Best Regards,
>
> -christian-
>
> Am Wed, 8 Feb 2017 09:41:24 +0100
> schrieb Zoran Regvart :
>
>> Hi Christian,
>> bare in mind that you can have control if you use direct component, so
>> having Camel context/routes started, doesn't mean that it needs to
>> poll in the background, you can do that on demand,
>>
>> HTH,
>>
>> zoran
>>
>> On Tue, Feb 7, 2017 at 10:56 PM, Christian Brunotte  
>> wrote:
>> > Hello
>> >
>> > I'd like to integrate Apache Camel into an existing project and just
>> > use some of it's endpoint capabilities (ftp, file, sftp etc.) to
>> > fetch some files and maybe validate them a bit.
>> >
>> > I don't want Camel to act as the main controller that dispatches
>> > everything in the background.
>> >
>> > Is it possible to use Camel in a very simplistic and lean way like e.g.:
>> >
>> > RouteBuilder simpleRoute = new RouteBuilder() {
>> > @Override
>> > public void configure() {
>> > 
>> > from("file://src/main/resources/inputs/?include=input.*\\.txt&noop=true")
>> > .convertBodyTo(String.class)
>> > .validate(body().regex("..."));
>> > }
>> > };
>> >
>> > String result = 
>> > CamelContext.createSimpleConsumerTemplate(simpleRoute).receiveBody(String.class);
>> >
>> > Currently it seems that I still have to add the route to the CamelContext,
>> > start it, then call my ConsumerTemplate and after that stop the context.
>> >
>> > Best Regards
>> >
>> > -christian-
>>
>>
>>


Re: Using Camel to quickly execute just one route?

2017-02-08 Thread Zoran Regvart
Hi Christian,
something like that, but I would tie start/stop of Camel context with
the lifecycle of the application and use somewhat simpler code that
Giovanni suggested,

zoran

On Wed, Feb 8, 2017 at 11:57 AM, Christian Brunotte  wrote:
> Hello Zoran
>
> So what you propose is (in pseudocode):
>
> RouteBuilder builder = new RouteBuilder() {
> from("direct:start")
> .enrich("file://src/main/resources/inputs/test.txt")
> ...
> .to("direct:result");
> }
>
> CamelContext camel = new DefaultCamelContext();
> camel.addRoutes(simpleRoute);
> camel.start();
> camel.createProducer().send("direct:start");
> String result = camel.createConsumer().receiveBody("direct:result", 
> String.class);
> camel.stop();
>
> That would start the Camel Engine but it would wait for a command
> ("direct:start") before it does anything and then would have to be
> manually be polled, correct?
>
> Best Regards,
>
> -christian-
>
> Am Wed, 8 Feb 2017 09:41:24 +0100
> schrieb Zoran Regvart :
>
>> Hi Christian,
>> bare in mind that you can have control if you use direct component, so
>> having Camel context/routes started, doesn't mean that it needs to
>> poll in the background, you can do that on demand,
>>
>> HTH,
>>
>> zoran
>>
>> On Tue, Feb 7, 2017 at 10:56 PM, Christian Brunotte  
>> wrote:
>> > Hello
>> >
>> > I'd like to integrate Apache Camel into an existing project and just
>> > use some of it's endpoint capabilities (ftp, file, sftp etc.) to
>> > fetch some files and maybe validate them a bit.
>> >
>> > I don't want Camel to act as the main controller that dispatches
>> > everything in the background.
>> >
>> > Is it possible to use Camel in a very simplistic and lean way like e.g.:
>> >
>> > RouteBuilder simpleRoute = new RouteBuilder() {
>> > @Override
>> > public void configure() {
>> > 
>> > from("file://src/main/resources/inputs/?include=input.*\\.txt&noop=true")
>> > .convertBodyTo(String.class)
>> > .validate(body().regex("..."));
>> > }
>> > };
>> >
>> > String result = 
>> > CamelContext.createSimpleConsumerTemplate(simpleRoute).receiveBody(String.class);
>> >
>> > Currently it seems that I still have to add the route to the CamelContext,
>> > start it, then call my ConsumerTemplate and after that stop the context.
>> >
>> > Best Regards
>> >
>> > -christian-
>>
>>
>>



-- 
Zoran Regvart


Re: Evaluate JsonPath on string inside a Map

2017-02-08 Thread Frank Wein

Frank Wein wrote:

Hi all,
I wonder how I can achieve the following: I want to evaluate a 
JsonPath predicate in a when() expression on a string, which is inside 
a Map/MapMessage. If possible, this should be done with the Camel Java 
DSL. The original message should not be modified, I only want to 
evaluate the JsonPath expression on this specific spring. It looks to 
me I have to combine a simple(body[jsonString]) expression with a 
jsonpath(...) expression, but I'm not really sure how to do that. Or 
is there another approach which would work better for this type of 
problem? Someone can give me a hint?


Best regards
Frank

I just found out it's possible to use simple expression in Camel 2.18 
with jsonpath: "It's now possible to in-lined Simple 
 language expressions in the 
JSonPath expression using the simple syntax *|${xxx}|*."


This would probably me, however: Is there also a solution that works 
with Camel 2.17.3?


Frank

--
Frank Wein
Forschungsgruppe Netz
Friedrich-Alexander-Universitaet Erlangen-Nuernberg
Regionales Rechenzentrum Erlangen (RRZE)
Martensstrasse 1, 91058 Erlangen, Germany
Tel. +49 9131/85-29983, Fax +49 9131/302941
frank.w...@fau.de
www.rrze.fau.de




smime.p7s
Description: S/MIME Cryptographic Signature


Removing headers

2017-02-08 Thread souciance
Hello,

I am trying to remove headers like this:

.removeHeaders("\\w+Accept\\w+", "\\w+Authorization\\w+", "\\w+Camel\\w+",
"\\w+Host\\w+", "\\w+Origin\\w+", "\\w+Postman\\w+", "\\w+Connection\\w+",
"\\w+Content-Length\\w+", "\\w+Content-Type\\w+", "\\w+VALID_SIP2\\w+" ,
"\\w+SIP2_MESSAGE_RABBITMQ_ROUTING_KEY\\w+")

However after I print the log all the headers are still there. I have also
tried with .* on both ends but that didn't work either. I tried with single
* at the end and same result there. Is there any other way to remove
headers?

Best
Souciance




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


Re: Removing headers

2017-02-08 Thread Claus Ibsen
Its using regular expressions so make sure that you use correct java reg exps.




On Wed, Feb 8, 2017 at 1:53 PM, souciance
 wrote:
> Hello,
>
> I am trying to remove headers like this:
>
> .removeHeaders("\\w+Accept\\w+", "\\w+Authorization\\w+", "\\w+Camel\\w+",
> "\\w+Host\\w+", "\\w+Origin\\w+", "\\w+Postman\\w+", "\\w+Connection\\w+",
> "\\w+Content-Length\\w+", "\\w+Content-Type\\w+", "\\w+VALID_SIP2\\w+" ,
> "\\w+SIP2_MESSAGE_RABBITMQ_ROUTING_KEY\\w+")
>
> However after I print the log all the headers are still there. I have also
> tried with .* on both ends but that didn't work either. I tried with single
> * at the end and same result there. Is there any other way to remove
> headers?
>
> Best
> Souciance
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Removing-headers-tp5793667.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Evaluate JsonPath on string inside a Map

2017-02-08 Thread souciance
Not sure if this is what you are after but I have done it this way:


.when(PredicateBuilder.isEqualTo(ExpressionBuilder.languageExpression("jsonpath","$.Status"),
"whatyouwantequalto"))

The $.Status is a node in the json string.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Evaluate-JsonPath-on-string-inside-a-Map-tp5793652p5793669.html
Sent from the Camel - Users mailing list archive at Nabble.com.


FINAL REMINDER: CFP for ApacheCon closes February 11th

2017-02-08 Thread Rich Bowen
Dear Apache Enthusiast,

This is your FINAL reminder that the Call for Papers (CFP) for ApacheCon
Miami is closing this weekend - February 11th. This is your final
opportunity to submit a talk for consideration at this event.

This year, we are running several mini conferences in conjunction with
the main event, so if you're submitting for one of those events, please
pay attention to the instructions below.

Apache: Big Data
* Event information:
http://events.linuxfoundation.org/events/apache-big-data-north-america
* CFP:
http://events.linuxfoundation.org/events/apache-big-data-north-america/program/cfp

Apache: IoT (Internet of Things)
* Event Information: http://us.apacheiot.org/
* CFP -
http://events.linuxfoundation.org/events/apachecon-north-america/program/cfp
(Indicate 'IoT' in the Target Audience field)

CloudStack Collaboration Conference
* Event information: http://us.cloudstackcollab.org/
* CFP -
http://events.linuxfoundation.org/events/apachecon-north-america/program/cfp
(Indicate 'CloudStack' in the Target Audience field)

FlexJS Summit
* Event information - http://us.apacheflexjs.org/
* CFP -
http://events.linuxfoundation.org/events/apachecon-north-america/program/cfp
(Indicate 'Flex' in the Target Audience field)

TomcatCon
* Event information - https://tomcat.apache.org/conference.html
* CFP -
http://events.linuxfoundation.org/events/apachecon-north-america/program/cfp
(Indicate 'Tomcat' in the Target Audience field)

All other topics and projects
* Event information -
http://events.linuxfoundation.org/events/apachecon-north-america/program/about
* CFP -
http://events.linuxfoundation.org/events/apachecon-north-america/program/cfp

Admission to any of these events also grants you access to all of the
others.

Thanks, and we look forward to seeing you in Miami!

-- 
Rich Bowen
VP Conferences, Apache Software Foundation
rbo...@apache.org
Twitter: @apachecon



(You are receiving this email because you are subscribed to a dev@ or
users@ list of some Apache Software Foundation project. If you do not
wish to receive email from these lists any more, you must follow that
list's unsubscription procedure. View the headers of this message for
unsubscription instructions.)


swagger-ui disable in a different environment

2017-02-08 Thread redpower1989
Hello,
The current application use this swagger
http://camel.apache.org/swagger.html

I was wondering if there is any easy way to disable swagger in production
environment?

Thanks





--
View this message in context: 
http://camel.465427.n5.nabble.com/swagger-ui-disable-in-a-different-environment-tp5793675.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: decrypting with PGPDataFormat

2017-02-08 Thread Gary
thanks everyone for your help. 

I resolved this issue. It turned out that it was in 2 parts. this is with
Camel 2.15.1

1) my customer was first sending encrypted files with no compression. And
the Camel Release 2.15.1 requires compression. 
1.1) it still didn't work.
2) It was discovered that there was a bug in the customers code. Their code,
they created the iostream but never actually wrote to it, only the
unencrypted stream. so, it still boiled down to compression. 

thanks for your help, I hope this helps others. 

always verify the files using the command line, GnuPG. you can also apply
trace on the Karaf container if you are using Jboss Fuse Karaf, or any other
container to see if the data is compressed or not, and any problems that
arise from it. So, I'm pleased and happy to report, it is not a Camel issue. 





-
Gary Lee Mills
--
View this message in context: 
http://camel.465427.n5.nabble.com/decrypting-with-PGPDataFormat-tp5793436p5793676.html
Sent from the Camel - Users mailing list archive at Nabble.com.


xpath 2.0?

2017-02-08 Thread Walzer, Thomas
Hi everyone,

I would like to use xpath 2.0 expressions in Camel. Is there a way? ASFAIK 
xpath in camel-core only supports xpath 1.0.

Cheers, Thomas.



possible duplication in spring boot example

2017-02-08 Thread Jean Francois LE BESCONT
Hi,

There are two examples :

https://github.com/apache/camel/tree/master/examples/camel-example-spring-boot
https://github.com/apache/camel/tree/master/examples/camel-example-spring-boot-starter

Which are very similar (POC of timer). After a winmerge of these two
example and as a java camel users, I am more lost and confused on which one
use as based than something else.

Jeff


Re: possible duplication in spring boot example

2017-02-08 Thread Jean Francois LE BESCONT
For a simple java user like me, even the test classes create confusion.
What is the best pratice ?

@SpringBootTest(classes = SampleCamelApplication.class)
or
@SpringBootTest(classes = MySpringBootRouter.class, webEnvironment =
SpringBootTest.WebEnvironment.RANDOM_PORT)

?



2017-02-08 16:29 GMT+01:00 Jean Francois LE BESCONT :

> Hi,
>
> There are two examples :
>
> https://github.com/apache/camel/tree/master/examples/
> camel-example-spring-boot
> https://github.com/apache/camel/tree/master/examples/
> camel-example-spring-boot-starter
>
> Which are very similar (POC of timer). After a winmerge of these two
> example and as a java camel users, I am more lost and confused on which one
> use as based than something else.
>
> Jeff
>


Re: xpath 2.0?

2017-02-08 Thread Claus Ibsen
Take a look at camel-saxon

On Wed, Feb 8, 2017 at 4:25 PM, Walzer, Thomas
 wrote:
> Hi everyone,
>
> I would like to use xpath 2.0 expressions in Camel. Is there a way? ASFAIK 
> xpath in camel-core only supports xpath 1.0.
>
> Cheers, Thomas.
>



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Camel XML DSL for File transfer to endpoint on Condition

2017-02-08 Thread vrlgohel
Hi Jayanta,

Unless you are not making a connection to the Database from your processor
code, you can try setting a property in the camel exchange and validating
the result of that property with the result returned from the DB.

So, something like this,

from(file://someEndpoint).
setProperty("name", body())

Depending on what you need to check, you save the original exchange body in
a property and then you can access this from the processor code,

In the processor code,

public void process(final Exchange exchange) throws Exception {

Object body = exchange.getProperty("name");

}



On Wed, Feb 8, 2017 at 3:21 PM, j_pramanik_ind [via Camel] <
ml-node+s465427n5793651...@n5.nabble.com> wrote:

> Hi All,
>
> Is there any mechanism to handle file transfer from source folder to
> target endpoint on the basis of specific condition ? In my case I'm using
> Apache Camel 2.14.2 version in my application to handle incoming files for
> its processing. I need to check a condition through java code in database
> table data if it returns TRUE only then the routing process should work.
>
>
> Here is my XML DSL -
>
>
> 
> 
>
> 
> 
>
> 
>
> java.io.
> IOException
> java.lang.
> IllegalStateException
> java.lang.
> Exception
> 
> 
>   
>
>  My requirement is to apply condition on the below XML DSL statement -
>
>  
>  Is this possible ?
>
>  Kindly let me know. As this is urgently required.
>
> Thanks in advance.
>
> Jayanta P.
>
>
>
>
>
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/Camel-XML-DSL-for-File-
> transfer-to-endpoint-on-Condition-tp5793651.html
> To unsubscribe from Camel - Users, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-XML-DSL-for-File-transfer-to-endpoint-on-Condition-tp5793651p5793682.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: SFTP get - chaining routes

2017-02-08 Thread Gabriel Kapitany
Thanks Claus, pollEnrich did the trick.

Gabriel



--
View this message in context: 
http://camel.465427.n5.nabble.com/SFTP-get-chaining-routes-tp5793620p5793681.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: possible duplication in spring boot example

2017-02-08 Thread Claus Ibsen
Hi

Yeah we should remove one of them and polished it a bit more. You are
welcome to log a JIRA

On Wed, Feb 8, 2017 at 4:29 PM, Jean Francois LE BESCONT
 wrote:
> Hi,
>
> There are two examples :
>
> https://github.com/apache/camel/tree/master/examples/camel-example-spring-boot
> https://github.com/apache/camel/tree/master/examples/camel-example-spring-boot-starter
>
> Which are very similar (POC of timer). After a winmerge of these two
> example and as a java camel users, I am more lost and confused on which one
> use as based than something else.
>
> Jeff



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: possible duplication in spring boot example

2017-02-08 Thread Jean Francois LE BESCONT
I have open the CAMEL-10808.

BTW come back to camel after few times and still so cool :)
Great job and fabric8 just awesome !

Jeff

2017-02-08 17:08 GMT+01:00 Claus Ibsen :

> Hi
>
> Yeah we should remove one of them and polished it a bit more. You are
> welcome to log a JIRA
>
> On Wed, Feb 8, 2017 at 4:29 PM, Jean Francois LE BESCONT
>  wrote:
> > Hi,
> >
> > There are two examples :
> >
> > https://github.com/apache/camel/tree/master/examples/
> camel-example-spring-boot
> > https://github.com/apache/camel/tree/master/examples/
> camel-example-spring-boot-starter
> >
> > Which are very similar (POC of timer). After a winmerge of these two
> > example and as a java camel users, I am more lost and confused on which
> one
> > use as based than something else.
> >
> > Jeff
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Skip Footer / Last Line

2017-02-08 Thread FoZi
I'm using apache camel in a routing context to integrate some CSV files. If I
want to skip the first line of the csv I can easily do it in the unmarshal:







My question is, whats the best way to ignore/skip the last line of the file
?

Thank you in advance,
 FoZi



--
View this message in context: 
http://camel.465427.n5.nabble.com/Skip-Footer-Last-Line-tp5793689.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Netty4 HL7 - reject messages larger than a specified size

2017-02-08 Thread slew77
Hi,

We are using netty4 and the camel hl7 codecs to read in hl7 messages. I
would like to reject messages larger than a certain size, but I can't find
an obvious way to do so.

I was going to enable stream caching and add a processor to the route to
check the size, but the codec produces a string or byte array, so i never
see the stream.

What's the correct way to do this please?

Thanks,
Steve.
 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Netty4-HL7-reject-messages-larger-than-a-specified-size-tp5793695.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Using Camel to quickly execute just one route?

2017-02-08 Thread Christian Brunotte
Hello

How can Guivanni's code be simplified further?

-christian-

Am Wed, 8 Feb 2017 12:56:51 +0100
schrieb Zoran Regvart :

> Hi Christian,
> something like that, but I would tie start/stop of Camel context with
> the lifecycle of the application and use somewhat simpler code that
> Giovanni suggested,
> 
> zoran
> 
> On Wed, Feb 8, 2017 at 11:57 AM, Christian Brunotte 
> wrote:
> > Hello Zoran
> >
> > So what you propose is (in pseudocode):
> >
> > RouteBuilder builder = new RouteBuilder() {
> > from("direct:start")
> > .enrich("file://src/main/resources/inputs/test.txt")
> > ...
> > .to("direct:result");
> > }
> >
> > CamelContext camel = new DefaultCamelContext();
> > camel.addRoutes(simpleRoute);
> > camel.start();
> > camel.createProducer().send("direct:start");
> > String result = camel.createConsumer().receiveBody("direct:result",
> > String.class); camel.stop();
> >
> > That would start the Camel Engine but it would wait for a command
> > ("direct:start") before it does anything and then would have to be
> > manually be polled, correct?
> >
> > Best Regards,
> >
> > -christian-
> >
> > Am Wed, 8 Feb 2017 09:41:24 +0100
> > schrieb Zoran Regvart :
> >
> >> Hi Christian,
> >> bare in mind that you can have control if you use direct
> >> component, so having Camel context/routes started, doesn't mean
> >> that it needs to poll in the background, you can do that on demand,
> >>
> >> HTH,
> >>
> >> zoran
> >>
> >> On Tue, Feb 7, 2017 at 10:56 PM, Christian Brunotte
> >>  wrote:
> >> > Hello
> >> >
> >> > I'd like to integrate Apache Camel into an existing project and
> >> > just use some of it's endpoint capabilities (ftp, file, sftp
> >> > etc.) to fetch some files and maybe validate them a bit.
> >> >
> >> > I don't want Camel to act as the main controller that dispatches
> >> > everything in the background.
> >> >
> >> > Is it possible to use Camel in a very simplistic and lean way
> >> > like e.g.:
> >> >
> >> > RouteBuilder simpleRoute = new RouteBuilder() {
> >> > @Override
> >> > public void configure() {
> >> > 
> >> > from("file://src/main/resources/inputs/?include=input.*\\.txt&noop=true")
> >> > .convertBodyTo(String.class)
> >> > .validate(body().regex("..."));
> >> > }
> >> > };
> >> >
> >> > String result =
> >> > CamelContext.createSimpleConsumerTemplate(simpleRoute).receiveBody(String.class);
> >> >
> >> > Currently it seems that I still have to add the route to the
> >> > CamelContext, start it, then call my ConsumerTemplate and after
> >> > that stop the context.
> >> >
> >> > Best Regards
> >> >
> >> > -christian-
> >>
> >>
> >>
> 
> 
> 



Re: Using Camel to quickly execute just one route?

2017-02-08 Thread Christian Brunotte
Hello

So I can either create a producer route with 
  from("ftp://...";).converBodyTo(...).to("direct:result")
and use
  String s = camel.createConsumerTemplate().receiveBody("direct:result", 
String.class);

or I create a consumer route with
  from("direct:getFile").pollEnrich("ftp://...";).convertBodyTo(...)
and use
  String s = 
camel.createFluentProducerTemplate().to("direct:getFile").request(String.class);

Is there any difference or preferred style?

For some reasons, the first one takes 2s whereas the second one finishes
in only 0.02s. The first also gives a warning, even if I explicitly call
consumerTemplate.stop(), why?
  "Waiting as there are still 1 inflight and pending exchanges to complete, 
timeout in 300 seconds. Inflights per route: [route1 = 1]"

-christian-


Am Wed, 8 Feb 2017 12:03:27 +0100
schrieb "Condello, Giovanni" :

> Hi,
> There's no need for two routes, unless your use case is more complex
> than the example you provided.
> 
> You can just use something like this:
> 
> context.start();
> 
> /* Now camel is ready */
> 
> ProducerTemplate template = context.createProducerTemplate();
> 
> String result = template.requestBody("direct:blah", null,
> String.class);
> 
> /* This will block until your route produces something */
> 
> 
> context.stop()
> 
> 
> 2017-02-08 11:57 GMT+01:00 Christian Brunotte :
> > Hello Zoran
> >
> > So what you propose is (in pseudocode):
> >
> > RouteBuilder builder = new RouteBuilder() {
> > from("direct:start")
> > .enrich("file://src/main/resources/inputs/test.txt")
> > ...
> > .to("direct:result");
> > }
> >
> > CamelContext camel = new DefaultCamelContext();
> > camel.addRoutes(simpleRoute);
> > camel.start();
> > camel.createProducer().send("direct:start");
> > String result = camel.createConsumer().receiveBody("direct:result",
> > String.class); camel.stop();
> >
> > That would start the Camel Engine but it would wait for a command
> > ("direct:start") before it does anything and then would have to be
> > manually be polled, correct?
> >
> > Best Regards,
> >
> > -christian-
> >
> > Am Wed, 8 Feb 2017 09:41:24 +0100
> > schrieb Zoran Regvart :
> >
> >> Hi Christian,
> >> bare in mind that you can have control if you use direct
> >> component, so having Camel context/routes started, doesn't mean
> >> that it needs to poll in the background, you can do that on demand,
> >>
> >> HTH,
> >>
> >> zoran
> >>
> >> On Tue, Feb 7, 2017 at 10:56 PM, Christian Brunotte
> >>  wrote:
> >> > Hello
> >> >
> >> > I'd like to integrate Apache Camel into an existing project and
> >> > just use some of it's endpoint capabilities (ftp, file, sftp
> >> > etc.) to fetch some files and maybe validate them a bit.
> >> >
> >> > I don't want Camel to act as the main controller that dispatches
> >> > everything in the background.
> >> >
> >> > Is it possible to use Camel in a very simplistic and lean way
> >> > like e.g.:
> >> >
> >> > RouteBuilder simpleRoute = new RouteBuilder() {
> >> > @Override
> >> > public void configure() {
> >> > 
> >> > from("file://src/main/resources/inputs/?include=input.*\\.txt&noop=true")
> >> > .convertBodyTo(String.class)
> >> > .validate(body().regex("..."));
> >> > }
> >> > };
> >> >
> >> > String result =
> >> > CamelContext.createSimpleConsumerTemplate(simpleRoute).receiveBody(String.class);
> >> >
> >> > Currently it seems that I still have to add the route to the
> >> > CamelContext, start it, then call my ConsumerTemplate and after
> >> > that stop the context.
> >> >
> >> > Best Regards
> >> >
> >> > -christian-
> >>
> >>
> >>



Re: Using Camel to quickly execute just one route?

2017-02-08 Thread souciance
The first one is probably doing a graceful shutdown so it waits until any
inflight exchange is complete before it stops. You can decrease the timeout
to less than 300 seconds if you want to.

The two approaches do somewhat different things if I am not misstaken.

The first one polls an ftp site for some file. It will retrieve files over
and over if new files come. The second one just gets a file once and that
is it (unless it is invoked again). So it depends on what you want to do.

There is also camel proxy to look at if you want something more lightweight.
http://camel.apache.org/using-camelproxy.html

On Wed, Feb 8, 2017 at 10:14 PM, Christian Brunotte [via Camel] <
ml-node+s465427n5793703...@n5.nabble.com> wrote:

> Hello
>
> So I can either create a producer route with
>   from("ftp://...";).converBodyTo(...).to("direct:result")
> and use
>   String s = camel.createConsumerTemplate().receiveBody("direct:result",
> String.class);
>
> or I create a consumer route with
>   from("direct:getFile").pollEnrich("ftp://...";).convertBodyTo(...)
> and use
>   String s = camel.createFluentProducerTemplate()
> .to("direct:getFile").request(String.class);
>
> Is there any difference or preferred style?
>
> For some reasons, the first one takes 2s whereas the second one finishes
> in only 0.02s. The first also gives a warning, even if I explicitly call
> consumerTemplate.stop(), why?
>   "Waiting as there are still 1 inflight and pending exchanges to
> complete, timeout in 300 seconds. Inflights per route: [route1 = 1]"
>
> -christian-
>
>
> Am Wed, 8 Feb 2017 12:03:27 +0100
> schrieb "Condello, Giovanni" <[hidden email]
> >:
>
> > Hi,
> > There's no need for two routes, unless your use case is more complex
> > than the example you provided.
> >
> > You can just use something like this:
> >
> > context.start();
> >
> > /* Now camel is ready */
> >
> > ProducerTemplate template = context.createProducerTemplate();
> >
> > String result = template.requestBody("direct:blah", null,
> > String.class);
> >
> > /* This will block until your route produces something */
> >
> >
> > context.stop()
> >
> >
> > 2017-02-08 11:57 GMT+01:00 Christian Brunotte <[hidden email]
> >:
> > > Hello Zoran
> > >
> > > So what you propose is (in pseudocode):
> > >
> > > RouteBuilder builder = new RouteBuilder() {
> > > from("direct:start")
> > > .enrich("file://src/main/resources/inputs/test.txt")
> > > ...
> > > .to("direct:result");
> > > }
> > >
> > > CamelContext camel = new DefaultCamelContext();
> > > camel.addRoutes(simpleRoute);
> > > camel.start();
> > > camel.createProducer().send("direct:start");
> > > String result = camel.createConsumer().receiveBody("direct:result",
> > > String.class); camel.stop();
> > >
> > > That would start the Camel Engine but it would wait for a command
> > > ("direct:start") before it does anything and then would have to be
> > > manually be polled, correct?
> > >
> > > Best Regards,
> > >
> > > -christian-
> > >
> > > Am Wed, 8 Feb 2017 09:41:24 +0100
> > > schrieb Zoran Regvart <[hidden email]
> >:
> > >
> > >> Hi Christian,
> > >> bare in mind that you can have control if you use direct
> > >> component, so having Camel context/routes started, doesn't mean
> > >> that it needs to poll in the background, you can do that on demand,
> > >>
> > >> HTH,
> > >>
> > >> zoran
> > >>
> > >> On Tue, Feb 7, 2017 at 10:56 PM, Christian Brunotte
> > >> <[hidden email]
> > wrote:
> > >> > Hello
> > >> >
> > >> > I'd like to integrate Apache Camel into an existing project and
> > >> > just use some of it's endpoint capabilities (ftp, file, sftp
> > >> > etc.) to fetch some files and maybe validate them a bit.
> > >> >
> > >> > I don't want Camel to act as the main controller that dispatches
> > >> > everything in the background.
> > >> >
> > >> > Is it possible to use Camel in a very simplistic and lean way
> > >> > like e.g.:
> > >> >
> > >> > RouteBuilder simpleRoute = new RouteBuilder() {
> > >> > @Override
> > >> > public void configure() {
> > >> > 
> > >> > from("file://src/main/resources/inputs/?include=input.*\\.txt&noop=true")
>
> > >> > .convertBodyTo(String.class)
> > >> > .validate(body().regex("..."));
> > >> > }
> > >> > };
> > >> >
> > >> > String result =
> > >> > CamelContext.createSimpleConsumerTemplate(simpleRoute).receiveBody(String.class);
>
> > >> >
> > >> > Currently it seems that I still have to add the route to the
> > >> > CamelContext, start it, then call my ConsumerTemplate and after
> > >> > that stop the context.
> > >> >
> > >> > Best Regards
> > >> >
> > >> > -christian-
> > >>
> > >>
> > >>
>
>
>
> --
> If you reply to this emai

CAMEL-5595 (Unrecognized SSL message, plaintext connection?)

2017-02-08 Thread Goyal, Arpit
As per the discussion [1], the work-around was given to add 
'proxyAuthScheme=http4'. But there was also a fix done for 'CAMEL-5595', what 
is the fix really?

Without the 'proxyAuthScheme' our HTTP calls using HTTP4 fails with - 
"Unrecognized SSL message, plaintext connection?" error message.

Stacktrace
---
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at 
sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:671)
at sun.security.ssl.InputRecord.read(InputRecord.java:504)
at 
sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946)
at 
sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1344)
at 
sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
at 
sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
at 
org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394)
at 
org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)
at 
org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
at 
org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at 
org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:388)

Regards,
Arpit.

[1] - 
http://camel.465427.n5.nabble.com/Using-the-HTTP4-component-to-make-a-HTTPS-call-behind-proxy-sever-td5719105.html


Re: Very Urgent - Camel direct component issue.

2017-02-08 Thread sari.reach
Anybody has an update on this



--
View this message in context: 
http://camel.465427.n5.nabble.com/Very-Urgent-Camel-direct-component-issue-tp5792539p5793706.html
Sent from the Camel - Users mailing list archive at Nabble.com.