2.15 - Can we configure endpoint using bean property style in blueprint?

2015-06-17 Thread mabady
Hi,
Is this supposed to work in blueprint.xml?

camelContext ...
   endpoint id=foo uri=ftp://foo@myserver;
property name=password value=secret/
property name=recursive value=true/
property name=ftpClient.dataTimeout value=3/
property name=ftpClient.serverLanguageCode value=fr/ 
  /endpoint
 
  route
from uri=ref:foo/
...
  /route
/camelContext



--
View this message in context: 
http://camel.465427.n5.nabble.com/2-15-Can-we-configure-endpoint-using-bean-property-style-in-blueprint-tp5768342.html
Sent from the Camel - Users mailing list archive at Nabble.com.


org.apache.camel.FailedToCreateRouteException: Failed to create route with SNMP component

2015-06-17 Thread jspyeatt
I'm using Camel 2.15.2 and suddenly find that context.addRoutes() is throwing
the following exception.

org.apache.camel.FailedToCreateRouteException: Failed to create route
SNMPPoll:udp:172.30.227.153:1.3.6.1.4.1.17491.1.1.2.1.2.201:
Route(SNMPPoll:udp:172.30.227.153:1.3.6.1.4.1.17491.1.1.2.1 because of
Failed to resolve endpoint:
*snmp://172.30.227.153:161?delay=6oids=1.3.6.1.4.1.17491.1.1.2.1.2.201protocol=udpretries=2snmpCommunity=privatesnmpVersion=0type=POLL*
due to: *Could not find a suitable setter for property: oids 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.snmp.OIDList with value
1.3.6.1.4.1.17491.1.1.2.1.2.201

The context is already running and looking at the documentation here 
http://camel.apache.org/snmp.html http://camel.apache.org/snmp.html   and
everything appears correct.

I'm just using the DefaultCamelContext and trying to do a simple
context.addRoutes() call.

Any ideas?



--
View this message in context: 
http://camel.465427.n5.nabble.com/org-apache-camel-FailedToCreateRouteException-Failed-to-create-route-with-SNMP-component-tp5768341.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Intercepting Bindy setter actions

2015-06-17 Thread Giorgio Vespucci
Thank you for the hint Claus
Indeed I found the following sentences in the source code:

// Get Field to be setted
Field field = annotatedFields.get(pos);
field.setAccessible(true);

[...]

field.set(modelField, value);

Then it would mean today it definitively uses reflection.


On Wed, Jun 17, 2015 at 12:20 PM Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Sorry but I would refer to looking at the source code.

 But yeah ideally it should use setter over direct fields if possible.
 But the source code will tell what it does today.

 On Wed, Jun 17, 2015 at 12:01 PM, Giorgio Vespucci
 giorgio.vespu...@gmail.com wrote:
  Hi everybody :)
  I'm wondering how Bindy is setting values from a CSV file to Java fields.
 
  It looks that it's not using setter methods the POJO exposes.
  Is there a way to intercept Bindy setter actions, so that an additional
  behavior could be executed?
 
  I'm using Camel 2.14.3.
 
  Best regards and thank you.



 --
 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://hawt.io/fabric8: http://fabric8.io/



Re: Pojo @Consumer Annotation

2015-06-17 Thread kalber
Done,

in.body is still null.

Route :
-
from(timer://?repeatCount=1).bean(MyService.class)

Bean

public class MyService {

 @Consume(uri = sql: select codaz, codbus, logmsg from bus.buslogger where
loglev = 'STS_CFG'?dataSource=#dataSource.nagios)
public void process(Exchange exchange) {
System.out.println(wait);
}
}

I attached a screenshot, so you can see debug.




-
kh
--
View this message in context: 
http://camel.465427.n5.nabble.com/Pojo-Consumer-Annotation-tp5768168p5768320.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Intercepting Bindy setter actions

2015-06-17 Thread Claus Ibsen
Yeah there is some ReflectionHelper in camel-core it could reuse
instead, then we could add logic for checking for setter first and use
that, and if not fallback on direct fields.




On Wed, Jun 17, 2015 at 2:04 PM, Giorgio Vespucci
giorgio.vespu...@gmail.com wrote:
 Thank you for the hint Claus
 Indeed I found the following sentences in the source code:

 // Get Field to be setted
 Field field = annotatedFields.get(pos);
 field.setAccessible(true);

 [...]

 field.set(modelField, value);

 Then it would mean today it definitively uses reflection.


 On Wed, Jun 17, 2015 at 12:20 PM Claus Ibsen claus.ib...@gmail.com wrote:

 Hi

 Sorry but I would refer to looking at the source code.

 But yeah ideally it should use setter over direct fields if possible.
 But the source code will tell what it does today.

 On Wed, Jun 17, 2015 at 12:01 PM, Giorgio Vespucci
 giorgio.vespu...@gmail.com wrote:
  Hi everybody :)
  I'm wondering how Bindy is setting values from a CSV file to Java fields.
 
  It looks that it's not using setter methods the POJO exposes.
  Is there a way to intercept Bindy setter actions, so that an additional
  behavior could be executed?
 
  I'm using Camel 2.14.3.
 
  Best regards and thank you.



 --
 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://hawt.io/fabric8: http://fabric8.io/




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


Hexadecimal converter

2015-06-17 Thread sobha
I need to convert hexadecimal payload to a structured  xml. How to convert by
reading each byte is in another xml rule. also some of the fields might
involve hexadecimal to binary , decimal etc .

so say a hexidecimal payload is  456757585930.  so it shud be converted
to   6745   *  5857 * c 3059 c after reading the xml rules.

Will netty or dozer or any of the Camel component help? or better to use
xslt?



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


Re: Pojo @Consumer Annotation

2015-06-17 Thread Claus Ibsen
Ah its the timer that sends an empty body. The timer always sends a null body.

The @Consume is for POJO routing where you do not need to write a Camel route.
So for example remove the route with the timer.

Though to bootstrap the @Consumer it depends a bit how you run Camel.
To have the @Consume being detected by Camel that creates the consumer
and calls the bean.

See this example
http://camel.apache.org/pojo-messaging-example.html

On Wed, Jun 17, 2015 at 8:21 AM, kalber karlheinz.al...@swslt.com wrote:
 Done,

 in.body is still null.

 Route :
 -
 from(timer://?repeatCount=1).bean(MyService.class)

 Bean
 
 public class MyService {

  @Consume(uri = sql: select codaz, codbus, logmsg from bus.buslogger where
 loglev = 'STS_CFG'?dataSource=#dataSource.nagios)
 public void process(Exchange exchange) {
 System.out.println(wait);
 }
 }

 I attached a screenshot, so you can see debug.




 -
 kh
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Pojo-Consumer-Annotation-tp5768168p5768320.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/


Unmarshalling serialization fails with ClassNotFoundException

2015-06-17 Thread Gustav Sinder
Hi,

I'm working on converting a flow (consists of 2 camel contexts) to use Amazon 
SQS instead of ActiveMQ (which worked just fine).
Setup:
File - Camel context 1 - AWS SQS - Camel context 2 - Databsae

Connectivity isn't an issue but I need to marshal/unmarshal the messages using 
base64 since SQS only supports text messages.
Additionally I need to marshal the Java Objects using serialization prior to 
base64 since the base64 marshaller only takes a byte stream.

Camel context 1: (Marshal: serialization, base64), writes a CamelExchange
Camel context 2: (Unmarshal: base64, serialization), reads a CamelExchange

The issue occurs in the second context when I try to unmarshal the bytestream 
to the Java object and I get a ClassNotFoundException for MyObject.
MyMessage - MyObject

A common bundle exports the objects in question and both contexts imports them.
Camel version 2.12

Thanks
/Gustav


Re: Apache Camel Routing and Apache CXF Rest with Proxy

2015-06-17 Thread Aki Yoshida
1. If it is a cxf's jaxrs service, you can use the cxf-bean component
to directly call that service.
http://camel.apache.org/cxf-bean-component.html

2. you can just add your headers as Camel headers in the route using setHeader


By the way, you don't need to add dev for usage questions.

2015-06-16 20:55 GMT+02:00 Bhavesh Mistry mistry.p.bhav...@gmail.com:
 Adding Dev group to see how I can achieve this.

 Thanks,

 Bhavesh

 On Mon, Jun 15, 2015 at 2:56 PM, Bhavesh Mistry mistry.p.bhav...@gmail.com
 wrote:

 Hi All,



 I am new to Apache Camel and trying to solve following problem with
 routing:



 I have CXF JAX-RS based REST Service implemented and deployed in same JVM
 (end-point).



 I have another set of REST Service that is not within same Java Process it
 is in (python or any other Process but on same host).





 We have unified port to access both services,  for example,



 Client call  HTTP Rest call (*8080*) -  Camel Route(  
 if(“/java_api/”
   to(http://localhost:*9090*) else { to (http://localhost:9091 (OLD
 Services)}





  cxf:rsServer id=javaRestServer address=
 http://localhost:9090/java_api;

  loggingFeatureEnabled=true

  serviceClass=…. 

  cxf:providers

   ref bean=jaxbProvider /

   ref bean=jsonProvider /

  /cxf:providers

  cxf:serviceBeans

   ref bean=myService/

  /cxf:serviceBeans

  /cxf:rsServer





 The problem with this approach is there is unnecessary http call for Java
 API(java_api) route since it is already locally hosted and we do not want
 to incur HTTP call.



 This has been done to set-up all the CXF context and be able to server
 REST service.



 So, my questions are:



 1) 1) Is there any way to setup route to call cxf local binding JAX-RS
 (direct call) rather then http call for Java API ?

 2) 2) How can I configure route such a way so HTTP Proxy headers  (e.g 
 *X-Forwarded-For
 *) gets passed to old Service API ? Since, Java Layer is indeed acting as
 proxy server.


 Thanks in advance for your help !


 Thanks,



 Bhavesh





Intercepting Bindy setter actions

2015-06-17 Thread Giorgio Vespucci
Hi everybody :)
I'm wondering how Bindy is setting values from a CSV file to Java fields.

It looks that it's not using setter methods the POJO exposes.
Is there a way to intercept Bindy setter actions, so that an additional
behavior could be executed?

I'm using Camel 2.14.3.

Best regards and thank you.


Re: Intercepting Bindy setter actions

2015-06-17 Thread Claus Ibsen
Hi

Sorry but I would refer to looking at the source code.

But yeah ideally it should use setter over direct fields if possible.
But the source code will tell what it does today.

On Wed, Jun 17, 2015 at 12:01 PM, Giorgio Vespucci
giorgio.vespu...@gmail.com wrote:
 Hi everybody :)
 I'm wondering how Bindy is setting values from a CSV file to Java fields.

 It looks that it's not using setter methods the POJO exposes.
 Is there a way to intercept Bindy setter actions, so that an additional
 behavior could be executed?

 I'm using Camel 2.14.3.

 Best regards and thank you.



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


Rest DSL URI template wildcards?

2015-06-17 Thread swissSteve
Hi, I'm using the Java DSL to define a REST endpoint and I have a use case
where I'd like to specify a wildcard for the verb URI template i.e ..*:

rest(/api/now/v1/).description(APIProxy).bindingMode(RestBindingMode.off).produces(application/xml)
.get(..*).to(direct:invokeApi)

Can this be done?
I'm using Camel 2.14.2 with camel-jetty under Karaf 3.0.3.

--
Steve



--
View this message in context: 
http://camel.465427.n5.nabble.com/Rest-DSL-URI-template-wildcards-tp5768332.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Rest DSL URI template wildcards?

2015-06-17 Thread Claus Ibsen
Hi

No well it depends on what underlying component you use.
If you use camel-spark-java then it support * as wildcard.

For jetty you can likely set its component / endpoint option
matchOnUriPrefix=true which is its weird name for wildcard.
But the * in the get is not understood by jetty.

Though we could maybe try to bake that in officially in the rest-dsl.

On Wed, Jun 17, 2015 at 4:05 PM, swissSteve steve.p.wh...@gmail.com wrote:
 Hi, I'm using the Java DSL to define a REST endpoint and I have a use case
 where I'd like to specify a wildcard for the verb URI template i.e ..*:

 rest(/api/now/v1/).description(APIProxy).bindingMode(RestBindingMode.off).produces(application/xml)
 .get(..*).to(direct:invokeApi)

 Can this be done?
 I'm using Camel 2.14.2 with camel-jetty under Karaf 3.0.3.

 --
 Steve



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Rest-DSL-URI-template-wildcards-tp5768332.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: Rest DSL URI template wildcards?

2015-06-17 Thread swissSteve
Brilliant, just what I need. Thanks Claus!




--
View this message in context: 
http://camel.465427.n5.nabble.com/Rest-DSL-URI-template-wildcards-tp5768332p5768336.html
Sent from the Camel - Users mailing list archive at Nabble.com.