Re: Camel 3.4.3 REST DSL - valid JSON response?

2020-08-20 Thread Alex Soto
Your binding mode is JSON.


 bindingMode=“json"

You are supposed to return an object, but you are returning a JSON string. Add 
bindingMode=“off” to this rest service.

Best regards,
Alex soto




> On Aug 20, 2020, at 12:20 PM, Gerald Kallas  wrote:
> 
>  bindingMode="json"



Re: MethodNotFoundException upgrading to Camel 3.4.2 (Blueprint and Karaf)

2020-08-20 Thread Alex Soto
Done:  https://issues.apache.org/jira/browse/CAMEL-15435 
<https://issues.apache.org/jira/browse/CAMEL-15435>


Best regards,
Alex soto




> On Aug 20, 2020, at 1:08 AM, Jean-Baptiste Onofre  wrote:
> 
> Hi Alex,
> 
> Not yet, I will get back on this one asap.
> Did you create a Jira about that ?
> 
> I will keep you posted.
> 
> Regards
> JB
> 
>> Le 19 août 2020 à 15:21, Alex Soto  a écrit :
>> 
>> Any update on this, JB?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Aug 15, 2020, at 4:06 AM, Jean-Baptiste Onofre  wrote:
>>> 
>>> Hi,
>>> 
>>> It seems to be related to a change on the camel-bean processor.
>>> 
>>> Let me reproduce it and make a bisect to identify the change.
>>> 
>>> Thanks !
>>> 
>>> Regards
>>> JB
>>> 
>>>> Le 14 août 2020 à 22:32, Alex Soto  a écrit :
>>>> 
>>>> Hello,
>>>> 
>>>> I have a Camel application using Blueprint XML running on Karaf  4.2.9.  
>>>> Some routes call methods on beans that are OSGi services.
>>>> When I try to upgrade to version 3.4.2  (from 3.4.0) Camel is no longer 
>>>> finding method in bean.
>>>> 
>>>> Error at startup reads:
>>>> 
>>>> "Failed to create route XXX at…”
>>>> 
>>>> Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method 
>>>> with name:  not found on bean: @ of type: 
>>>> Proxy3d58f1a3_9d5b_4a54_aa71_e8a0574b6da9
>>>>at 
>>>> org.apache.camel.component.bean.DefaultBeanProcessorFactory.createBeanProcessor(DefaultBeanProcessorFactory.java:146)
>>>>  ~[?:?]
>>>>at 
>>>> org.apache.camel.reifier.BeanReifier.createProcessor(BeanReifier.java:47) 
>>>> ~[?:?]
>>>>at 
>>>> org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:766)
>>>>  ~[?:?]
>>>>at 
>>>> org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:511)
>>>>  ~[?:?]
>>>>at 
>>>> org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:391) 
>>>> ~[?:?]
>>>>... 22 more
>>>> 
>>>> 
>>>> Any ideas?
>>>> 
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>> 
> 



Re: Rép. : Camel REST DSL with servlet - API URL?

2020-08-19 Thread Alex Soto
I am not sure you can do that but can try.
Also, I don’t understand why you would want to share a servlet across bundles.

Best regards,
Alex soto




> On Aug 19, 2020, at 12:02 PM, Gerald Kallas  wrote:
> 
> Thanks Alex.
> 
> That seems to be a problem as I'll have every Blueprint file is being 
> deployed separately and resides so far in a dedicated bundle.
> 
> I wonder if I could access the servlet in the registry anyway from a 
> dedicated bundle/Blueprint file as it is registered with
> 
> org.apache.camel.component.osgi.OsgiServletRegisterer
> 
> Best
> Gerald
> 
>> Alex Soto  hat am 19.08.2020 15:33 geschrieben:
>> 
>> 
>> Hi Gerald,
>> 
>> All Blueprint files in the same bundle share the same namespace/context, so 
>> yes, a bean defined in one file is visible in another, as long as it is the 
>> same bundle.  I usually have one file “beans.xml” where all beans are 
>> declared, and a separate file “camel-context.xml” defining the camel 
>> context.  Furthermore, you can move routes to separate files by using 
>> “routeContextRef”, for example:
>> 
>> 
>> http://camel.apache.org/schema/blueprint;  
>> id=“my-context">
>>  http://www.osgi.org/xmlns/blueprint/v1.0.0;
>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>  xsi:schemaLocation="
>>   http://www.osgi.org/xmlns/blueprint/v1.0.0 
>> https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>
>> 
>>  > xmlns="http://camel.apache.org/schema/blueprint”>
>>  
>>  
>>  . . . 
>>  
>>  
>> 
>> Again, all files need to be  in the same bundle.
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Aug 19, 2020, at 7:59 AM, Gerald Kallas  wrote:
>>> 
>>> Thanks Daniel.
>>> 
>>> Not sure if I did explain right.
>>> 
>>> I want to define
>>> 
>>> >> interface="org.osgi.service.http.HttpService" />
>>> 
>>> >> class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
>>> 
>>> >>init-method="register"
>>>destroy-method="unregister">
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> in one common Blueprint file and refer in an other blueprint file to the 
>>> registered servlet above like
>>> 
>>> 
>>> 
>>> Is there a way in the second Blueprint to get a reference to the servlet 
>>> defined in the first one?
>>> 
>>> Best
>>> Gerald
>>> 
>>>> Daniel Langevin  hat am 19.08.2020 13:48 
>>>> geschrieben:
>>>> 
>>>> 
>>>> Hi Gerald,
>>>> 
>>>> the only way i know to do that is to refer this way.
>>>> 
>>>> uri="direct-vm:xx?block=truetimeout=30"
>>>> 
>>>> 
>>>> 
>>>> 
>>>> hope this help!
>>>> 
>>>> 
>>>> 
>>>> Daniel
>>>>>>> 
>>>> De :   Gerald Kallas 
>>>> À :, Daniel Langevin 
>>>>   
>>>> Date : 2020-08-19 00:15
>>>> Objet :Re: Rép. : Camel REST DSL with servlet - API URL?   
>>>> The idea is to define a servlet once and to re-use it with it's context in 
>>>> multiple routes in different Blueprint files.
>>>> 
>>>> Best
>>>> Gerald
>>>> 
>>>>> Gerald Kallas  hat am 18.08.2020 22:35 geschrieben:
>>>>> 
>>>>> 
>>>>> Thanks a lot, Daniel. It works.
>>>>> 
>>>>> Is it possible to refer to a servlet that has been defined in another 
>>>>> Blueprint file?
>>>>> 
>>>>> Best
>>>>> Gerald
>>>>> 
>>>>>> Daniel Langevin  hat am 18.08.2020 14:29 
>>>>>> geschrieben:
>>>>>> 
>>>>>> 
>>>>>> Try this it's work for me.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> >>>>> bindingMode="json" scheme="https" port="8443"
>>>>>> apiContextPath="/api-d

Re: How to configure shutdown timeout

2020-08-19 Thread Alex Soto
Thanks Alex,

Also looking for a way to configure this in a Blueprint XML file.


Best regards,
Alex soto




> On Aug 18, 2020, at 11:13 AM, Alex Dettinger  wrote:
> 
> Hi Alex,
> 
>  It seems the timeout is tuned after the context creation. One may achieve
> the desired result with either:
> @Override
> protected void doPostSetup() throws Exception {
>  context.getShutdownStrategy().setTimeout(60);
> }
> OR MAYBE
> @Override
> protected int getShutdowntimeout() {
>  return 60;
> }
> 
> hth,
> Alex
> 
> 
> 
> On Tue, Aug 18, 2020 at 3:23 PM Alex Soto  wrote:
> 
>> Hello,
>> 
>> Using Camel 3.4.0, in my unit test, I am trying to configure the shutdown
>> timeout doing the following:
>> 
>>   public class MyTest extends CamelTestSupport {
>>. . .
>> 
>>@Override
>>protected CamelContext createCamelContext() throws Exception {
>>CamelContext result = super.createCamelContext();
>> 
>> 
>> result.getExecutorServiceManager().setShutdownAwaitTermination(30_000);
>>result.getShutdownStrategy().setTimeout(60);
>> 
>>return result;
>>}
>> 
>> 
>> However,  I still see the default timeout of 10 seconds in the logs:
>> 
>> 2020-08-17 20:58:16,726 [main] INFO
>> org.apache.camel.impl.engine.DefaultShutdownStrategy  - Starting to
>> graceful shutdown 1 routes (timeout 10 seconds)
>> 
>> Any idea how to properly configure the shutdown timeout?
>> 
>> Also, I would like to know how  to do it with Blueprint XML
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>> 



Re: Rép. : Camel REST DSL with servlet - API URL?

2020-08-19 Thread Alex Soto
Hi Gerald,

All Blueprint files in the same bundle share the same namespace/context, so 
yes, a bean defined in one file is visible in another, as long as it is the 
same bundle.  I usually have one file “beans.xml” where all beans are declared, 
and a separate file “camel-context.xml” defining the camel context.  
Furthermore, you can move routes to separate files by using “routeContextRef”, 
for example:


http://camel.apache.org/schema/blueprint;  id=“my-context">
http://www.osgi.org/xmlns/blueprint/v1.0.0;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation="
   http://www.osgi.org/xmlns/blueprint/v1.0.0 
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>

http://camel.apache.org/schema/blueprint”>


. . . 



Again, all files need to be  in the same bundle.

Best regards,
Alex soto




> On Aug 19, 2020, at 7:59 AM, Gerald Kallas  wrote:
> 
> Thanks Daniel.
> 
> Not sure if I did explain right.
> 
> I want to define
> 
>interface="org.osgi.service.http.HttpService" />
> 
>class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
> 
>init-method="register"
> destroy-method="unregister">
>   
>   
>   
>   
>   
> 
> in one common Blueprint file and refer in an other blueprint file to the 
> registered servlet above like
> 
> 
> 
> Is there a way in the second Blueprint to get a reference to the servlet 
> defined in the first one?
> 
> Best
> Gerald
> 
>> Daniel Langevin  hat am 19.08.2020 13:48 
>> geschrieben:
>> 
>> 
>> Hi Gerald,
>> 
>> the only way i know to do that is to refer this way.
>> 
>> uri="direct-vm:xx?block=truetimeout=30"
>> 
>> 
>> 
>> 
>> hope this help!
>> 
>> 
>> 
>> Daniel
>>>>> 
>> De : Gerald Kallas 
>> À :  , Daniel Langevin 
>>   
>> Date :   2020-08-19 00:15
>> Objet :  Re: Rép. : Camel REST DSL with servlet - API URL?   
>> The idea is to define a servlet once and to re-use it with it's context in 
>> multiple routes in different Blueprint files.
>> 
>> Best
>> Gerald
>> 
>>> Gerald Kallas  hat am 18.08.2020 22:35 geschrieben:
>>> 
>>> 
>>> Thanks a lot, Daniel. It works.
>>> 
>>> Is it possible to refer to a servlet that has been defined in another 
>>> Blueprint file?
>>> 
>>> Best
>>> Gerald
>>> 
>>>> Daniel Langevin  hat am 18.08.2020 14:29 
>>>> geschrieben:
>>>> 
>>>> 
>>>> Try this it's work for me.
>>>> 
>>>> 
>>>> 
>>>> >>> bindingMode="json" scheme="https" port="8443"
>>>> apiContextPath="/api-doc" apiContextListing="false" enableCORS="true">
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> apiisp001 - Echo rest service
>>>> 
>>>> APIISP001 - Connectivity test 
>>>> 
>>>> 
>>>> /APIISP001/echo PONG.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Daniel Langevin
>>>> Direction de l’assistance et des technologies
>>>> Direction des ressources informationnelles
>>>> 
>>>> Société d’habitation du Québec
>>>> Édifice Marie-Guyart
>>>> 1054, rue Louis-Alexandre-Taschereau
>>>> Aile Jacques-Parizeau, 1er étage
>>>> Québec (Québec) G1R 5E7
>>>> Téléphone : 418 643-4035, poste 1191
>>>> Sans frais : 1 800 463-4315
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>>>> 
>>>> De : Gerald Kallas 
>>>> À : , Daniel Langevin 
>>>> 
>>>> Date : 2020-08-18 03:33
>>>> Objet : Re: Rép. : Camel REST DSL with servlet - API URL?
>>>> 
>>>> Thanks for the hint. But it doesn't work either. I modified my Blueprint 
&g

Re: MethodNotFoundException upgrading to Camel 3.4.2 (Blueprint and Karaf)

2020-08-19 Thread Alex Soto
Any update on this, JB?

Best regards,
Alex soto




> On Aug 15, 2020, at 4:06 AM, Jean-Baptiste Onofre  wrote:
> 
> Hi,
> 
> It seems to be related to a change on the camel-bean processor.
> 
> Let me reproduce it and make a bisect to identify the change.
> 
> Thanks !
> 
> Regards
> JB
> 
>> Le 14 août 2020 à 22:32, Alex Soto  a écrit :
>> 
>> Hello,
>> 
>> I have a Camel application using Blueprint XML running on Karaf  4.2.9.  
>> Some routes call methods on beans that are OSGi services.
>> When I try to upgrade to version 3.4.2  (from 3.4.0) Camel is no longer 
>> finding method in bean.
>> 
>> Error at startup reads:
>> 
>> "Failed to create route XXX at…”
>> 
>> Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method 
>> with name:  not found on bean: @ of type: 
>> Proxy3d58f1a3_9d5b_4a54_aa71_e8a0574b6da9
>>  at 
>> org.apache.camel.component.bean.DefaultBeanProcessorFactory.createBeanProcessor(DefaultBeanProcessorFactory.java:146)
>>  ~[?:?]
>>  at 
>> org.apache.camel.reifier.BeanReifier.createProcessor(BeanReifier.java:47) 
>> ~[?:?]
>>  at 
>> org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:766)
>>  ~[?:?]
>>  at 
>> org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:511)
>>  ~[?:?]
>>  at 
>> org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:391) 
>> ~[?:?]
>>  ... 22 more
>> 
>> 
>> Any ideas?
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 



Re: Rép. : Camel REST DSL with servlet - API URL?

2020-08-18 Thread Alex Soto
I think you are missing:


http://www.osgi.org/xmlns/blueprint/v1.0.0;
>  
> xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0;
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>  
> xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 
> https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>
> 
>xmlns="http://camel.apache.org/schema/blueprint; streamCache="true" 
> useBreadcrumb="true">
> 
>   
> 
>   
>   
> 
> 
>bindingMode="json" scheme="https" port="8443">
>   
>   
>   
>   
>   
>   
> 
>   
>
>   
>   
>   
>   
>   
>   
>   
> 
>   
> 
> 
> 
> The (untertow) web server runs with HTTPS on port 8443, other servlets are 
> working. I tried
> 
> https://localhost:8443/apiisp001/base/1
> 
> where I'd expect the response but did get a HTTP 404 error.
> 
> Any hints are appreciated.
> 
> See also the log for deployment
> 
> 2020-08-18T07:31:28,421 | INFO  | fileinstall-/opt/apache-karaf-4.2.9/deploy 
> | BlueprintContainerImpl   | 105 - org.apache.aries.blueprint.core - 
> 1.10.2 | Blueprint bundle isp.api.APIISP001.xml/0.0.0 has been started
> 2020-08-18T07:31:28,432 | INFO  | Blueprint Event Dispatcher: 1 | 
> BlueprintCamelContext| 169 - 
> org.apache.camel.karaf.camel-blueprint - 3.4.2 | Attempting to start 
> CamelContext: isp.api.APIISP001
> 2020-08-18T07:31:28,437 | INFO  | Blueprint Event Dispatcher: 1 | 
> JmxManagementStrategy| 144 - org.apache.camel.camel-management - 
> 3.4.2 | JMX is enabled
> 2020-08-18T07:31:28,484 | INFO  | Blueprint Event Dispatcher: 1 | 
> AbstractCamelContext | 115 - org.apache.camel.camel-base - 3.4.2 
> | Apache Camel 3.4.2 (isp.api.APIISP001) is starting
> 2020-08-18T07:31:28,484 | INFO  | Blueprint Event Dispatcher: 1 | 
> AbstractCamelContext | 115 - org.apache.camel.camel-base - 3.4.2 
> | StreamCaching is enabled on CamelContext: isp.api.APIISP001
> 2020-08-18T07:31:28,546 | INFO  | Blueprint Event Dispatcher: 1 | 
> AbstractCamelContext | 115 - org.apache.camel.camel-base - 3.4.2 
> | Using HealthCheck: camel-health
> 2020-08-18T07:31:28,592 | INFO  | Blueprint Event Dispatcher: 1 | 
> DefaultStreamCachingStrategy | 115 - org.apache.camel.camel-base - 3.4.2 
> | StreamCaching in use with spool directory: 
> /opt/apache-karaf/data/tmp/camel/camel-tmp-ID-43c92ad4274c-1597499175862-121-1
>  and rules: [Spool > 128K body size]
> 2020-08-18T07:31:28,593 | INFO  | Blueprint Event Dispatcher: 1 | 
> JacksonDataFormat| 137 - org.apache.camel.camel-jackson - 
> 3.4.2 | The option autoDiscoverObjectMapper is set to false, Camel won't 
> search in the registry
> 2020-08-18T07:31:28,594 | INFO  | Blueprint Event Dispatcher: 1 | 
> JacksonDataFormat| 137 - org.apache.camel.camel-jackson - 
> 3.4.2 | The option autoDiscoverObjectMapper is set to false, Camel won't 
> search in the registry
> 2020-08-18T07:31:28,625 | INFO  | Blueprint Event Dispatcher: 1 | 
> InternalRouteStartupManager  | 115 - org.apache.camel.camel-base - 3.4.2 
> | Route: isp.api.APIISP001.get.1 started and consuming from: 
> servlet:/apiisp001/1
> 2020-08-18T07:31:28,626 | INFO  | Blueprint Event Dispatcher: 1 | 
> AbstractCamelContext | 115 - org.apache.camel.camel-base - 3.4.2 
> | Total 1 routes, of which 1 are started
> 2020-08-18T07:31:28,626 | INFO  | Blueprint Event Dispatcher: 1 | 
> AbstractCamelContext | 115 - org.apache.camel.camel-base - 3.4.2 
> | Apache Camel 3.4.2 (isp.api.APIISP001) started in 0.142 seconds
> 2020-08-18T07:31:28,643 | INFO  | fileinstall-/opt/apache-karaf-4.2.9/deploy 
> | fileinstall  | 10 - org.apache.felix.fileinstall - 
> 3.6.6 | Started bundle: 
> blueprint:file:/opt/apache-karaf-4.2.9/deploy/isp.api.APIISP001.xml
> 
> Best
> Gerald
> 
>> Daniel Langevin  hat am 17.08.2020 17:44 
>> geschrieben:
>> 
>> 
>> Hi,
>> 
>> you have to specify the default http port number : 8181 for CamelServlet
>> 
>> like this:
>> 
>> http://servername.org:8181/apiisp001/1
>> 
>> 
>> 
>> 
>> Daniel Langevin
>> Direction de l’assistance et des technologies
>> Direction des ressources informationnelles
>> 
>> Société d’habitation du Québec
>> Édifice Marie-Guyart
>> 1054, rue Louis-Alexandre-Taschereau
>> Aile Jacques-Parizeau, 1er étage
>> Québec (Québec) G1R 5E7
>> Téléphone : 418 643-4035, poste 1191
>> Sans frais : 1 800 463-4315
>> 
>> 
>> 
>> 
>> 
> 
>> De : Gerald Kallas 
>> À :  "users@camel.apache.org" 
>> Date :   2020-08-17 11:22
>> Objet : 

How to configure shutdown timeout

2020-08-18 Thread Alex Soto
Hello, 

Using Camel 3.4.0, in my unit test, I am trying to configure the shutdown 
timeout doing the following:

   public class MyTest extends CamelTestSupport {
. . . 

@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext result = super.createCamelContext();


result.getExecutorServiceManager().setShutdownAwaitTermination(30_000);
result.getShutdownStrategy().setTimeout(60);

return result;
}


However,  I still see the default timeout of 10 seconds in the logs:

2020-08-17 20:58:16,726 [main] INFO  
org.apache.camel.impl.engine.DefaultShutdownStrategy  - Starting to graceful 
shutdown 1 routes (timeout 10 seconds)

Any idea how to properly configure the shutdown timeout?

Also, I would like to know how  to do it with Blueprint XML


Best regards,
Alex soto






Re: MethodNotFoundException upgrading to Camel 3.4.2 (Blueprint and Karaf)

2020-08-17 Thread Alex Soto
Thank you, JB, I hope it is an easy fix.


Best regards,
Alex soto




> On Aug 15, 2020, at 4:06 AM, Jean-Baptiste Onofre  wrote:
> 
> Hi,
> 
> It seems to be related to a change on the camel-bean processor.
> 
> Let me reproduce it and make a bisect to identify the change.
> 
> Thanks !
> 
> Regards
> JB
> 
>> Le 14 août 2020 à 22:32, Alex Soto  a écrit :
>> 
>> Hello,
>> 
>> I have a Camel application using Blueprint XML running on Karaf  4.2.9.  
>> Some routes call methods on beans that are OSGi services.
>> When I try to upgrade to version 3.4.2  (from 3.4.0) Camel is no longer 
>> finding method in bean.
>> 
>> Error at startup reads:
>> 
>> "Failed to create route XXX at…”
>> 
>> Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method 
>> with name:  not found on bean: @ of type: 
>> Proxy3d58f1a3_9d5b_4a54_aa71_e8a0574b6da9
>>  at 
>> org.apache.camel.component.bean.DefaultBeanProcessorFactory.createBeanProcessor(DefaultBeanProcessorFactory.java:146)
>>  ~[?:?]
>>  at 
>> org.apache.camel.reifier.BeanReifier.createProcessor(BeanReifier.java:47) 
>> ~[?:?]
>>  at 
>> org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:766)
>>  ~[?:?]
>>  at 
>> org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:511)
>>  ~[?:?]
>>  at 
>> org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:391) 
>> ~[?:?]
>>  ... 22 more
>> 
>> 
>> Any ideas?
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 



MethodNotFoundException upgrading to Camel 3.4.2 (Blueprint and Karaf)

2020-08-14 Thread Alex Soto
Hello,

I have a Camel application using Blueprint XML running on Karaf  4.2.9.  Some 
routes call methods on beans that are OSGi services.
When I try to upgrade to version 3.4.2  (from 3.4.0) Camel is no longer finding 
method in bean.

Error at startup reads:

"Failed to create route XXX at…”
 
Caused by: org.apache.camel.component.bean.MethodNotFoundException: Method with 
name:  not found on bean: @ of type: 
Proxy3d58f1a3_9d5b_4a54_aa71_e8a0574b6da9
at 
org.apache.camel.component.bean.DefaultBeanProcessorFactory.createBeanProcessor(DefaultBeanProcessorFactory.java:146)
 ~[?:?]
at 
org.apache.camel.reifier.BeanReifier.createProcessor(BeanReifier.java:47) ~[?:?]
at 
org.apache.camel.reifier.ProcessorReifier.makeProcessor(ProcessorReifier.java:766)
 ~[?:?]
at 
org.apache.camel.reifier.ProcessorReifier.addRoutes(ProcessorReifier.java:511) 
~[?:?]
at 
org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:391) 
~[?:?]
... 22 more


Any ideas?


Best regards,
Alex soto






Re: Rest registry has no services

2020-07-22 Thread Alex Soto
Hi JB,

I am now more confused.  I thought I was using Rest DSL when I defined my 
services in a Blueprint DSL as in:




















Rest registry does seem to work sporadically,  but not all the time, which is 
weird.   For example, from my custom data format I can access the Rest 
configuration:

exchange.getContext().getRestConfiguration().getContextPath();

And the registry sometimes has data:

exchange.getContext().getRestRegistry()

But sometimes it doesn’t, all during in the same execution session.

Best regards,
Alex soto




> On Jul 22, 2020, at 2:13 AM, Jean-Baptiste Onofre  wrote:
> 
> Hi,
> 
> AFAIR, getRestRegistry() will work only for REST DSL. If you use the 
> Blueprint DSL, you should check the consumer of your routes (cafes, rest, 
> whatever).
> 
> Regards
> JB
> 
>> Le 21 juil. 2020 à 16:14, Alex Soto  a écrit :
>> 
>> Hello,
>> 
>> I have a few Rest Services defined with Camel Blueprint DSL (Camel 3.4.0 
>> running on Karaf 4.2.9). 
>> In my integration test, I want to discover the services for testing.
>> After the Camel Context reaches status ServiceStatus.Started, the Rest 
>> Registry reports no services, although everything is fine with the services.
>> 
>>  List services = 
>> camelContext.getRestRegistry().listAllRestServices();
>>  assertTrue(services.size() > 1);
>> 
>> The above assertion is failing even though several services are running and 
>> I can use them without any problem.
>> Any idea why is this happening?
>> 
>> Thanks and best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 



Re: DefaultTracer traceBeforeRoute not calling dumpTrace

2020-07-21 Thread Alex Soto
PR here:  https://github.com/apache/camel/pull/4027 
<https://github.com/apache/camel/pull/4027>


Best regards,
Alex soto




> On Jul 21, 2020, at 9:57 AM, Alex Soto  wrote:
> 
> Thanks Claus, will create a PR
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Jul 19, 2020, at 3:53 AM, Claus Ibsen > <mailto:claus.ib...@gmail.com>> wrote:
>> 
>> Hi
>> 
>> Created a JIRA to not forget
>> https://issues.apache.org/jira/browse/CAMEL-15311 
>> <https://issues.apache.org/jira/browse/CAMEL-15311>
>> 
>> On Fri, Jul 17, 2020 at 10:40 AM Claus Ibsen  wrote:
>>> 
>>> Hi
>>> 
>>> Yeah that is a little bug. You are welcome to create a JIRA and
>>> provide a fix as a github PR
>>> https://camel.apache.org/manual/latest/contributing.html
>>> 
>>> On Fri, Jul 10, 2020 at 6:03 PM Alex Soto  wrote:
>>>> 
>>>> In Camel 3.4.0 I am trying to customize the Tracing to use DEBUG level 
>>>> instead of INFO.
>>>> For this, I created my own class extending 
>>>> org.apache.camel.impl.engine.DefaultTracer  and overriding method 
>>>> dumpTrace.
>>>> But dumpTrace is not being called in all cases, in particular, method 
>>>> traceBeforeRoute  is not calling it, instead logging directly with INFO 
>>>> level.
>>>> 
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Claus Ibsen
>>> -
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>> 
>> 
>> 
>> -- 
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
> 



Rest registry has no services

2020-07-21 Thread Alex Soto
Hello,

I have a few Rest Services defined with Camel Blueprint DSL (Camel 3.4.0 
running on Karaf 4.2.9). 
In my integration test, I want to discover the services for testing.
After the Camel Context reaches status ServiceStatus.Started, the Rest Registry 
reports no services, although everything is fine with the services.

List services = 
camelContext.getRestRegistry().listAllRestServices();
assertTrue(services.size() > 1);

The above assertion is failing even though several services are running and I 
can use them without any problem.
Any idea why is this happening?

Thanks and best regards,
Alex soto






Re: DefaultTracer traceBeforeRoute not calling dumpTrace

2020-07-21 Thread Alex Soto
Thanks Claus, will create a PR

Best regards,
Alex soto




> On Jul 19, 2020, at 3:53 AM, Claus Ibsen  wrote:
> 
> Hi
> 
> Created a JIRA to not forget
> https://issues.apache.org/jira/browse/CAMEL-15311
> 
> On Fri, Jul 17, 2020 at 10:40 AM Claus Ibsen  wrote:
>> 
>> Hi
>> 
>> Yeah that is a little bug. You are welcome to create a JIRA and
>> provide a fix as a github PR
>> https://camel.apache.org/manual/latest/contributing.html
>> 
>> On Fri, Jul 10, 2020 at 6:03 PM Alex Soto  wrote:
>>> 
>>> In Camel 3.4.0 I am trying to customize the Tracing to use DEBUG level 
>>> instead of INFO.
>>> For this, I created my own class extending 
>>> org.apache.camel.impl.engine.DefaultTracer  and overriding method dumpTrace.
>>> But dumpTrace is not being called in all cases, in particular, method 
>>> traceBeforeRoute  is not calling it, instead logging directly with INFO 
>>> level.
>>> 
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> --
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Re: org.apache.karaf.specs.locator not found

2020-07-13 Thread Alex Soto
I am sorry I posted this to the wrong mailing list.


Best regards,
Alex soto




> On Jul 13, 2020, at 12:22 PM, Jean-Baptiste Onofre  wrote:
> 
> Hi Alex,
> 
> I don’t see this error on Jenkins, so I guess this error is in your itest.
> 
> Can you share a simple project to reproduce ?
> 
> By the way, I added karaf user mailing list as it’s Karaf related.
> 
> Thanks,
> Regards
> JB
> 
>> Le 13 juil. 2020 à 18:11, Alex Soto  a écrit :
>> 
>> With Karaf 4.2.9 and Pax-Exam 4.13.3, and openjdk version "11.0.7" 
>> 2020-04-14, running integration tests produces warning:
>> 
>>  WARNING: package org.apache.karaf.specs.locator not in java.base
>> 
>> And error :
>> 
>> Bundle org.apache.felix.framework [0] EventDispatcher: Error during 
>> dispatch. (java.lang.NoClassDefFoundError: 
>> org/apache/karaf/specs/locator/OsgiLocator)
>> java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
>>  at 
>> org.apache.karaf.specs.activator.Activator.register(Activator.java:124) 
>> ~[org.apache.karaf.specs.activator-4.2.9.jar:4.2.9]
>>  at 
>> org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96) 
>> ~[org.apache.karaf.specs.activator-4.2.9.jar:4.2.9]
>>  at 
>> org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>>  ~[org.apache.felix.framework-5.6.12.jar:?]
>>  at 
>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>>  [org.apache.felix.framework-5.6.12.jar:?]
>>  at 
>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>>  [org.apache.felix.framework-5.6.12.jar:?]
>>  at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) 
>> [org.apache.felix.framework-5.6.12.jar:?]
>>  at 
>> org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
>>  [org.apache.felix.framework-5.6.12.jar:?]
>>  at 
>> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
>>  [org.apache.felix.framework-5.6.12.jar:?]
>>  at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108) 
>> [org.apache.felix.framework-5.6.12.jar:?]
>>  at 
>> org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
>>  [org.apache.felix.framework-5.6.12.jar:?]
>>  at 
>> org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:244)
>>  [!/:?]
>>  at 
>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1168)
>>  [!/:?]
>>  at 
>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1022)
>>  [!/:?]
>>  at 
>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062)
>>  [!/:?]
>>  at 
>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
>>  [!/:?]
>>  at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
>>  at 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>>  [?:?]
>>  at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>>  [?:?]
>>  at java.lang.Thread.run(Thread.java:834) [?:?]
>> 
>> 
>> Any idea?
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 



Re: org.apache.karaf.specs.locator not found

2020-07-13 Thread Alex Soto
Answering my own question…

The karaf.version system property is needed.  It can be configured in the 
Failsafe plugin as:


org.apache.maven.plugins
maven-failsafe-plugin



${karaf.version}




KarafTestSupport class uses this system variable to configure the endorsed Jar 
providing the OsgiLocator package.

Best regards,
Alex soto




> On Jul 13, 2020, at 12:11 PM, Alex Soto  wrote:
> 
> With Karaf 4.2.9 and Pax-Exam 4.13.3, and openjdk version "11.0.7" 
> 2020-04-14, running integration tests produces warning:
> 
>   WARNING: package org.apache.karaf.specs.locator not in java.base
> 
> And error :
> 
> Bundle org.apache.felix.framework [0] EventDispatcher: Error during dispatch. 
> (java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator)
> java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
>   at 
> org.apache.karaf.specs.activator.Activator.register(Activator.java:124) 
> ~[org.apache.karaf.specs.activator-4.2.9.jar:4.2.9]
>   at 
> org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96) 
> ~[org.apache.karaf.specs.activator-4.2.9.jar:4.2.9]
>   at 
> org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>  ~[org.apache.felix.framework-5.6.12.jar:?]
>   at 
> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>  [org.apache.felix.framework-5.6.12.jar:?]
>   at 
> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>  [org.apache.felix.framework-5.6.12.jar:?]
>   at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) 
> [org.apache.felix.framework-5.6.12.jar:?]
>   at 
> org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
>  [org.apache.felix.framework-5.6.12.jar:?]
>   at 
> org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
>  [org.apache.felix.framework-5.6.12.jar:?]
>   at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108) 
> [org.apache.felix.framework-5.6.12.jar:?]
>   at 
> org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
>  [org.apache.felix.framework-5.6.12.jar:?]
>   at 
> org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:244)
>  [!/:?]
>   at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1168)
>  [!/:?]
>   at 
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1022)
>  [!/:?]
>   at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062)
>  [!/:?]
>   at 
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
>  [!/:?]
>   at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>  [?:?]
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>  [?:?]
>   at java.lang.Thread.run(Thread.java:834) [?:?]
> 
> 
> Any idea?
> 
> 
> Best regards,
> Alex soto
> 
> 
> 
> 



org.apache.karaf.specs.locator not found

2020-07-13 Thread Alex Soto
With Karaf 4.2.9 and Pax-Exam 4.13.3, and openjdk version "11.0.7" 2020-04-14, 
running integration tests produces warning:

WARNING: package org.apache.karaf.specs.locator not in java.base

And error :

Bundle org.apache.felix.framework [0] EventDispatcher: Error during dispatch. 
(java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator)
java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
at 
org.apache.karaf.specs.activator.Activator.register(Activator.java:124) 
~[org.apache.karaf.specs.activator-4.2.9.jar:4.2.9]
at 
org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96) 
~[org.apache.karaf.specs.activator-4.2.9.jar:4.2.9]
at 
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
 ~[org.apache.felix.framework-5.6.12.jar:?]
at 
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
 [org.apache.felix.framework-5.6.12.jar:?]
at 
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
 [org.apache.felix.framework-5.6.12.jar:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) 
[org.apache.felix.framework-5.6.12.jar:?]
at 
org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
 [org.apache.felix.framework-5.6.12.jar:?]
at 
org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512) 
[org.apache.felix.framework-5.6.12.jar:?]
at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108) 
[org.apache.felix.framework-5.6.12.jar:?]
at 
org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
 [org.apache.felix.framework-5.6.12.jar:?]
at 
org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:244)
 [!/:?]
at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1168)
 [!/:?]
at 
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1022) 
[!/:?]
at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062)
 [!/:?]
at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998)
 [!/:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 
[?:?]
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
[?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]


Any idea?


Best regards,
Alex soto






DefaultTracer traceBeforeRoute not calling dumpTrace

2020-07-10 Thread Alex Soto
In Camel 3.4.0 I am trying to customize the Tracing to use DEBUG level instead 
of INFO.
For this, I created my own class extending 
org.apache.camel.impl.engine.DefaultTracer  and overriding method dumpTrace.
But dumpTrace is not being called in all cases, in particular, method 
traceBeforeRoute  is not calling it, instead logging directly with INFO level.


Best regards,
Alex soto






Re: Camel-exec issue (script works but returns 1 inside a route)

2020-05-28 Thread Alex Soto
Also, take a look at  org.apache.karaf.itests.KarafTestSupport.executeCommand 
from 

org.apache.karaf.itests
common



Best regards,
Alex soto




> On May 28, 2020, at 9:50 AM, Alex Soto  wrote:
> 
> Hi Gerald,
> 
> There is no "/opt/apache-karaf/bin/user-add” in the default Karaf 
> distribution, AFAIK.
> 
> I think you may want to use the “/opt/apache-karaf/bin/client” script 
> instead, or SSH, or perhaps your best choice is to directly reference the 
> implementation Service as a bean.  I don’t know which service deals with the 
> JAAS subsystem, but I suspect there is one, in which case, you can reference 
> the service, as in:
> 
>interface=“org.apache.karaf.SomeServiceInterface”/>
> 
> 
> Then call “myService” as a bean:
> 
>   
> 
> 
> And avoid interacting with the shell.  I hope this helps.
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On May 23, 2020, at 1:29 AM, Gerald Kallas > <mailto:catsh...@mailbox.org>> wrote:
>> 
>> /opt/apache-karaf/bin/user-add
> 



Re: Camel-exec issue (script works but returns 1 inside a route)

2020-05-28 Thread Alex Soto
Hi Gerald,

There is no "/opt/apache-karaf/bin/user-add” in the default Karaf distribution, 
AFAIK.

I think you may want to use the “/opt/apache-karaf/bin/client” script instead, 
or SSH, or perhaps your best choice is to directly reference the implementation 
Service as a bean.  I don’t know which service deals with the JAAS subsystem, 
but I suspect there is one, in which case, you can reference the service, as in:




Then call “myService” as a bean:




And avoid interacting with the shell.  I hope this helps.

Best regards,
Alex soto




> On May 23, 2020, at 1:29 AM, Gerald Kallas  wrote:
> 
> /opt/apache-karaf/bin/user-add



Re: add/remove JAAS users and roles within a Camel route?

2020-05-21 Thread Alex Soto
One way to do this is to store the user and role directly in the underlying 
storage for the JAAS security context.
For example, in the case of the default “karaf” security context, users and 
roles are stored in the ‘etc/users.properties’ file,  but you may choose to 
store this in a database table, LDAP server,  etc.  
 
Best regards,
Alex soto




> On May 20, 2020, at 3:48 PM, Gerald Kallas  wrote:
> 
> Tx JB.
> 
> So in this case, how can i call the jaas:* service from a Camel route? I did 
> some research but wasn't able to find this ..
> 
> Regards
> - Gerald
> 
>> Jean-Baptiste Onofre  hat am 20. Mai 2020 20:25 
>> geschrieben:
>> 
>> 
>> Hi,
>> 
>> You mean on a JAAS backend ?
>> 
>> JAAS doesn’t provide anything about that. That’s why in Karaf we have the 
>> "backend" service attached to some login modules.
>> In your Camel route, you can interact with these services (as the jaas:* 
>> commands do in Karaf).
>> 
>> Regards
>> JB
>> 
>>> Le 20 mai 2020 à 19:50, Gerald Kallas  a écrit :
>>> 
>>> Hi all,
>>> 
>>> is it possible to add/remove users and roles inside a Camel route 
>>> (Blueprint DSL) or at least w/ a piece of Java code inside a bean?
>>> 
>>> Thanks in advance for any hints
>>> - Gerald



Re: Basic authentication of WAB using Jaas in Karaf

2020-05-18 Thread Alex Soto
Thank you, Grzegorz, this is excellent news! 
I'm looking forward for this to be improved in version 8, as it is very useful, 
and not only for Keycloak.
In particular, for securing Camel Rest services, and perhaps there are many 
other use cases as well.

Best regards,
Alex soto




> On May 18, 2020, at 9:24 AM, Grzegorz Grzybek  wrote:
> 
> Hello
> 
> I have some answer. First, the "http context processing" feature was mainly
> tested to "inject" Keycloak authenticator and I mostly tested it with
> pax-web-undertow.
> 
> But I checked how it works with pax-web-jetty in the debugger.
> 
> The key problem is that when Jetty's SecurityHandler is starting, it tries
> to find/discover org.eclipse.jetty.security.LoginService instance.
> With default etc/jetty.xml, there are TWO beans with
> org.eclipse.jetty.jaas.JAASLoginService class and
> org.eclipse.jetty.security.SecurityHandler#findLoginService() method does
> this:
> 
> else if (list.size() == 1)
>service = list.iterator().next();
> 
> So I simply made it working by ensuring there's only one
> org.eclipse.jetty.jaas.JAASLoginService:
> 
> list = {java.util.ArrayList@9544}  size = 1
> 0 = {org.eclipse.jetty.jaas.JAASLoginService@9547}
> "JAASLoginService@7ba67d0b{STARTED}"
>  LOG: org.eclipse.jetty.util.log.Logger  =
> {org.eclipse.jetty.util.log.Slf4jLog@9549}
> "org.ops4j.pax.logging.slf4j.Slf4jLogger@43ea82d7"
>  DEFAULT_ROLE_CLASS_NAME: java.lang.String  =
> "org.eclipse.jetty.jaas.JAASRole"
>  DEFAULT_ROLE_CLASS_NAMES: java.lang.String[]  =
> {java.lang.String[1]@9551}
>  _roleClassNames: java.lang.String[]  = {java.lang.String[2]@9552}
>  _callbackHandlerClass: java.lang.String  = null
>  _realmName: java.lang.String  = "karaf"
>  _loginModuleName: java.lang.String  = "karaf"
> 
> Now, with your Camel route, I got:
> 
> $ curl -v http://localhost:8181/camel/api/say/hello
> *   Trying ::1:8181...
> * Connected to localhost (::1) port 8181 (#0)
>> GET /camel/api/say/hello HTTP/1.1
>> Host: localhost:8181
>> User-Agent: curl/7.69.1
>> Accept: */*
>> 
> * Mark bundle as not supporting multiuse
> < HTTP/1.1 404 Not Found
> < Cache-Control: must-revalidate,no-cache,no-store
> < Content-Type: text/html;charset=iso-8859-1
> < Content-Length: 456
> < Server: Jetty(9.4.22.v20191022)
> <
> 
> $ curl -v -u karaf:karaf http://localhost:8181/camel/api/say/hello
> *   Trying ::1:8181...
> * Connected to localhost (::1) port 8181 (#0)
> * Server auth using Basic with user 'karaf'
>> GET /camel/api/say/hello HTTP/1.1
>> Host: localhost:8181
>> Authorization: Basic a2FyYWY6a2FyYWY=
>> User-Agent: curl/7.69.1
>> Accept: */*
>> 
> * Mark bundle as not supporting multiuse
> < HTTP/1.1 200 OK
> < Content-Type: application/json
> < Accept: */*
> < Authorization: Basic a2FyYWY6a2FyYWY=
> < breadcrumbId: ID-everfree-forest-1589807499756-0-1
> < User-Agent: curl/7.69.1
> < Transfer-Encoding: chunked
> < Server: Jetty(9.4.22.v20191022)
> <
> * Connection #0 to host localhost left intact
> "Hello World"
> 
> In theory it should be possible to grab (in etc/jetty.xml, using
>  element) instance of SecurityHandler and simply set there the
> "realmName" property to "Karaf", so even with two different beans with
> org.eclipse.jetty.jaas.JAASLoginService class, Jetty would pick up the
> right one. But in Pax Web security handler is part of every
> org.ops4j.pax.web.service.jetty.internal.HttpServiceContext created and
> only in Pax Web 8 I'd be able to fix this in more clean way.
> 
> So, please use only one org.eclipse.jetty.jaas.JAASLoginService in your
> etc/jetty.xml
> 
> regards
> Grzegorz Grzybek
> 
> pon., 18 maj 2020 o 10:25 Achim Nierbeck 
> napisał(a):
> 
>> Hi,
>> 
>> I already also answered Gerald in another mail.
>> I'm not quite sure but what might be an issue, is that the default
>> http-context used in his application isn't bound to the underlying security
>> realm.
>> Therefore it's quite a possibility that there needs to be a configuration
>> done in his own application, using his own http-Context.
>> 
>> Can be found here:
>> 
>> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/authentication/src/main/java/org/ops4j/pax/web/samples/authentication/internal/Activator.java
>> 
>> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/authentication/src/main/java/org/ops4j/pax/web/samples/authentication/AuthHttpContext.java
>> and here:
>> 
>> https://github.com/jgoodyear/A

Re: Basic authentication of WAB using Jaas in Karaf

2020-05-15 Thread Alex Soto
I’m sorry, I don’t know why it's not working; it looks correct to me.  Maybe 
somebody from the Pax-Web team can help you.
The only suspicious thing is the warning:

2020-05-15T18:20:50,256 | WARN  | qtp1611313605-201 | SecurityHandler   
   | 229 - org.eclipse.jetty.util - 9.4.22.v20191022 | No authenticator 
for: {RoleInfo,C[admin],None}


Which suggest something is misconfigured.

Best regards,
Alex soto




> On May 15, 2020, at 2:23 PM, Gerald Kallas  wrote:
> 
> 2020-05-15T18:20:50,256 | WARN  | qtp1611313605-201 | SecurityHandler 
>  | 229 - org.eclipse.jetty.util - 9.4.22.v20191022 | No authenticator 
> for: {RoleInfo,C[admin],None}



Re: Basic authentication of WAB using Jaas in Karaf

2020-05-15 Thread Alex Soto
I’m not sure what is happening, but I noticed, you have ‘basic’ as lowercase, 
maybe it is case sensitive.  Try uppercase:


login.config.authMethod = BASIC


Also, what is in your 'etc/jetty.xml’ and ‘etc/org.ops4j.pax.web.cfg’ files ?

Best regards,
Alex soto




> On May 15, 2020, at 11:22 AM, Gerald Kallas  wrote:
> 
> Hi Alex,
> 
> yes, I'm passing the HTTP "Authorization" header for basic authentication.
> 
> My users.properties looks like
> 
> karaf = xxx,_g_:admingroup
> _g_\:admingroup = group,admin,manager,viewer,systembundles,ssh
> 
> username1 = password1,admin
> 
> I'm testing with the username1 password1 combination, the request looks like
> 
> curl --insecure --location --request GET 
> 'https://localhost:8443/camel/api/say/hello' \
> --header 'Authorization: Basic dXNlcm5hbWUxOnBhc3N3b3JkMQ=='
> 
> With or without the Authorization header I'm always getting a HTTP 403 
> response.
> 
> While trying to access I'm getting a log entry
> 
> 2020-05-15T15:20:34,031 | WARN  | qtp1611313605-186 | SecurityHandler 
>  | 229 - org.eclipse.jetty.util - 9.4.22.v20191022 | No authenticator 
> for: {RoleInfo,C[admin],None}
> 
> Again my org.ops4j.pax.web.context-admin.cfg, it looks like
> 
> bundle.symbolicName=api.xml
> login.config.authMethod=Basic
> login.config.realmName=karaf
> context.id=default
> 
> security.constraint.1.url = /camel/api/*
> security.constraint.1.method = *
> security.constraint.1.roles = admin
> 
> And my route (Blueprint DSL "api.xml") again as well
> 
> http://www.osgi.org/xmlns/blueprint/v1.0.0;
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>   xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
>   https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>
> 
>interface="org.osgi.service.http.HttpService" />
> 
>class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
> 
>init-method="register"
> destroy-method="unregister">
>   
>   
>   
>   
>   
> 
>class="org.apache.camel.component.servlet.ServletComponent" />
> 
>   http://camel.apache.org/schema/blueprint;>
>  component="servlet"
>   bindingMode="json"
>   enableCORS="false"
>   skipBindingOnErrorCode="false"
>   clientRequestValidation="true">
> 
>/>
> 
>   
>/>
> 
>value="false" />
>   
>   
> 
>   
>   
>   
>   
>   
> 
>   
>   
>   
>   Hello World
>   
>   
> 
>   
> 
> 
> 
> Best
> - Gerald
> 
>> Alex Soto  hat am 15. Mai 2020 14:35 geschrieben:
>> 
>> 
>> Are passing the BASIC Authentication header with user name and password?
>> 
>> The user names and roles are defined in the 'etc/users.properties’  file, 
>> check Karaf documentation 
>> https://karaf.apache.org/manual/latest/#_security_2 
>> <https://karaf.apache.org/manual/latest/#_security_2>
>> 
>> 
>> The 'security.constraint.1.* entries' in your file 
>> 'org.ops4j.pax.web.context-admin.cfg’  define the permissions for each 
>> route, just need to add new ones replacing 1 with 2, and so on,   the url 
>> matching the Camel route.
>> 
>> 
>> 
>>> On May 14, 2020, at 5:17 PM, Gerald Kallas  wrote:
>>> 
>>> Thanks Alex,
>>> 
>>> the API now is working after removing the "httpRegistry" part.
>>> 
>>> Now I've the next issue. My org.ops4j.pax.web.context-admin.cfg looks like
>>> 
>>> bundle.symbolicName=api.xml
>>> login.config.authMethod=BASIC
>>> login.config.realmName=karaf
>>> context.id=default
>>> 
>>> security.constraint.1.url = /camel/api/*
>>> security.constraint.1.method = *
>>> security.constraint.1.roles = admin
>>> 
>>> Saving this creates the log file entries as below.
>>> 
>>> The return code with this file is now always a HTTP 403 (forbidden). What 
>>> m

Re: Basic authentication of WAB using Jaas in Karaf

2020-05-15 Thread Alex Soto
xweb-context-4-thread-22 | 
> HttpServiceContext   | 256 - org.ops4j.pax.web.pax-web-jetty - 
> 7.2.11 | registering JasperInitializer
> 2020-05-14T21:15:19,003 | INFO  | paxweb-context-4-thread-22 | 
> CamelHttpTransportServlet| 288 - org.apache.camel.camel-servlet - 
> 3.0.0 | Initialized CamelHttpTransportServlet[name=MyServlet, contextPath=]
> 2020-05-14T21:15:19,003 | INFO  | paxweb-context-4-thread-22 | ContextHandler 
>   | 223 - org.eclipse.jetty.util - 9.4.20.v20190813 | Started 
> HttpServiceContext{httpContext=DefaultHttpContext [bundle=api.xml [326], 
> contextID=default]}
> 
>> Alex Soto  hat am 14. Mai 2020 18:42 geschrieben:
>> 
>> 
>> Looks good to me: '/camel/api/say/hello' should be correct.
>> 
>> The only difference I see is that in my case I am not using the 
>> ‘httpRegistry'; try removing that part.
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>> 
>>> On May 14, 2020, at 12:21 PM, Gerald Kallas  wrote:
>>> Thanks Alex.
>>> 
>>> I'm still struggling upfront. I was copying your example and have combined 
>>> the parts in one Blueprint DSL.
>>> 
>>> See my complete Blueprint DSL file below. I'm always getting a HTTP 404 
>>> (not found).
>>> 
>>> I'm assuming that the URL
>>> 
>>> https://localhost:8443/camel/api/say/hello
>>> 
>>> should be the one to call. Do I still miss something? Many thanks in 
>>> advance.
>>> 
>>> http://www.osgi.org/xmlns/blueprint/v1.0.0;
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>> xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
>>> https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd;>
>>> 
>>> 
>>> 
>>> >> class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
>>> 
>>> >> init-method="register"
>>> destroy-method="unregister">
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> >> class="org.apache.camel.component.servlet.DefaultHttpRegistry" />
>>> 
>>> >> class="org.apache.camel.component.servlet.ServletComponent">
>>> 
>>> 
>>> 
>>> http://camel.apache.org/schema/blueprint;>
>>> >> component="servlet"
>>> bindingMode="json"
>>> enableCORS="false"
>>> skipBindingOnErrorCode="false"
>>> clientRequestValidation="true">
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Hello World
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Best
>>> - Gerald
>>> 
>>> 
>>>> Alex Soto  hat am 14. Mai 2020 14:55 geschrieben:
>>>> 
>>>> 
>>>> Hi Gerald,
>>>> 
>>>> I would put the Servlet in the same bundle; I don’t see the need to 
>>>> separate it for reuse.
>>>> Looks like you are missing security constraint in the 
>>>> 'etc/org.ops4j.pax.web.context-admin.cfg' file
>>>> 
>>>> security.constraint.1.url = /camel/services/*
>>>> security.constraint.1.method = *
>>>> security.constraint.1.roles = admin
>>>> 
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On May 13, 2020, at 7:02 PM, Gerald Kallas  wrote:
>>>>> 
>>>> 
>> 



Re: REST API - Basic Authentication?

2020-05-13 Thread Alex Soto
I found a solution.  See here:


http://karaf.922171.n3.nabble.com/Basic-authentication-of-WAB-using-Jaas-in-Karaf-tp4058251p4058280.html
 
<http://karaf.922171.n3.nabble.com/Basic-authentication-of-WAB-using-Jaas-in-Karaf-tp4058251p4058280.html>



Best regards,
Alex soto




> On May 13, 2020, at 12:57 PM, Jeremy Ross  wrote:
> 
> I discovered that exchange headers are used for HTTP headers. Setting a
> header called `Authorization` on the exchange to `Basic  ":" + pw)>` worked for me.
> 
> On Tue, May 12, 2020 at 11:55 AM Alex Soto  wrote:
> 
>> Hello,
>> 
>> I am facing the same issue,  using Camel Rest DSL on top of Servlet,
>> Blueprint, Karaf, Pax-Web, Jetty, how to add Basic authentication to the
>> Rest endpoints?   Any pointers/examples will be appreciated.
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Feb 4, 2020, at 3:15 AM, Gerald Kallas - mailbox.org <
>> catsh...@mailbox.org> wrote:
>>> 
>>> Tx JB.
>>> 
>>> At the moment I decided to register a servlet to re-use the global Jetty
>> configuration.
>>> 
>>> So where I can find the filter stuff?
>>> 
>>> For best practices ..
>>> 
>>> 1. better to use servlet or camel-jetty?
>>> 2. one servlet for multiple APIs or one dedicated servlet for every API?
>>> 
>>> Best
>>> - Gerald
>>> 
>>>> Am 04.02.2020 um 05:56 schrieb Jean-Baptiste Onofré :
>>>> 
>>>> Hi,
>>>> 
>>>> Not sure I follow (related to your previous message): are you using
>>>> servlet registration or camel-jetty ?
>>>> 
>>>> On camel-jetty, you can define a security handler.
>>>> 
>>>> Using servlet, you can always register a filter.
>>>> 
>>>> Regards
>>>> JB
>>>> 
>>>>> On 03/02/2020 18:34, Gerald Kallas wrote:
>>>>> Dear community,
>>>>> 
>>>>> I've following REST API (see below).
>>>>> 
>>>>> How can I add a Basic Authentication to the REST API in Blueprint DSL?
>> Any hints are highly welcome.
>>>>> 
>>>>> Best
>>>>> - Gerald
>>>>> 
>>>>> Configuration XML ..
>>>>> 
>>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0;>
>>>>> 
>>>>>  > interface="org.osgi.service.http.HttpService"/>
>>>>> 
>>>>>  > class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
>>>>> 
>>>>>  > class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
>>>>>  init-method="register"
>>>>>  destroy-method="unregister">
>>>>>  
>>>>>  
>>>>>  
>>>>>  
>>>>> 
>>>>> 
>>>>> 
>>>>> .. and REST API ..
>>>>> 
>>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0;>
>>>>> 
>>>>>  http://camel.apache.org/schema/blueprint; streamCache="true">
>>>>> 
>>>>>  > contextPath="/api" port="443">
>>>>>  
>>>>>  
>>>>> 
>>>>>  
>>>>>  > id="isp.routes.RST001">
>>>>>  
>>>>>  
>>>>>  > id="isp.routes.RST002">
>>>>>  
>>>>>  
>>>>>  
>>>>> 
>>>>>  
>>>>>  
>>>>>  
>>>>>  application/json
>>>>>  
>>>>>  
>>>>>  {"text": "Hello World"}
>>>>>  
>>>>>  
>>>>> 
>>>>>  
>>>>>  
>>>>>  
>>>>>  application/json
>>>>>  
>>>>>  
>>>>>  {"text": "Bye World"}
>>>>>  
>>>>>  
>>>>> 
>>>>>  
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> --
>>>> Jean-Baptiste Onofré
>>>> jbono...@apache.org
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com
>>> 
>> 
>> 



Re: REST API - Basic Authentication?

2020-05-12 Thread Alex Soto
Hello,

I am facing the same issue,  using Camel Rest DSL on top of Servlet, Blueprint, 
Karaf, Pax-Web, Jetty, how to add Basic authentication to the Rest endpoints?   
Any pointers/examples will be appreciated. 


Best regards,
Alex soto




> On Feb 4, 2020, at 3:15 AM, Gerald Kallas - mailbox.org 
>  wrote:
> 
> Tx JB.
> 
> At the moment I decided to register a servlet to re-use the global Jetty 
> configuration.
> 
> So where I can find the filter stuff?
> 
> For best practices ..
> 
> 1. better to use servlet or camel-jetty?
> 2. one servlet for multiple APIs or one dedicated servlet for every API?
> 
> Best
> - Gerald
> 
>> Am 04.02.2020 um 05:56 schrieb Jean-Baptiste Onofré :
>> 
>> Hi,
>> 
>> Not sure I follow (related to your previous message): are you using
>> servlet registration or camel-jetty ?
>> 
>> On camel-jetty, you can define a security handler.
>> 
>> Using servlet, you can always register a filter.
>> 
>> Regards
>> JB
>> 
>>> On 03/02/2020 18:34, Gerald Kallas wrote:
>>> Dear community,
>>> 
>>> I've following REST API (see below).
>>> 
>>> How can I add a Basic Authentication to the REST API in Blueprint DSL? Any 
>>> hints are highly welcome.
>>> 
>>> Best
>>> - Gerald
>>> 
>>> Configuration XML ..
>>> 
>>> http://www.osgi.org/xmlns/blueprint/v1.0.0;>
>>> 
>>>   >> interface="org.osgi.service.http.HttpService"/>
>>> 
>>>   >> class="org.apache.camel.component.servlet.CamelHttpTransportServlet"/>
>>> 
>>>   >> class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
>>>   init-method="register"
>>>   destroy-method="unregister">
>>>   
>>>   
>>>   
>>>   
>>> 
>>> 
>>> 
>>> .. and REST API ..
>>> 
>>> http://www.osgi.org/xmlns/blueprint/v1.0.0;>
>>> 
>>>   >> xmlns="http://camel.apache.org/schema/blueprint; streamCache="true">
>>> 
>>>   >> contextPath="/api" port="443">
>>>   
>>>   
>>> 
>>>   
>>>   >> id="isp.routes.RST001">
>>>   
>>>   
>>>   >> id="isp.routes.RST002">
>>>   
>>>   
>>>   
>>> 
>>>   
>>>   
>>>   
>>>   application/json
>>>   
>>>   
>>>   {"text": "Hello World"}
>>>   
>>>   
>>> 
>>>   
>>>   
>>>   
>>>   application/json
>>>   
>>>   
>>>   {"text": "Bye World"}
>>>   
>>>   
>>> 
>>>   
>>> 
>>> 
>>> 
>> 
>> -- 
>> Jean-Baptiste Onofré
>> jbono...@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 



Re: Route Tracing with Camel 3.0 and BluePrint

2020-02-13 Thread Alex Soto
Bringing this up again, not getting headers in Camel traces with Blueprint.  
Anybody experiencing the same?


Best regards,
Alex soto




> On Feb 6, 2020, at 9:29 AM, Alex Soto  wrote:
> 
> I’m sorry Guillaume, but I don’t see the similarity, although you may know 
> something I don’t.
> In any case do you know of a workaround?, basically I need to be able to 
> enable tracing of exchange headers (in Blueprint) for troubleshooting, but I 
> have not yet found how.
>   
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Feb 5, 2020, at 11:59 AM, Guillaume Nodet > <mailto:gno...@apache.org>> wrote:
>> 
>> Looks similar to
>> https://issues.apache.org/jira/projects/CAMEL/issues/CAMEL-14462 
>> <https://issues.apache.org/jira/projects/CAMEL/issues/CAMEL-14462>
>> I need to investigate it asap.
>> 
>> Le mer. 5 févr. 2020 à 17:48, Alex Soto  a écrit :
>> 
>>> This used to work with Camel 2.X, now it seems it is ignoring the
>>> settings
>>> 
>>> 
>>>
>>>>> class="org.apache.camel.support.processor.DefaultExchangeFormatter">
>>>>> value="#{camel.trace.showProperties}"/>
>>>>> value="#{camel.trace.showExchangePattern}"/>
>>>>> value="#{camel.trace.showExchangeId}"/>
>>>
>>>
>>>
>>> 
>>>http://camel.apache.org/schema/blueprint;
>>> id="admin" trace=“true”>
>>> 
>>> Specifically, when I set the showHeaders property to true the exchange
>>> headers are still not logged.  Any idea?
>>> 
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> -- 
>> 
>> Guillaume Nodet
> 



Re: Rest DSL Query Params not copied to Exchange Header

2020-02-07 Thread Alex Soto
Thanks Zoran for getting back to me.  

I will take a look at HttpBinding, but certainly this is very confusing. 

From what I have seen, both the Query and Path parameters are being put in 
message headers (good),  but then the filter is removing the query parameters 
(bad) and not the path parameters (good). 


Best regards,
Alex soto




> On Feb 7, 2020, at 1:29 PM, Zoran Regvart  wrote:
> 
> query Hi Alex,
> perhaps I can shed some light on this, the header in header filter
> strategy refers to Camel message headers and external (say HTTP)
> headers. I think (haven't looked at the code) that the query
> parameters are put in the message headers and it seems that the path
> parameters are not. I know it's a bit inconsistent and confusing, I
> think it's also different from how the HTTP producer (client)
> components, or at least the ones created from RestProducerFactory
> work, as far as I remember, both query and path parameters are taken
> from Camel message headers.
> 
> I think you want to create your own HttpBinding to finely tune this
> behaviour. I do think Camel would benefit from improving in this area
> and we could certainly make this a bit clearer and straightforward to
> use.
> 
> zoran
> 
> On Fri, Feb 7, 2020 at 4:00 PM Alex Soto  <mailto:alex.s...@envieta.com>> wrote:
>> 
>> The other inconsistence is that path parameters defined in the Rest DSL are 
>> copied to Exchange headers without any issue, i.e., unaffected by the header 
>> filter strategy.  So we end up with:
>> 
>> Path parameters unaffected by header filter.
>> Query parameters affected by header filter.
>> 
>> I would think both should behave the same way, preferable not being affected 
>> by the header filter strategy.
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Feb 6, 2020, at 4:44 PM, Alex Soto  wrote:
>>> 
>>> Look like it is caused by my:
>>> 
>>>  
>>> 
>>> Which is very strange, since the ones that have default value are not being 
>>> filtered.
>>> 
>>> However my intention (when using the header filter strategy) is to filter 
>>> incoming HTTP request headers,  not to the headers that are copied from the 
>>> query parameters, since this is done by Camel and it is still useful. Is 
>>> there a way to control this?
>>> 
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>> 
>>>> On Feb 6, 2020, at 3:34 PM, Alex Soto >>> <mailto:alex.s...@envieta.com><mailto:alex.s...@envieta.com 
>>>> <mailto:alex.s...@envieta.com>>> wrote:
>>>> 
>>>> Hello:
>>>> 
>>>> Running Camel 3.0.1.  I have a Rest DSL, where Query Params are not being 
>>>> copied to the Exchange
>>>> 
>>>> 
>>>> 
>>>> >>> dataType="int" required="false"/>
>>>> >>> dataType="int" required="false"/>
>>>> >>> dataType="boolean" required="false" defaultValue="false"/>
>>>> >>> dataType="boolean" required="false" defaultValue="false"/>
>>>> >>> dataType="boolean" required="false" defaultValue="false"/>
>>>> >>> dataType="boolean" required="false" defaultValue="false"/>
>>>> >>> dataType="boolean" required="false" defaultValue="false"/>
>>>> >>> dataType="int" required="false"/>
>>>> >>> dataType="int" required="false"/>
>>>> >>> dataType="boolean" required="false" defaultValue="false"/>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> When I send a GET request to  executions?dataSchemaId=100the exchange 
>>>> parameters do not include the dataSchemaId parameter, but it does contain 
>>>> all the other params that have a default value.  The Rest DSL is 
>>>> configured to use Servlet component.  The documentation 
>>>> https://camel.apache.org/manual/latest/rest-dsl.html 
>>>> <https://camel.apache.org/manual/latest/rest-dsl.html><https://camel.apache.org/manual/latest/rest-dsl.html
>>>>  <https://camel.apache.org/manual/latest/rest-dsl.html>> seems to imply 
>>>> that the query parameters are copied to the Exchange headers, but this is 
>>>> not happening.  Any idea?
>>>> 
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>> 
> 
> 
> -- 
> Zoran Regvart



Re: Rest DSL Query Params not copied to Exchange Header

2020-02-07 Thread Alex Soto
The other inconsistence is that path parameters defined in the Rest DSL are 
copied to Exchange headers without any issue, i.e., unaffected by the header 
filter strategy.  So we end up with:

Path parameters unaffected by header filter.
Query parameters affected by header filter.

I would think both should behave the same way, preferable not being affected by 
the header filter strategy.


Best regards,
Alex soto




> On Feb 6, 2020, at 4:44 PM, Alex Soto  wrote:
> 
> Look like it is caused by my:
> 
>   
> 
> Which is very strange, since the ones that have default value are not being 
> filtered.  
> 
> However my intention (when using the header filter strategy) is to filter 
> incoming HTTP request headers,  not to the headers that are copied from the 
> query parameters, since this is done by Camel and it is still useful.   Is 
> there a way to control this?
> 
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Feb 6, 2020, at 3:34 PM, Alex Soto > <mailto:alex.s...@envieta.com>> wrote:
>> 
>> Hello:
>> 
>> Running Camel 3.0.1.  I have a Rest DSL, where Query Params are not being 
>> copied to the Exchange 
>> 
>>  
>> 
>>  > dataType="int" required="false"/>
>>  > dataType="int" required="false"/>
>>  > dataType="boolean" required="false" defaultValue="false"/>
>>  > dataType="boolean" required="false" defaultValue="false"/>
>>  > dataType="boolean" required="false" defaultValue="false"/>
>>  > dataType="boolean" required="false" defaultValue="false"/>
>>  > dataType="boolean" required="false" defaultValue="false"/>
>>  > dataType="int" required="false"/>
>>  > dataType="int" required="false"/>
>>  > dataType="boolean" required="false" defaultValue="false"/>
>>  
>>  
>>  
>>  
>> 
>> 
>> When I send a GET request to  executions?dataSchemaId=100the exchange 
>> parameters do not include the dataSchemaId parameter, but it does contain 
>> all the other params that have a default value.  The Rest DSL is configured 
>> to use Servlet component.  The documentation 
>> https://camel.apache.org/manual/latest/rest-dsl.html 
>> <https://camel.apache.org/manual/latest/rest-dsl.html> seems to imply that 
>> the query parameters are copied to the Exchange headers, but this is not 
>> happening.  Any idea?
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 



Camel Simple type:name.field not working

2020-02-06 Thread Alex Soto
I have this in my route:

${type:java.util.Collections.EMPTY_LIST}

Re: Rest DSL Query Params not copied to Exchange Header

2020-02-06 Thread Alex Soto
Look like it is caused by my:



Which is very strange, since the ones that have default value are not being 
filtered.  

However my intention (when using the header filter strategy) is to filter 
incoming HTTP request headers,  not to the headers that are copied from the 
query parameters, since this is done by Camel and it is still useful.   Is 
there a way to control this?


Best regards,
Alex soto




> On Feb 6, 2020, at 3:34 PM, Alex Soto  wrote:
> 
> Hello:
> 
> Running Camel 3.0.1.  I have a Rest DSL, where Query Params are not being 
> copied to the Exchange 
> 
>   
>  
>dataType="int" required="false"/>
>dataType="int" required="false"/>
>dataType="boolean" required="false" defaultValue="false"/>
>dataType="boolean" required="false" defaultValue="false"/>
>dataType="boolean" required="false" defaultValue="false"/>
>dataType="boolean" required="false" defaultValue="false"/>
>dataType="boolean" required="false" defaultValue="false"/>
>dataType="int" required="false"/>
>dataType="int" required="false"/>
>dataType="boolean" required="false" defaultValue="false"/>
>   
>   
>   
>   
> 
> 
> When I send a GET request to  executions?dataSchemaId=100 the exchange 
> parameters do not include the dataSchemaId parameter, but it does contain all 
> the other params that have a default value.  The Rest DSL is configured to 
> use Servlet component.  The documentation 
> https://camel.apache.org/manual/latest/rest-dsl.html 
> <https://camel.apache.org/manual/latest/rest-dsl.html> seems to imply that 
> the query parameters are copied to the Exchange headers, but this is not 
> happening.  Any idea?
> 
> 
> Best regards,
> Alex soto
> 
> 
> 
> 



Rest DSL Query Params not copied to Exchange Header

2020-02-06 Thread Alex Soto
Hello:

Running Camel 3.0.1.  I have a Rest DSL, where Query Params are not being 
copied to the Exchange 


   
















When I send a GET request to  executions?dataSchemaId=100   the exchange 
parameters do not include the dataSchemaId parameter, but it does contain all 
the other params that have a default value.  The Rest DSL is configured to use 
Servlet component.  The documentation 
https://camel.apache.org/manual/latest/rest-dsl.html 
<https://camel.apache.org/manual/latest/rest-dsl.html> seems to imply that the 
query parameters are copied to the Exchange headers, but this is not happening. 
 Any idea?


Best regards,
Alex soto






Re: SEDA consumer and parallelism

2020-02-06 Thread Alex Soto
The issue is not a-synchronic interaction between the SEDA producer and the 
SEDA consumer, that is fine, I know it is an asynchronous interaction,  but the 
fact that the steps within the SEDA route are not executed in a synchronous 
manner.   i.e. setting the synchronous=true property in the SEDA consumer is 
not causing the desired effect. 

 
Best regards,
Alex soto




> On Feb 6, 2020, at 12:09 PM, WEIQUAN YUAN  wrote:
> 
> as it is known that SEDA component is asyn component, but direct is sync
> one, can you use direct instead of seda?
> 
> On Wed, Jan 29, 2020 at 2:42 PM Alex Soto  wrote:
> 
>> Thanks Claus,
>> 
>> I tested adding synchronous=true to the SEDA consumer, but it does not
>> make any difference.
>> The only thing that worked was to add asyncDelayed=“false” to the delay
>> EIP.
>> Is this perhaps a bug?
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Jan 29, 2020, at 1:48 PM, Claus Ibsen  wrote:
>>> 
>>> On the consumer, eg the from
>>> 
>>> On Wed, Jan 29, 2020 at 5:41 PM Alex Soto  wrote:
>>>> 
>>>> Thanks Claus….
>>>> 
>>>> Oh, I see, after returning from the delay, it is a different thread
>> that processes the rest of the route.
>>>> Where should the synchronous=true be added,  in the Producer or
>> Consumer or both URIs?
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Jan 29, 2020, at 11:13 AM, Claus Ibsen 
>> wrote:
>>>>> 
>>>>> The delay makes it asynchronous, set synchronous=true on the seda
>> endpoint
>>>>> 
>>>>> On Wed, Jan 29, 2020 at 4:52 PM Alex Soto 
>> wrote:
>>>>>> 
>>>>>> Hello,
>>>>>> 
>>>>>> I have a question about SEDA consumer and parallelism.  When I set
>> the concurrentConsumers=1 and send multiple messages in parallel, I expect
>> to see the messages being processed in sequence, but what I see in the logs
>> is that they are being processed in parallel.
>>>>>> 
>>>>>> My route looks more or less like this:
>>>>>> 
>>>>>> 
>>>>>>  > uri=“seda:myconsumer?purgeWhenStopping=trueconcurrentConsumers=1exchangePattern=inOnly”/>
>>>>>>  
>>>>>>   1000
>>>>>>  
>>>>>> 
>>>>>> 
>>>>>> From logs, I can see messages being processed in parallel by this
>> route.  Any idea?
>>>>>> 
>>>>>> (Camel version is 3.0.1)
>>>>>> 
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Claus Ibsen
>>>>> -
>>>>> http://davsclaus.com @davsclaus
>>>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>> 
>>> 
>>> 
>>> --
>>> Claus Ibsen
>>> -
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>> 
>> 
> 
> -- 
> ~
> Weiquan Yuan
> Located in Ottawa, Canada



Re: Route Tracing with Camel 3.0 and BluePrint

2020-02-06 Thread Alex Soto
I’m sorry Guillaume, but I don’t see the similarity, although you may know 
something I don’t.
In any case do you know of a workaround?, basically I need to be able to enable 
tracing of exchange headers (in Blueprint) for troubleshooting, but I have not 
yet found how.
  

Best regards,
Alex soto




> On Feb 5, 2020, at 11:59 AM, Guillaume Nodet  wrote:
> 
> Looks similar to
> https://issues.apache.org/jira/projects/CAMEL/issues/CAMEL-14462
> I need to investigate it asap.
> 
> Le mer. 5 févr. 2020 à 17:48, Alex Soto  a écrit :
> 
>> This used to work with Camel 2.X, now it seems it is ignoring the
>> settings
>> 
>> 
>>
>>> class="org.apache.camel.support.processor.DefaultExchangeFormatter">
>>> value="#{camel.trace.showProperties}"/>
>>> value="#{camel.trace.showExchangePattern}"/>
>>> value="#{camel.trace.showExchangeId}"/>
>>
>>
>>
>> 
>>http://camel.apache.org/schema/blueprint;
>> id="admin" trace=“true”>
>> 
>> Specifically, when I set the showHeaders property to true the exchange
>> headers are still not logged.  Any idea?
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>> 
> 
> -- 
> 
> Guillaume Nodet



Route Tracing with Camel 3.0 and BluePrint

2020-02-05 Thread Alex Soto
This used to work with Camel 2.X, now it seems it is ignoring the settings











http://camel.apache.org/schema/blueprint; id="admin" 
trace=“true”>

Specifically, when I set the showHeaders property to true the exchange headers 
are still not logged.  Any idea?


Best regards,
Alex soto






Re: Blueprint Rest DSL with JSonApi DataFormat

2020-02-04 Thread Alex Soto
So it looks, like Blueprint cannot assign the string class name to the 
JsonApiDataFormat property, which is defined as :

 private Class[] dataFormatTypes;
 ...
 public void setDataFormatTypes(Class[] dataFormatTypes) {
this.dataFormatTypes = dataFormatTypes;
 }

How would you specify an array of classes as required by the data format 
property in Rest DSL restConfiguration  Blueprint XML?




 


Best regards,
Alex soto




> On Feb 4, 2020, at 10:58 AM, Alex Soto  wrote:
> 
> Tried this:
> 
>  bindingMode=“json”>
>   
>   
>  
> 
> 
> 
> Produces error:
> 
> Error binding property (dataFormatTypes=org.my.class.here) with name: 
> dataFormatTypes on bean: 
> org.apache.camel.component.jsonapi.JsonApiDataFormat@409e7690 with value: 
> org.my.class.here
> 
> 
> 
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Feb 4, 2020, at 10:34 AM, Alex Soto > <mailto:alex.s...@envieta.com>> wrote:
>> 
>> Hello,
>> 
>> I am trying to use the JSonApi data format with Camel Rest DSL.  There are 
>> not examples, as far as I know. 
>> So I am configuring it like this:
>> 
>> 
>>  
>> 
>> >  component="servlet"
>>  bindingMode="json"
>>  jsonDataFormat="jsonApi” 
>> 
>> This is not working, the rest service produces 500 error.  Anybody knows how 
>> to set it up correctly or point me to an example?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 



Re: Blueprint Rest DSL with JSonApi DataFormat

2020-02-04 Thread Alex Soto
Tried this:




 



Produces error:

Error binding property (dataFormatTypes=org.my.class.here) with name: 
dataFormatTypes on bean: 
org.apache.camel.component.jsonapi.JsonApiDataFormat@409e7690 with value: 
org.my.class.here




Best regards,
Alex soto




> On Feb 4, 2020, at 10:34 AM, Alex Soto  wrote:
> 
> Hello,
> 
> I am trying to use the JSonApi data format with Camel Rest DSL.  There are 
> not examples, as far as I know. 
> So I am configuring it like this:
> 
> 
>   
> 
>component="servlet"
>   bindingMode="json"
>   jsonDataFormat="jsonApi” 
> 
> This is not working, the rest service produces 500 error.  Anybody knows how 
> to set it up correctly or point me to an example?
> 
> Best regards,
> Alex soto
> 
> 
> 
> 



Blueprint Rest DSL with JSonApi DataFormat

2020-02-04 Thread Alex Soto
Hello,

I am trying to use the JSonApi data format with Camel Rest DSL.  There are not 
examples, as far as I know. 
So I am configuring it like this:





Re: SEDA consumer and parallelism

2020-01-29 Thread Alex Soto
Thanks Claus, 

I tested adding synchronous=true to the SEDA consumer, but it does not make any 
difference. 
The only thing that worked was to add asyncDelayed=“false” to the delay EIP.
Is this perhaps a bug?


Best regards,
Alex soto




> On Jan 29, 2020, at 1:48 PM, Claus Ibsen  wrote:
> 
> On the consumer, eg the from
> 
> On Wed, Jan 29, 2020 at 5:41 PM Alex Soto  wrote:
>> 
>> Thanks Claus….
>> 
>> Oh, I see, after returning from the delay, it is a different thread that 
>> processes the rest of the route.
>> Where should the synchronous=true be added,  in the Producer or Consumer or 
>> both URIs?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Jan 29, 2020, at 11:13 AM, Claus Ibsen  wrote:
>>> 
>>> The delay makes it asynchronous, set synchronous=true on the seda endpoint
>>> 
>>> On Wed, Jan 29, 2020 at 4:52 PM Alex Soto  wrote:
>>>> 
>>>> Hello,
>>>> 
>>>> I have a question about SEDA consumer and parallelism.  When I set the 
>>>> concurrentConsumers=1 and send multiple messages in parallel, I expect to 
>>>> see the messages being processed in sequence, but what I see in the logs 
>>>> is that they are being processed in parallel.
>>>> 
>>>> My route looks more or less like this:
>>>> 
>>>> 
>>>>   >>> uri=“seda:myconsumer?purgeWhenStopping=trueconcurrentConsumers=1exchangePattern=inOnly”/>
>>>>   
>>>>1000
>>>>   
>>>> 
>>>> 
>>>> From logs, I can see messages being processed in parallel by this route.  
>>>> Any idea?
>>>> 
>>>> (Camel version is 3.0.1)
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Claus Ibsen
>>> -
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Re: SEDA consumer and parallelism

2020-01-29 Thread Alex Soto
Thanks Claus…. 

Oh, I see, after returning from the delay, it is a different thread that 
processes the rest of the route.  
Where should the synchronous=true be added,  in the Producer or Consumer or 
both URIs?

Best regards,
Alex soto




> On Jan 29, 2020, at 11:13 AM, Claus Ibsen  wrote:
> 
> The delay makes it asynchronous, set synchronous=true on the seda endpoint
> 
> On Wed, Jan 29, 2020 at 4:52 PM Alex Soto  wrote:
>> 
>> Hello,
>> 
>> I have a question about SEDA consumer and parallelism.  When I set the 
>> concurrentConsumers=1 and send multiple messages in parallel, I expect to 
>> see the messages being processed in sequence, but what I see in the logs is 
>> that they are being processed in parallel.
>> 
>> My route looks more or less like this:
>> 
>> 
>>> uri=“seda:myconsumer?purgeWhenStopping=trueconcurrentConsumers=1exchangePattern=inOnly”/>
>>
>> 1000
>>
>> 
>> 
>> From logs, I can see messages being processed in parallel by this route.  
>> Any idea?
>> 
>> (Camel version is 3.0.1)
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



SEDA consumer and parallelism

2020-01-29 Thread Alex Soto
Hello,

I have a question about SEDA consumer and parallelism.  When I set the 
concurrentConsumers=1 and send multiple messages in parallel, I expect to see 
the messages being processed in sequence, but what I see in the logs is that 
they are being processed in parallel.

My route looks more or less like this:




 1000



From logs, I can see messages being processed in parallel by this route.  Any 
idea?

(Camel version is 3.0.1)

Best regards,
Alex soto






Re: java.lang.NoClassDefFoundError: groovy/lang/Script

2020-01-29 Thread Alex Soto
Thank you JB,

I created a new ticket:

https://issues.apache.org/jira/browse/CAMEL-14457 
<https://issues.apache.org/jira/browse/CAMEL-14457>

Best regards,
Alex soto




> On Jan 29, 2020, at 3:15 AM, Claus Ibsen  wrote:
> 
> On Wed, Jan 29, 2020 at 6:57 AM Jean-Baptiste Onofré  <mailto:j...@nanthrax.net>> wrote:
>> 
>> Hi Alex,
>> 
>> It's what I thought, you are welcome ;)
>> 
>> Not sure if we consider this as an issue in camel-groovy or in usage.
>> 
>> Can you reopen CAMEL-4171 and assign to me ? I will improve the current
>> state.
> 
> No do not reopen old tickets. Create a new ticket.
> 
>> 
>> Thanks,
>> Regards
>> JB
>> 
>> On 28/01/2020 19:51, Alex Soto wrote:
>>> Adding:
>>> 
>>>  DynamicImport-Package:  groovy.*, org.codehaus.groovy.*
>>> 
>>> To my bundle seems to work.
>>> So I suppose this should be added somewhere in a Camel bundle?
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>> 
>>>> On Jan 28, 2020, at 1:29 PM, Alex Soto  wrote:
>>>> 
>>>> This appears to be a regression, as I remember seeing this problem in the 
>>>> past:
>>>> 
>>>> https://issues.apache.org/jira/browse/CAMEL-4171 
>>>> <https://issues.apache.org/jira/browse/CAMEL-4171>
>>>> 
>>>> I will try your suggestion
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Jan 28, 2020, at 1:24 PM, Jean-Baptiste Onofré >>>> <mailto:j...@nanthrax.net>> wrote:
>>>>> 
>>>>> Hi Alex,
>>>>> 
>>>>> It sounds like a classloader issue (two classloaders, the one of
>>>>> camel-groovy bundle and the one of your bundle).
>>>>> 
>>>>> I guess the camel-groovy is actually missing the groovy import.
>>>>> Can you try to enable dynamic import for camel-groovy and your bundle to
>>>>> see if it helps ?
>>>>> 
>>>>> If not, can you please create a Jira and assign to me ?
>>>>> 
>>>>> Thanks
>>>>> Regards
>>>>> JB
>>>>> 
>>>>> On 28/01/2020 19:17, Alex Soto wrote:
>>>>>> Hello,
>>>>>> 
>>>>>> With Camel 3.0.1, I am experiencing this error:
>>>>>> 
>>>>>> java.lang.RuntimeException: java.lang.NoClassDefFoundError: 
>>>>>> groovy/lang/Script
>>>>>>   at 
>>>>>> org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1107)
>>>>>>   at 
>>>>>> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
>>>>>>   at 
>>>>>> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
>>>>>>   at 
>>>>>> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
>>>>>>   at 
>>>>>> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
>>>>>>   at 
>>>>>> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
>>>>>>   at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
>>>>>>   at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
>>>>>>   at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
>>>>>>   at 
>>>>>> org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
>>>>>>   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
>>>>>>   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
>>>>>>   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
>>>>>>   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:272)
>>>>>>   at 
>>>>>> org.apache.camel.language.groovy.GroovyExpression.instantiateScript(GroovyExpression.java:73)
>>>>>>   …
>>>>>> 
>>>>>> 
>>>>>> I am running Camel in Karaf OSGi environment with camel-groovy feature 
>>>>>> installed.  In old Karaf 2.X, I had to install features camel-script, 
>>>>>> and camel-script-groovy, but they are no longer available.
>>>>>> 
>>>>>> 
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> --
>>>>> Jean-Baptiste Onofré
>>>>> jbono...@apache.org <mailto:jbono...@apache.org>
>>>>> http://blog.nanthrax.net
>>>>> Talend - http://www.talend.com
>>>> 
>>> 
>>> 
>> 
>> --
>> Jean-Baptiste Onofré
>> jbono...@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com <http://davsclaus.com/> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2 
> <https://www.manning.com/ibsen2>


Re: java.lang.NoClassDefFoundError: groovy/lang/Script

2020-01-28 Thread Alex Soto
Maybe ticket https://issues.apache.org/jira/browse/CAMEL-4171 
<https://issues.apache.org/jira/browse/CAMEL-4171>  should be reopened, or a 
new one created, not sure. Will leave it to somebody that knows better.


Best regards,
Alex soto




> On Jan 28, 2020, at 1:51 PM, Alex Soto  wrote:
> 
> Adding:
> 
>   DynamicImport-Package:  groovy.*, org.codehaus.groovy.*
> 
> To my bundle seems to work.
> So I suppose this should be added somewhere in a Camel bundle?
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Jan 28, 2020, at 1:29 PM, Alex Soto > <mailto:alex.s...@envieta.com>> wrote:
>> 
>> This appears to be a regression, as I remember seeing this problem in the 
>> past:
>> 
>> https://issues.apache.org/jira/browse/CAMEL-4171 
>> <https://issues.apache.org/jira/browse/CAMEL-4171>
>> 
>> I will try your suggestion
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Jan 28, 2020, at 1:24 PM, Jean-Baptiste Onofré >> <mailto:j...@nanthrax.net>> wrote:
>>> 
>>> Hi Alex,
>>> 
>>> It sounds like a classloader issue (two classloaders, the one of
>>> camel-groovy bundle and the one of your bundle).
>>> 
>>> I guess the camel-groovy is actually missing the groovy import.
>>> Can you try to enable dynamic import for camel-groovy and your bundle to
>>> see if it helps ?
>>> 
>>> If not, can you please create a Jira and assign to me ?
>>> 
>>> Thanks
>>> Regards
>>> JB
>>> 
>>> On 28/01/2020 19:17, Alex Soto wrote:
>>>> Hello,
>>>> 
>>>> With Camel 3.0.1, I am experiencing this error:
>>>> 
>>>> java.lang.RuntimeException: java.lang.NoClassDefFoundError: 
>>>> groovy/lang/Script
>>>>at 
>>>> org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1107)
>>>>at 
>>>> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
>>>>at 
>>>> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
>>>>at 
>>>> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
>>>>at 
>>>> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
>>>>at 
>>>> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
>>>>at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
>>>>at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
>>>>at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
>>>>at 
>>>> org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
>>>>at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
>>>>at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
>>>>at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
>>>>at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:272)
>>>>at 
>>>> org.apache.camel.language.groovy.GroovyExpression.instantiateScript(GroovyExpression.java:73)
>>>>…
>>>> 
>>>> 
>>>> I am running Camel in Karaf OSGi environment with camel-groovy feature 
>>>> installed.  In old Karaf 2.X, I had to install features camel-script, and 
>>>> camel-script-groovy, but they are no longer available.
>>>> 
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> Jean-Baptiste Onofré
>>> jbono...@apache.org <mailto:jbono...@apache.org>
>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>> Talend - http://www.talend.com
>> 
> 



Re: java.lang.NoClassDefFoundError: groovy/lang/Script

2020-01-28 Thread Alex Soto
Adding:

DynamicImport-Package:  groovy.*, org.codehaus.groovy.*

To my bundle seems to work.
So I suppose this should be added somewhere in a Camel bundle?

Best regards,
Alex soto




> On Jan 28, 2020, at 1:29 PM, Alex Soto  wrote:
> 
> This appears to be a regression, as I remember seeing this problem in the 
> past:
> 
> https://issues.apache.org/jira/browse/CAMEL-4171 
> <https://issues.apache.org/jira/browse/CAMEL-4171>
> 
> I will try your suggestion
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Jan 28, 2020, at 1:24 PM, Jean-Baptiste Onofré > <mailto:j...@nanthrax.net>> wrote:
>> 
>> Hi Alex,
>> 
>> It sounds like a classloader issue (two classloaders, the one of
>> camel-groovy bundle and the one of your bundle).
>> 
>> I guess the camel-groovy is actually missing the groovy import.
>> Can you try to enable dynamic import for camel-groovy and your bundle to
>> see if it helps ?
>> 
>> If not, can you please create a Jira and assign to me ?
>> 
>> Thanks
>> Regards
>> JB
>> 
>> On 28/01/2020 19:17, Alex Soto wrote:
>>> Hello,
>>> 
>>> With Camel 3.0.1, I am experiencing this error:
>>> 
>>> java.lang.RuntimeException: java.lang.NoClassDefFoundError: 
>>> groovy/lang/Script
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1107)
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
>>> at 
>>> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
>>> at 
>>> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
>>> at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
>>> at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
>>> at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
>>> at 
>>> org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
>>> at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
>>> at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
>>> at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
>>> at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:272)
>>> at 
>>> org.apache.camel.language.groovy.GroovyExpression.instantiateScript(GroovyExpression.java:73)
>>> …
>>> 
>>> 
>>> I am running Camel in Karaf OSGi environment with camel-groovy feature 
>>> installed.  In old Karaf 2.X, I had to install features camel-script, and 
>>> camel-script-groovy, but they are no longer available.
>>> 
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> -- 
>> Jean-Baptiste Onofré
>> jbono...@apache.org <mailto:jbono...@apache.org>
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 



Re: java.lang.NoClassDefFoundError: groovy/lang/Script

2020-01-28 Thread Alex Soto
This appears to be a regression, as I remember seeing this problem in the past:

https://issues.apache.org/jira/browse/CAMEL-4171 
<https://issues.apache.org/jira/browse/CAMEL-4171>

I will try your suggestion

Best regards,
Alex soto




> On Jan 28, 2020, at 1:24 PM, Jean-Baptiste Onofré  wrote:
> 
> Hi Alex,
> 
> It sounds like a classloader issue (two classloaders, the one of
> camel-groovy bundle and the one of your bundle).
> 
> I guess the camel-groovy is actually missing the groovy import.
> Can you try to enable dynamic import for camel-groovy and your bundle to
> see if it helps ?
> 
> If not, can you please create a Jira and assign to me ?
> 
> Thanks
> Regards
> JB
> 
> On 28/01/2020 19:17, Alex Soto wrote:
>> Hello,
>> 
>> With Camel 3.0.1, I am experiencing this error:
>> 
>> java.lang.RuntimeException: java.lang.NoClassDefFoundError: 
>> groovy/lang/Script
>>  at 
>> org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1107)
>>  at 
>> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
>>  at 
>> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
>>  at 
>> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
>>  at 
>> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
>>  at 
>> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
>>  at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
>>  at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
>>  at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
>>  at 
>> org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
>>  at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
>>  at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
>>  at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
>>  at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:272)
>>  at 
>> org.apache.camel.language.groovy.GroovyExpression.instantiateScript(GroovyExpression.java:73)
>>  …
>> 
>> 
>> I am running Camel in Karaf OSGi environment with camel-groovy feature 
>> installed.  In old Karaf 2.X, I had to install features camel-script, and 
>> camel-script-groovy, but they are no longer available.
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com



java.lang.NoClassDefFoundError: groovy/lang/Script

2020-01-28 Thread Alex Soto
Hello,

With Camel 3.0.1, I am experiencing this error:

java.lang.RuntimeException: java.lang.NoClassDefFoundError: groovy/lang/Script
at 
org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1107)
at 
org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
at 
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:634)
at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:612)
at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:589)
at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
at 
org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:320)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:262)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:272)
at 
org.apache.camel.language.groovy.GroovyExpression.instantiateScript(GroovyExpression.java:73)
…


I am running Camel in Karaf OSGi environment with camel-groovy feature 
installed.  In old Karaf 2.X, I had to install features camel-script, and 
camel-script-groovy, but they are no longer available.


Best regards,
Alex soto






Re: org.apache.camel.NoSuchLanguageException: No language could be found for: simple

2020-01-27 Thread Alex Soto
Thank you, Claus,

It worked now, here is the relevant fragment:


itCamelContext = new OsgiDefaultCamelContext(bundleContext);
itCamelContext.addComponent("http", new HttpComponent());
itCamelContext.setTracing(true);
itCamelContext.setStreamCaching(true);
itCamelContext.setName(this.getClass().getSimpleName());
itCamelContext.setClassResolver(new 
OsgiClassResolver(itCamelContext, bundleContext));
itCamelContext.setLanguageResolver(new 
OsgiLanguageResolver(bundleContext));
itCamelContext.setDataFormatResolver(new 
OsgiDataFormatResolver(bundleContext));
Language simple = itCamelContext.resolveLanguage("simple");
assertNotNull(simple);



Best regards,
Alex soto




> On Jan 25, 2020, at 3:29 AM, Claus Ibsen  wrote:
> 
> You need to use OsgiCamelContext.
> 
> And also for osgi then when you do all of this manually you are on your own.
> Out of the box its only camel-blueprint that is supported that bootstrap 
> Camel.
> 
> 
> On Fri, Jan 24, 2020 at 10:18 PM Alex Soto  <mailto:alex.s...@envieta.com>> wrote:
>> 
>> Migrating to Camel 3.0.1 from (2.X), I have being going over the migration 
>> documentation here: 
>> https://github.com/apache/camel/blob/master/docs/user-manual/modules/ROOT/pages/camel-3-migration-guide.adoc
>>  
>> <https://github.com/apache/camel/blob/master/docs/user-manual/modules/ROOT/pages/camel-3-migration-guide.adoc><https://github.com/apache/camel/blob/master/docs/user-manual/modules/ROOT/pages/camel-3-migration-guide.adoc
>>  
>> <https://github.com/apache/camel/blob/master/docs/user-manual/modules/ROOT/pages/camel-3-migration-guide.adoc>>,
>>  but now my integration is failing with:
>> 
>> org.apache.camel.NoSuchLanguageException: No language could be found for: 
>> simple
>>at 
>> org.apache.camel.impl.engine.DefaultLanguageResolver.noSpecificLanguageFound(DefaultLanguageResolver.java:92)
>>at 
>> org.apache.camel.impl.engine.DefaultLanguageResolver.resolveLanguage(DefaultLanguageResolver.java:68)
>>at 
>> org.apache.camel.impl.engine.AbstractCamelContext.resolveLanguage(AbstractCamelContext.java:1635)
>> 
>> This is a very simple code setting up a Camel context:
>> 
>>itCamelContext = new DefaultCamelContext();
>>itCamelContext.addComponent("http", new HttpComponent());
>>itCamelContext.setTracing(true);
>>itCamelContext.setStreamCaching(true);
>>itCamelContext.setName(this.getClass().getSimpleName());
>>itCamelContext.setClassResolver(new 
>> OsgiClassResolver(itCamelContext, bundleContext));
>>Language simple = itCamelContext.resolveLanguage("simple");
>>assertNotNull(simple);
>> 
>> 
>> Why would this happen?  Isn’t the Simple language part of the core anymore?  
>> FYI:  I am running as part of an OSGi environment (Karaf)
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com <http://davsclaus.com/> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2 
> <https://www.manning.com/ibsen2>


org.apache.camel.NoSuchLanguageException: No language could be found for: simple

2020-01-24 Thread Alex Soto
Migrating to Camel 3.0.1 from (2.X), I have being going over the migration 
documentation here: 
https://github.com/apache/camel/blob/master/docs/user-manual/modules/ROOT/pages/camel-3-migration-guide.adoc
 
<https://github.com/apache/camel/blob/master/docs/user-manual/modules/ROOT/pages/camel-3-migration-guide.adoc>,
 but now my integration is failing with:

org.apache.camel.NoSuchLanguageException: No language could be found for: simple
at 
org.apache.camel.impl.engine.DefaultLanguageResolver.noSpecificLanguageFound(DefaultLanguageResolver.java:92)
at 
org.apache.camel.impl.engine.DefaultLanguageResolver.resolveLanguage(DefaultLanguageResolver.java:68)
at 
org.apache.camel.impl.engine.AbstractCamelContext.resolveLanguage(AbstractCamelContext.java:1635)

This is a very simple code setting up a Camel context:

itCamelContext = new DefaultCamelContext();
itCamelContext.addComponent("http", new HttpComponent());
itCamelContext.setTracing(true);
itCamelContext.setStreamCaching(true);
itCamelContext.setName(this.getClass().getSimpleName());
itCamelContext.setClassResolver(new 
OsgiClassResolver(itCamelContext, bundleContext));
Language simple = itCamelContext.resolveLanguage("simple");
assertNotNull(simple);


Why would this happen?  Isn’t the Simple language part of the core anymore?  
FYI:  I am running as part of an OSGi environment (Karaf)

Best regards,
Alex soto






Rest DSL, Servlet, Jetty, Multi part file upload

2019-03-25 Thread Alex Soto
Hello,

Using Camel version 2.21.1,  I need to process file upload from a multi part 
form web UI.  My setup is as follows:











   







My uploadHandler bean

public void processUpload(Exchange exchange) throws Exception {
Map attachments = 
exchange.getIn().getAttachments();
if (attachments.size() == 0) {
log.warn("No attachments found!");
} else {
for (String key : attachments.keySet()) {
log.info("Filename: " + key);
}
}
}


My integration test:


Part[] parts = {new StringPart("comment", “File to upload"),
new FilePart(outPath.getFileName().toString(), 
outPath.toFile())};

MultipartRequestEntity entity = new 
MultipartRequestEntity(parts, new HttpMethodParams());
HttpClient httpclient = new HttpClient();
PutMethod httppost = new 
PutMethod("http://localhost:8182/api/rest/offline/datasources;);
httppost.setRequestEntity(entity);
int status = httpclient.executeMethod(httppost);


The problem is that upload handler never receives any attachments.  Any help 
would be appreciated.

Best regards,
Alex soto






Re: Custom data format, OSGi, Blueprint, Rest DSL, Bundle is waiting for dependencies

2019-03-12 Thread Alex Soto
I have solved this problem by adding file: 

/META-INF/services/org/apache/camel/dataformat/JacksonDFWithDynamicViews

With content:

class=org.xx.JacksonDFWithDynamicViews

Camel will find and register the Data Schema, but there is a caveat. The bundle 
needs to have visibility of package “org.apache.camel.spi”. Found this by 
looking in Camel “org.apache.camel.impl.osgi.Activator” class, which has this:


 protected void registerDataFormats(Bundle bundle, List resolvers) 
{
if (canSee(bundle, DataFormat.class)) {

In my case, it was not working, because my custom Data Format is extending 
JacksonDataFormat, the bundle did not import package “org.apache.camel.spi”, so 
Camel was ignoring it.  Forcing the bundle to import “org.apache.camel.spi”. 
Since I am using BND, I added:

Import-Package: \
org.apache.camel.spi, \
*

And now the Data Format is properly registered.



Best regards,
Alex soto




> On Mar 12, 2019, at 10:44 AM, Alex Soto  wrote:
> 
> Hello,
> 
> I am trying to use a custom Data Format with Camel Rest DSL in an OSGi 
> container (Karaf) but the bundle fails to initialize with error:
> 
> 
> Bundle  is waiting for dependencies 
> [(&(dataformat=JacksonDFWithDynamicViews)(objectClass=org.apache.camel.spi.DataFormatResolver))]
> 
> 
> I am instantiating the data format class as a Blueprint bean:
> 
> 
> 
> 
> 
> Then, in my Camel Context I register the custom data format:
> 
>   
>   
>   
> 
> Which I then reference in the Rest DSL configuration:
> 
>component="servlet"
>   bindingMode="json"
>   jsonDataFormat="JacksonDFWithDynamicViews"
>   contextPath="{{context.path}}{{api.root.path}}" 
>   port="{{port}}"
>   enableCORS="false">
> 
> 
> 
> Any idea of what is going on here?
> 
> Best regards,
> Alex soto
> 
> 
> 
> 



Custom data format, OSGi, Blueprint, Rest DSL, Bundle is waiting for dependencies

2019-03-12 Thread Alex Soto
Hello,

I am trying to use a custom Data Format with Camel Rest DSL in an OSGi 
container (Karaf) but the bundle fails to initialize with error:


Bundle  is waiting for dependencies 
[(&(dataformat=JacksonDFWithDynamicViews)(objectClass=org.apache.camel.spi.DataFormatResolver))]


I am instantiating the data format class as a Blueprint bean:





Then, in my Camel Context I register the custom data format:

  

  

Which I then reference in the Rest DSL configuration:





Any idea of what is going on here?

Best regards,
Alex soto






Rest DSL XML Binding SAX Parse Exception

2018-08-28 Thread Alex Soto
My Rest Service fails to parse the input XML with error:

SAXParseException2; lineNumber: 2; columnNumber: 1; unexpected element 
(uri:”http://tempuri.org;, local:"execution"). Expected elements are (none)]

















The client is posting this payload:

http://tempuri.org; >
2018-08-29T10:35:55.577-04:00
cXVlcnkgYnl0ZXM=


The jaxb classes in package org.test.schema are generated with 
maven-jaxb2-plugin, so the package contains ObjectFactory and all proper 
annotations.
What else does Camel need to properly bind the XML to the Java class?
Why is it not parsing the XML correctly?

 
Best regards,
Alex soto






Re: Empty/null response from netty4-http template producer

2018-03-28 Thread Alex Soto
Created issue : https://issues.apache.org/jira/browse/CAMEL-12414 
<https://issues.apache.org/jira/browse/CAMEL-12414>

Best regards,
Alex soto

> On Mar 28, 2018, at 12:46 PM, Alex Soto <alex.s...@envieta.com> wrote:
> 
> Anybody has any insight on what may be happening?  Should I submit a Jira 
> ticket?
> 
> Best regards,
> Alex soto
> 
> 
> 
>> On Mar 27, 2018, at 3:18 AM, Owain McGuire <owain@integration.technology> 
>> wrote:
>> 
>> Alex,
>> 
>> Just had a quick look.  
>> 
>> The post in the Rest DSL route goes to direct:echo-route but your echo-route 
>> does not have a "from direct:echo-route". My understanding is that the REST 
>> DSL generates a route that will have already consumed the POST and then once 
>> it has sent the exchange to the direct:echo-route it thinks it has just 
>> finished.  Hence returns with no body.  echo-route never receives an 
>> exchange.
>> 
>> O.
>> 
>> 
>>> On 26 Mar 2018, at 18:51, Alex Soto <alex.s...@envieta.com> wrote:
>>> 
>>> Hello,
>>> 
>>> I have put a simple project that demonstrates this problem.  This does not 
>>> appear to be related to stream caching, as I have enable stream caching in 
>>> both Camel contexts.
>>> 
>>> https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master 
>>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master> 
>>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master 
>>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master>>
>>> 
>>> Can anybody take a look and let me know what I am doing wrong?
>>> 
>>> Thanks and best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>>> On Feb 22, 2018, at 5:42 PM, Alex Soto <alex.s...@envieta.com 
>>>> <mailto:alex.s...@envieta.com>> wrote:
>>>> 
>>>> Hello,
>>>> 
>>>> I am having some problems migrating to Camel 2.20.2 from 2.17.4.This 
>>>> has been working before, but now the response is null.
>>>> I have access to the server logs and everything there looks good, i.e., 
>>>> the server is sending a response, but client is unable to get it.
>>>> Here is the client code:
>>>> 
>>>>SimpleRegistry registry = new SimpleRegistry();
>>>>registry.put("sslParams", sslContextParams);
>>>> 
>>>>DefaultCamelContext defaultCamelContext = new 
>>>> DefaultCamelContext(registry);
>>>>defaultCamelContext.addComponent("netty4-http", new 
>>>> NettyHttpComponent());
>>>>defaultCamelContext.setTracing(true);
>>>>defaultCamelContext.setName("itest");
>>>>defaultCamelContext.setStreamCaching(true);
>>>>defaultCamelContext.start();
>>>> 
>>>>ProducerTemplate producerTemplate = 
>>>> defaultCamelContext.createProducerTemplate();
>>>>producerTemplate.start();
>>>> 
>>>>final BytesAndDecParams requestMessage = makeEnrolCertRequest();
>>>> 
>>>>byte[] response = producerTemplate.requestBody(
>>>>
>>>> "netty4-http:https://localhost:8895/service?sslContextParameters=#sslParams=true
>>>>  <https://localhost:8895/service?sslContextParameters=#sslParams=true> 
>>>> <https://localhost:8895/service?sslContextParameters=#sslParams=true 
>>>> <https://localhost:8895/service?sslContextParameters=#sslParams=true>>",
>>>>requestMessage.message,
>>>>byte[].class);
>>>> 
>>>>assertNotNull(response);
>>>> 
>>>> 
>>>> I appreciate any help with this problem.
>>>> Best regards,
>>>> Alex soto
>> 
> 



Re: Empty/null response from netty4-http template producer

2018-03-28 Thread Alex Soto
Anybody has any insight on what may be happening?  Should I submit a Jira 
ticket?

Best regards,
Alex soto



> On Mar 27, 2018, at 3:18 AM, Owain McGuire <owain@integration.technology> 
> wrote:
> 
> Alex,
> 
> Just had a quick look.  
> 
> The post in the Rest DSL route goes to direct:echo-route but your echo-route 
> does not have a "from direct:echo-route". My understanding is that the REST 
> DSL generates a route that will have already consumed the POST and then once 
> it has sent the exchange to the direct:echo-route it thinks it has just 
> finished.  Hence returns with no body.  echo-route never receives an exchange.
> 
> O.
> 
> 
>> On 26 Mar 2018, at 18:51, Alex Soto <alex.s...@envieta.com> wrote:
>> 
>> Hello,
>> 
>> I have put a simple project that demonstrates this problem.  This does not 
>> appear to be related to stream caching, as I have enable stream caching in 
>> both Camel contexts.
>> 
>> https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master 
>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master> 
>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master 
>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master>>
>> 
>> Can anybody take a look and let me know what I am doing wrong?
>> 
>> Thanks and best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Feb 22, 2018, at 5:42 PM, Alex Soto <alex.s...@envieta.com 
>>> <mailto:alex.s...@envieta.com>> wrote:
>>> 
>>> Hello,
>>> 
>>> I am having some problems migrating to Camel 2.20.2 from 2.17.4.This 
>>> has been working before, but now the response is null.
>>> I have access to the server logs and everything there looks good, i.e., the 
>>> server is sending a response, but client is unable to get it.
>>> Here is the client code:
>>> 
>>> SimpleRegistry registry = new SimpleRegistry();
>>> registry.put("sslParams", sslContextParams);
>>> 
>>> DefaultCamelContext defaultCamelContext = new 
>>> DefaultCamelContext(registry);
>>> defaultCamelContext.addComponent("netty4-http", new 
>>> NettyHttpComponent());
>>> defaultCamelContext.setTracing(true);
>>> defaultCamelContext.setName("itest");
>>> defaultCamelContext.setStreamCaching(true);
>>> defaultCamelContext.start();
>>> 
>>> ProducerTemplate producerTemplate = 
>>> defaultCamelContext.createProducerTemplate();
>>> producerTemplate.start();
>>> 
>>> final BytesAndDecParams requestMessage = makeEnrolCertRequest();
>>> 
>>> byte[] response = producerTemplate.requestBody(
>>> 
>>> "netty4-http:https://localhost:8895/service?sslContextParameters=#sslParams=true
>>>  <https://localhost:8895/service?sslContextParameters=#sslParams=true> 
>>> <https://localhost:8895/service?sslContextParameters=#sslParams=true 
>>> <https://localhost:8895/service?sslContextParameters=#sslParams=true>>",
>>> requestMessage.message,
>>> byte[].class);
>>> 
>>> assertNotNull(response);
>>> 
>>> 
>>> I appreciate any help with this problem.
>>> Best regards,
>>> Alex soto
> 



Re: Empty/null response from netty4-http template producer

2018-03-27 Thread Alex Soto
Owain,

Thank you for taking a look.  You are right, I made a mistake while preparing 
this stripped down project.   The truth is that the Rest DSL is actually not 
needed to reproduce this particular issue, so I have now removed the Rest DSL 
and kept only a single route consuming from Netty-HTTP endpoint.  Still, the 
problem persists.   I can see the route traces in the logs, so it appears the 
route is being called, and returning a payload:


>>> (echo-route) from(http://127.0.0.1:8080/echo) --> setBody[Simple: ${body}] 
>>> <<< Pattern:InOut,
>>> (echo-route) setBody[Simple: ${body}] --> setHeader[Content-Type, 
>>> application/octet-stream] <<< Pattern:InOut,
populateCamelHeaders: 
HttpObjectAggregator$AggregatedFullHttpResponse(decodeResult: success, version: 
HTTP/1.1, content: CompositeByteBuf(ridx: 0, widx: 38, cap: 38, components=1))
HTTP/1.1 200 OK
content-length: 38
content-type: application/octet-stream
connection: keep-alive

I have looked into the unit tests in Camel source, which are doing something 
similar and it works there, so I can’t figure out why it wouldn’t work for me.  
Can you take a took now?


Best regards,
Alex soto



> On Mar 27, 2018, at 3:18 AM, Owain McGuire <owain@integration.technology> 
> wrote:
> 
> Alex,
> 
> Just had a quick look.  
> 
> The post in the Rest DSL route goes to direct:echo-route but your echo-route 
> does not have a "from direct:echo-route". My understanding is that the REST 
> DSL generates a route that will have already consumed the POST and then once 
> it has sent the exchange to the direct:echo-route it thinks it has just 
> finished.  Hence returns with no body.  echo-route never receives an exchange.
> 
> O.
> 
> 
>> On 26 Mar 2018, at 18:51, Alex Soto <alex.s...@envieta.com> wrote:
>> 
>> Hello,
>> 
>> I have put a simple project that demonstrates this problem.  This does not 
>> appear to be related to stream caching, as I have enable stream caching in 
>> both Camel contexts.
>> 
>> https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master 
>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master> 
>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master 
>> <https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master>>
>> 
>> Can anybody take a look and let me know what I am doing wrong?
>> 
>> Thanks and best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Feb 22, 2018, at 5:42 PM, Alex Soto <alex.s...@envieta.com 
>>> <mailto:alex.s...@envieta.com>> wrote:
>>> 
>>> Hello,
>>> 
>>> I am having some problems migrating to Camel 2.20.2 from 2.17.4.This 
>>> has been working before, but now the response is null.
>>> I have access to the server logs and everything there looks good, i.e., the 
>>> server is sending a response, but client is unable to get it.
>>> Here is the client code:
>>> 
>>> SimpleRegistry registry = new SimpleRegistry();
>>> registry.put("sslParams", sslContextParams);
>>> 
>>> DefaultCamelContext defaultCamelContext = new 
>>> DefaultCamelContext(registry);
>>> defaultCamelContext.addComponent("netty4-http", new 
>>> NettyHttpComponent());
>>> defaultCamelContext.setTracing(true);
>>> defaultCamelContext.setName("itest");
>>> defaultCamelContext.setStreamCaching(true);
>>> defaultCamelContext.start();
>>> 
>>> ProducerTemplate producerTemplate = 
>>> defaultCamelContext.createProducerTemplate();
>>> producerTemplate.start();
>>> 
>>> final BytesAndDecParams requestMessage = makeEnrolCertRequest();
>>> 
>>> byte[] response = producerTemplate.requestBody(
>>> 
>>> "netty4-http:https://localhost:8895/service?sslContextParameters=#sslParams=true
>>>  <https://localhost:8895/service?sslContextParameters=#sslParams=true> 
>>> <https://localhost:8895/service?sslContextParameters=#sslParams=true 
>>> <https://localhost:8895/service?sslContextParameters=#sslParams=true>>",
>>> requestMessage.message,
>>> byte[].class);
>>> 
>>> assertNotNull(response);
>>> 
>>> 
>>> I appreciate any help with this problem.
>>> Best regards,
>>> Alex soto
> 



Re: Empty/null response from netty4-http template producer

2018-03-26 Thread Alex Soto
Hello,

I have put a simple project that demonstrates this problem.  This does not 
appear to be related to stream caching, as I have enable stream caching in both 
Camel contexts.

https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master 
<https://github.com/lexsoto/camel-karaf-netty-producer-test/tree/master>

Can anybody take a look and let me know what I am doing wrong?

Thanks and best regards,
Alex soto



> On Feb 22, 2018, at 5:42 PM, Alex Soto <alex.s...@envieta.com> wrote:
> 
> Hello,
> 
> I am having some problems migrating to Camel 2.20.2 from 2.17.4.This has 
> been working before, but now the response is null.
> I have access to the server logs and everything there looks good, i.e., the 
> server is sending a response, but client is unable to get it.
> Here is the client code:
> 
>   SimpleRegistry registry = new SimpleRegistry();
>   registry.put("sslParams", sslContextParams);
> 
>   DefaultCamelContext defaultCamelContext = new 
> DefaultCamelContext(registry);
>   defaultCamelContext.addComponent("netty4-http", new 
> NettyHttpComponent());
>   defaultCamelContext.setTracing(true);
>   defaultCamelContext.setName("itest");
>   defaultCamelContext.setStreamCaching(true);
>   defaultCamelContext.start();
> 
>   ProducerTemplate producerTemplate = 
> defaultCamelContext.createProducerTemplate();
>   producerTemplate.start();
> 
>   final BytesAndDecParams requestMessage = makeEnrolCertRequest();
> 
>   byte[] response = producerTemplate.requestBody(
>   
> "netty4-http:https://localhost:8895/service?sslContextParameters=#sslParams=true
>  <https://localhost:8895/service?sslContextParameters=#sslParams=true>",
>   requestMessage.message,
>   byte[].class);
> 
>   assertNotNull(response);
> 
> 
> I appreciate any help with this problem.
> Best regards,
> Alex soto
> 
> 



Camel Blueprint property not found in SSLContextParameters

2018-03-16 Thread Alex Soto
Hello,

I am trying to migrate to Camel 2.21.0.  I have two separate OSGi Blueprint 
bundles, lets call them A, and B.
Bundle A's blueprint XML creates and exports a 
org.apache.camel.util.jsse.SSLContextParameters as an OSGi service :
























   


Notice the sslParams is defined using property placeholders for which default 
values are provided in the same Bundle A.
Now in Bundle B, I import the sslParams:



When I deploy my application (Karaf), I get exception during  Bundle 2 
initialization:

Caused by: java.lang.IllegalArgumentException: Property with key 
[keystore.password] not found in properties from text: {{keystore.password}}
at 
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.getPropertyValue(DefaultPropertiesParser.java:270)
 ~[?:?]
at 
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:156)
 ~[?:?]
at 
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:115)
 ~[?:?]
at 
org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:99)
 ~[?:?]
at 
org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:62)
 ~[?:?]
at 
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:235)
 ~[?:?]
at 
org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:178)
 ~[?:?]
at 
org.apache.camel.impl.DefaultCamelContext.resolvePropertyPlaceholders(DefaultCamelContext.java:2550)
 ~[?:?]
at 
org.apache.camel.util.jsse.JsseParameters.parsePropertyValue(JsseParameters.java:74)
 ~[?:?]
... 42 more


Of course, Bundle B does not know about these configuration properties, since 
they are defined in Bundle A.  The bean should have been resolved, created and 
exported by Bundle A before it is imported by Bundle B, but it looks as if it 
is bundle B the one doing the property lookup.   This was working fine in Camel 
2.17.4.  Any idea?

Best regards,
Alex soto





Re: Blueprint, property-place-holder error name is already instanciated as null and cannot be removed

2018-02-23 Thread Alex Soto
Thank you Grzegorz,  but I was using Camel 2.20.2, so I think it already 
contains your fix.

Best regards,
Alex soto


> On Feb 23, 2018, at 2:07 PM, Grzegorz Grzybek <gr.grzy...@gmail.com> wrote:
> 
> Hello
> 
> Please check https://issues.apache.org/jira/browse/CAMEL-12251
> There's a problem recently fixed in Camel. CamelNamespaceHandler registers
> two ComponentRegistryProcessors, which (not that correctly) instantiate
> blueprint beans for: components, languages and dataformats. When such
> component bean (e.g., jms for ActiveMQ using ${port} as placeholder) has
> problem (e.g., property not yet available in CM and there's actual
> exception like "can't convert '${port}' to integer"), Camel HIDES THE
> EXCEPTION, or rather prints it at TRACE level.
> 
> So either you use my fix for CAMEL-12251, or you set TRACE level for
> org.apache.camel.blueprint logger.
> 
> regards
> Grzegorz Grzybek
> 
> 2018-02-23 19:49 GMT+01:00 Guillaume Nodet <gno...@apache.org>:
> 
>> Could you please raise a JIRA with the needed information and patch ?
>> 
>> 2018-02-23 19:03 GMT+01:00 Alex Soto <alex.s...@envieta.com>:
>> 
>>> Thank you Guillaume,
>>> 
>>> You are correct,  I tried your suggestion locally and it does work.
>>> I don’t know what are the potential side effects of this change though.
>>> Probably better that somebody more familiar with this code takes a look
>>> and fixes it.
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>>> On Feb 23, 2018, at 12:04 PM, Guillaume Nodet <gno...@apache.org>
>> wrote:
>>>> 
>>>> As I indicated on the Karaf mailing list, I suspect the problem comes
>>> from
>>>> 
>>>> https://github.com/apache/camel/blob/master/components/
>>> camel-blueprint/src/main/java/org/apache/camel/blueprint/
>>> handler/CamelNamespaceHandler.java#L1056
>>>> 
>>>> I think it should call getComponent(component, false) instead to ensure
>>> the
>>>> component is not created eagerly.
>>>> 
>>>> The reason is that the exception is saying that the processor (the
>>> property
>>>> placeholder) can't process the bean because it has been already
>>>> instantiated.  And that call could be the culprit as the OSGi camel
>>> context
>>>> may attempt to create the component.
>>>> 
>>>> That could break the original intent though, in which case, we'd need
>> to
>>> go
>>>> to the blueprint container and check if the component is available
>>> without
>>>> creating it.
>>>> 
>>>> Guillaume
>>>> 
>>>> 
>>>> 2018-02-23 17:55 GMT+01:00 Quinn Stevenson <
>> qu...@pronoia-solutions.com
>>>> :
>>>> 
>>>>> That makes more sense :-)
>>>>> 
>>>>> When I’ve seen this kind of stuff before, it’s usually that the
>>>>> initialization of bean that is a dependency of another bean fails.  I
>>> start
>>>>> at the first exception I see - that usually points me to the right
>>> place.
>>>>> 
>>>>> In this case, it’s acting like it can’t find a setter for the correct
>>> type
>>>>> - maybe that changed across Camel versions?
>>>>> 
>>>>>> On Feb 23, 2018, at 6:49 AM, Alex Soto <alex.s...@envieta.com>
>> wrote:
>>>>>> 
>>>>>> The actual code is well-formed, this was just error formatting the
>> code
>>>>> for the post.  I’ll try again:
>>>>>> 
>>>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0;
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>>>>> xmlns:camel="http://camel.apache.org/schema/blueprint;
>>>>>> xmlns:cm="http://aries.apache.
>>>>> org/blueprint/xmlns/blueprint-cm/v1.1.0"
>>>>>> xmlns:ext="http://aries.apache.org/blueprint/xmlns/
>>>>> blueprint-ext/v1.0.0"
>>>>>> xsi:schemaLocation="
>>>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0
>>>>>> https://www.osgi.org/xmlns/
>>>>> blueprint/v1.0.0/blueprint.xsd”>
>>>>>> 
>>>>>> >>>>> update-strategy="reload”
>&

Re: Blueprint, property-place-holder error name is already instanciated as null and cannot be removed

2018-02-23 Thread Alex Soto
I just created  a ticket for this issue:

https://issues.apache.org/jira/browse/CAMEL-12291 
<https://issues.apache.org/jira/browse/CAMEL-12291>

Feel free to amend if necessary.

Best regards,
Alex soto



> On Feb 23, 2018, at 2:07 PM, Grzegorz Grzybek <gr.grzy...@gmail.com> wrote:
> 
> Hello
> 
> Please check https://issues.apache.org/jira/browse/CAMEL-12251
> There's a problem recently fixed in Camel. CamelNamespaceHandler registers
> two ComponentRegistryProcessors, which (not that correctly) instantiate
> blueprint beans for: components, languages and dataformats. When such
> component bean (e.g., jms for ActiveMQ using ${port} as placeholder) has
> problem (e.g., property not yet available in CM and there's actual
> exception like "can't convert '${port}' to integer"), Camel HIDES THE
> EXCEPTION, or rather prints it at TRACE level.
> 
> So either you use my fix for CAMEL-12251, or you set TRACE level for
> org.apache.camel.blueprint logger.
> 
> regards
> Grzegorz Grzybek
> 
> 2018-02-23 19:49 GMT+01:00 Guillaume Nodet <gno...@apache.org>:
> 
>> Could you please raise a JIRA with the needed information and patch ?
>> 
>> 2018-02-23 19:03 GMT+01:00 Alex Soto <alex.s...@envieta.com>:
>> 
>>> Thank you Guillaume,
>>> 
>>> You are correct,  I tried your suggestion locally and it does work.
>>> I don’t know what are the potential side effects of this change though.
>>> Probably better that somebody more familiar with this code takes a look
>>> and fixes it.
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>>> On Feb 23, 2018, at 12:04 PM, Guillaume Nodet <gno...@apache.org>
>> wrote:
>>>> 
>>>> As I indicated on the Karaf mailing list, I suspect the problem comes
>>> from
>>>> 
>>>> https://github.com/apache/camel/blob/master/components/
>>> camel-blueprint/src/main/java/org/apache/camel/blueprint/
>>> handler/CamelNamespaceHandler.java#L1056
>>>> 
>>>> I think it should call getComponent(component, false) instead to ensure
>>> the
>>>> component is not created eagerly.
>>>> 
>>>> The reason is that the exception is saying that the processor (the
>>> property
>>>> placeholder) can't process the bean because it has been already
>>>> instantiated.  And that call could be the culprit as the OSGi camel
>>> context
>>>> may attempt to create the component.
>>>> 
>>>> That could break the original intent though, in which case, we'd need
>> to
>>> go
>>>> to the blueprint container and check if the component is available
>>> without
>>>> creating it.
>>>> 
>>>> Guillaume
>>>> 
>>>> 
>>>> 2018-02-23 17:55 GMT+01:00 Quinn Stevenson <
>> qu...@pronoia-solutions.com
>>>> :
>>>> 
>>>>> That makes more sense :-)
>>>>> 
>>>>> When I’ve seen this kind of stuff before, it’s usually that the
>>>>> initialization of bean that is a dependency of another bean fails.  I
>>> start
>>>>> at the first exception I see - that usually points me to the right
>>> place.
>>>>> 
>>>>> In this case, it’s acting like it can’t find a setter for the correct
>>> type
>>>>> - maybe that changed across Camel versions?
>>>>> 
>>>>>> On Feb 23, 2018, at 6:49 AM, Alex Soto <alex.s...@envieta.com>
>> wrote:
>>>>>> 
>>>>>> The actual code is well-formed, this was just error formatting the
>> code
>>>>> for the post.  I’ll try again:
>>>>>> 
>>>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0;
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>>>>> xmlns:camel="http://camel.apache.org/schema/blueprint;
>>>>>> xmlns:cm="http://aries.apache.
>>>>> org/blueprint/xmlns/blueprint-cm/v1.1.0"
>>>>>> xmlns:ext="http://aries.apache.org/blueprint/xmlns/
>>>>> blueprint-ext/v1.0.0"
>>>>>> xsi:schemaLocation="
>>>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0
>>>>>> https://www.osgi.org/xmlns/
>>>>> blueprint/v1.0.0/blueprint.xsd”>
>>&g

Re: Blueprint, property-place-holder error name is already instanciated as null and cannot be removed

2018-02-23 Thread Alex Soto
Thank you Guillaume,

You are correct,  I tried your suggestion locally and it does work.
I don’t know what are the potential side effects of this change though.
Probably better that somebody more familiar with this code takes a look and 
fixes it.

Best regards,
Alex soto


> On Feb 23, 2018, at 12:04 PM, Guillaume Nodet <gno...@apache.org> wrote:
> 
> As I indicated on the Karaf mailing list, I suspect the problem comes from
> 
> https://github.com/apache/camel/blob/master/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java#L1056
> 
> I think it should call getComponent(component, false) instead to ensure the
> component is not created eagerly.
> 
> The reason is that the exception is saying that the processor (the property
> placeholder) can't process the bean because it has been already
> instantiated.  And that call could be the culprit as the OSGi camel context
> may attempt to create the component.
> 
> That could break the original intent though, in which case, we'd need to go
> to the blueprint container and check if the component is available without
> creating it.
> 
> Guillaume
> 
> 
> 2018-02-23 17:55 GMT+01:00 Quinn Stevenson <qu...@pronoia-solutions.com>:
> 
>> That makes more sense :-)
>> 
>> When I’ve seen this kind of stuff before, it’s usually that the
>> initialization of bean that is a dependency of another bean fails.  I start
>> at the first exception I see - that usually points me to the right place.
>> 
>> In this case, it’s acting like it can’t find a setter for the correct type
>> - maybe that changed across Camel versions?
>> 
>>> On Feb 23, 2018, at 6:49 AM, Alex Soto <alex.s...@envieta.com> wrote:
>>> 
>>> The actual code is well-formed, this was just error formatting the code
>> for the post.  I’ll try again:
>>> 
>>>  http://www.osgi.org/xmlns/blueprint/v1.0.0;
>>>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>>  xmlns:camel="http://camel.apache.org/schema/blueprint;
>>>  xmlns:cm="http://aries.apache.
>> org/blueprint/xmlns/blueprint-cm/v1.1.0"
>>>  xmlns:ext="http://aries.apache.org/blueprint/xmlns/
>> blueprint-ext/v1.0.0"
>>>  xsi:schemaLocation="
>>>  http://www.osgi.org/xmlns/blueprint/v1.0.0
>>>  https://www.osgi.org/xmlns/
>> blueprint/v1.0.0/blueprint.xsd”>
>>> 
>>>  >>  update-strategy="reload”
>>>  placeholder-prefix="#{" placeholder-suffix="}">
>>>  
>>>      
>>>  > value="600" />
>>>  
>>>  
>>> 
>>> 
>>> 
>>>> On Feb 22, 2018, at 9:56 PM, Quinn Stevenson <
>> qu...@pronoia-solutions.com> wrote:
>>>> 
>>>> Is that really the XML?  It’s not well formed - you start with a
>> cm:property-placeholder element and end with a cm:default-properties
>> element.
>>>> 
>>>>> On Feb 22, 2018, at 12:48 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>>>> 
>>>>> Hello,
>>>>> 
>>>>> I am having some problems migrating to Camel 2.20.2 from 2.17.4.  I
>> have blueprint configuration:
>>>>> 
>>>>>>>>>persistent-id=“audit.log”
>>>>>update-strategy="reload”
>>>>>placeholder-prefix="#{"
>> placeholder-suffix="}”>
>>>>> 
>>>>>> />
>>>>>
>>>>>
>>>>> 
>>>>> A component configuration (in this case for Quartz2, but I don’t think
>> this is related to Quartz2):
>>>>> 
>>>>>
>>>>>> value="#{startDelaySeconds}" />
>>>>>
>>>>> 
>>>>> Then use this in a route:
>>>>> 
>>>>>
>>>>>> />
>>>>>...
>>>>> 
>>>>> When I run this (Karaf 4.2.5) an exception is thrown:
>>>>> 
>>>>> org.osgi.service.blueprint.container.ComponentDefinitionException:
>> Name audit-log-reaper-quartz is already instanciated as null and can

Re: Blueprint, property-place-holder error name is already instanciated as null and cannot be removed

2018-02-23 Thread Alex Soto
The actual code is well-formed, this was just error formatting the code for the 
post.  I’ll try again:

http://www.osgi.org/xmlns/blueprint/v1.0.0;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:camel="http://camel.apache.org/schema/blueprint;

xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0;

xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0;
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 

https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd”>










> On Feb 22, 2018, at 9:56 PM, Quinn Stevenson <qu...@pronoia-solutions.com> 
> wrote:
> 
> Is that really the XML?  It’s not well formed - you start with a 
> cm:property-placeholder element and end with a cm:default-properties element.
> 
>> On Feb 22, 2018, at 12:48 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> 
>> Hello, 
>> 
>> I am having some problems migrating to Camel 2.20.2 from 2.17.4.  I have 
>> blueprint configuration:
>> 
>>  >  persistent-id=“audit.log” 
>>  update-strategy="reload” 
>>  placeholder-prefix="#{" placeholder-suffix="}”>
>> 
>>  
>>  
>>  
>> 
>> A component configuration (in this case for Quartz2, but I don’t think this 
>> is related to Quartz2):
>> 
>>  > class="org.apache.camel.component.quartz2.QuartzComponent">
>>  > value="#{startDelaySeconds}" />
>>  
>> 
>> Then use this in a route:
>> 
>>  
>>  
>>  ...
>> 
>> When I run this (Karaf 4.2.5) an exception is thrown:
>> 
>> org.osgi.service.blueprint.container.ComponentDefinitionException: Name 
>> audit-log-reaper-quartz is already instanciated as null and cannot be 
>> removed.
>>  at 
>> org.apache.aries.blueprint.container.BlueprintRepository.removeRecipe(BlueprintRepository.java:131)
>>  [38:org.apache.aries.blueprint.core:1.8.3]
>>  at 
>> org.apache.aries.blueprint.container.BlueprintContainerImpl.updateUninstantiatedRecipes(BlueprintContainerImpl.java:572)
>>  [38:org.apache.aries.blueprint.core:1.8.3]
>>  at 
>> org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:559)
>>  [38:org.apache.aries.blueprint.core:1.8.3]
>>  at 
>> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:394)
>>  [38:org.apache.aries.blueprint.core:1.8.3]
>>  at 
>> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:275)
>>  [38:org.apache.aries.blueprint.core:1.8.3]
>> 
>> 
>> This was working fine in Camel 2.17.4.  Interestingly,  if I remove property 
>> place holder:
>> 
>>  > class="org.apache.camel.component.quartz2.QuartzComponent">
>>  
>>  
>> 
>> Then it works fine, no errors.  So this seems to be related to the property 
>> placeholders.  Has anybody seen this? 
>> I appreciate any insight on how to solve this problem.
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
> 



Empty/null response from netty4-http template producer

2018-02-22 Thread Alex Soto
Hello,

I am having some problems migrating to Camel 2.20.2 from 2.17.4.This has 
been working before, but now the response is null.
I have access to the server logs and everything there looks good, i.e., the 
server is sending a response, but client is unable to get it.
Here is the client code:

SimpleRegistry registry = new SimpleRegistry();
registry.put("sslParams", sslContextParams);

DefaultCamelContext defaultCamelContext = new 
DefaultCamelContext(registry);
defaultCamelContext.addComponent("netty4-http", new 
NettyHttpComponent());
defaultCamelContext.setTracing(true);
defaultCamelContext.setName("itest");
defaultCamelContext.setStreamCaching(true);
defaultCamelContext.start();

ProducerTemplate producerTemplate = 
defaultCamelContext.createProducerTemplate();
producerTemplate.start();

final BytesAndDecParams requestMessage = makeEnrolCertRequest();

byte[] response = producerTemplate.requestBody(

"netty4-http:https://localhost:8895/service?sslContextParameters=#sslParams=true;,
requestMessage.message,
byte[].class);

assertNotNull(response);


I appreciate any help with this problem.
Best regards,
Alex soto




Blueprint, property-place-holder error name is already instanciated as null and cannot be removed

2018-02-22 Thread Alex Soto
Hello, 

I am having some problems migrating to Camel 2.20.2 from 2.17.4.  I have 
blueprint configuration:





A component configuration (in this case for Quartz2, but I don’t think this is 
related to Quartz2):





Then use this in a route:



...

When I run this (Karaf 4.2.5) an exception is thrown:

org.osgi.service.blueprint.container.ComponentDefinitionException: Name 
audit-log-reaper-quartz is already instanciated as null and cannot be removed.
at 
org.apache.aries.blueprint.container.BlueprintRepository.removeRecipe(BlueprintRepository.java:131)
 [38:org.apache.aries.blueprint.core:1.8.3]
at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.updateUninstantiatedRecipes(BlueprintContainerImpl.java:572)
 [38:org.apache.aries.blueprint.core:1.8.3]
at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:559)
 [38:org.apache.aries.blueprint.core:1.8.3]
at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:394)
 [38:org.apache.aries.blueprint.core:1.8.3]
at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:275)
 [38:org.apache.aries.blueprint.core:1.8.3]


This was working fine in Camel 2.17.4.  Interestingly,  if I remove property 
place holder:





Then it works fine, no errors.  So this seems to be related to the property 
placeholders.  Has anybody seen this? 
I appreciate any insight on how to solve this problem.

Best regards,
Alex soto





Re: Netty4-HTTP - synchronous - No response received from remote server error

2017-11-30 Thread Alex Soto
Yet another problem is that the exception is thrown even though I am passing 
option  throwExceptionOnFailure=false
I hope somebody can help me figure out what I am doing wrong.

Best regards,
Alex soto



> On Nov 30, 2017, at 9:22 AM, Alex Soto <alex.s...@envieta.com> wrote:
> 
> Hello,
> 
> I am using Camel 2.17.4, I have a route initiating a request/response  
> netty4-http call:
> 
>  uri="netty4-http:{{oozie.service.url}}/jobs?action=startheaderFilterStrategy=#headerFilterthrowExceptionOnFailure=falsesynchronous=true"/>
> 
> 
> 
> First problem is that the synchronous=true is passed as query parameter to 
> the remote server, when it should be used to configure the endpoint.
> 
> 2017-11-30 09:01:07,921 | DEBUG | yClientTCPWorker | 51 - 
> org.apache.camel.camel-netty4 - 2.17.4 | Channel: [id: 0x5d15a2da, 
> L:/192.168.56.1:56875 - R:quickstart.cloudera/192.168.56.101:11000] writing 
> body: DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, 
> content: UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 0, widx: 1714, cap: 1714))
> POST 
> http://quickstart.cloudera:11000/oozie/v2/jobs?action=start=true 
> <http://quickstart.cloudera:11000/oozie/v2/jobs?action=start=true>
>  HTTP/1.1
> Content-Length: 1714
> Content-Type: application/xml
> Host: quickstart.cloudera:11000
> Connection: keep-alive
> 
> Second problem is that even though the server is actually responding, I am 
> getting asynchronous error:
> 
> 2017-11-30 09:01:08,359 | DEBUG | yClientTCPWorker | 49 - 
> org.apache.camel.camel-core - 2.17.4 | Http responseCode: 201
> 2017-11-30 09:01:08,361 | INFO  | pool-50-thread-1 | 49 - 
> org.apache.camel.camel-core - 2.17.4 | 
> ID-Alexs-Laptop-local-56143-1512049637396-7-2 >>> (submitSparkQueriesWF) 
> convertBodyTo[String] --> log[Oozie Response: ${body}] <<<, 
> Headers:{CamelHttpResponseCode=201, CamelHttpResponseText=Created, 
> Content-Type=application/json;charset=UTF-8}, BodyType:String, 
> Body:{"id":"002-171129163622279-oozie-oozi-W"}
> 2017-11-30 09:01:08,362 | INFO  | pool-50-thread-1 | 49 - 
> org.apache.camel.camel-core - 2.17.4 | Oozie Response: 
> {"id":"002-171129163622279-oozie-oozi-W”}
> 
> Some time later, I get error:
> 
> 2017-11-30 09:02:08,375 | ERROR | pool-50-thread-1 | 49 - 
> org.apache.camel.camel-core - 2.17.4 | Failed delivery for (MessageId: 
> ID-Alexs-Laptop-local-56143-1512049637396-7-4 on ExchangeId: 
> ID-Alexs-Laptop-local-56143-1512049637396-7-2). Exhausted after delivery 
> attempt: 1 caught: org.apache.camel.CamelExchangeException: No response 
> received from remote server: quickstart.cloudera:11000. 
> Exchange[ID-Alexs-Laptop-local-56143-1512049637396-7-2]
> ...
> Stacktrace
> ---
> org.apache.camel.CamelExchangeException: No response received from remote 
> server: quickstart.cloudera:11000. 
> Exchange[ID-Alexs-Laptop-local-56143-1512049637396-7-2]
>   at 
> org.apache.camel.component.netty4.handlers.ClientChannelHandler.channelInactive(ClientChannelHandler.java:130)[51:org.apache.camel.camel-netty4:2.17.4]
>   at 
> io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:241)[32:io.netty.transport:4.0.43.Final]
> 
> Notice the error occurs in a different thread.
> I don’t know why this error is occurring because there is a response,  and 
> why is it not handling the exchange synchronous ?
> 
> 
> Best regards,
> Alex soto
> 
> 
> 



Netty4-HTTP - synchronous - No response received from remote server error

2017-11-30 Thread Alex Soto
Hello,

I am using Camel 2.17.4, I have a route initiating a request/response  
netty4-http call:





First problem is that the synchronous=true is passed as query parameter to the 
remote server, when it should be used to configure the endpoint.

2017-11-30 09:01:07,921 | DEBUG | yClientTCPWorker | 51 - 
org.apache.camel.camel-netty4 - 2.17.4 | Channel: [id: 0x5d15a2da, 
L:/192.168.56.1:56875 - R:quickstart.cloudera/192.168.56.101:11000] writing 
body: DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: 
UnpooledUnsafeNoCleanerDirectByteBuf(ridx: 0, widx: 1714, cap: 1714))
POST 
http://quickstart.cloudera:11000/oozie/v2/jobs?action=start=true 
HTTP/1.1
Content-Length: 1714
Content-Type: application/xml
Host: quickstart.cloudera:11000
Connection: keep-alive

Second problem is that even though the server is actually responding, I am 
getting asynchronous error:

2017-11-30 09:01:08,359 | DEBUG | yClientTCPWorker | 49 - 
org.apache.camel.camel-core - 2.17.4 | Http responseCode: 201
2017-11-30 09:01:08,361 | INFO  | pool-50-thread-1 | 49 - 
org.apache.camel.camel-core - 2.17.4 | 
ID-Alexs-Laptop-local-56143-1512049637396-7-2 >>> (submitSparkQueriesWF) 
convertBodyTo[String] --> log[Oozie Response: ${body}] <<<, 
Headers:{CamelHttpResponseCode=201, CamelHttpResponseText=Created, 
Content-Type=application/json;charset=UTF-8}, BodyType:String, 
Body:{"id":"002-171129163622279-oozie-oozi-W"}
2017-11-30 09:01:08,362 | INFO  | pool-50-thread-1 | 49 - 
org.apache.camel.camel-core - 2.17.4 | Oozie Response: 
{"id":"002-171129163622279-oozie-oozi-W”}

Some time later, I get error:

2017-11-30 09:02:08,375 | ERROR | pool-50-thread-1 | 49 - 
org.apache.camel.camel-core - 2.17.4 | Failed delivery for (MessageId: 
ID-Alexs-Laptop-local-56143-1512049637396-7-4 on ExchangeId: 
ID-Alexs-Laptop-local-56143-1512049637396-7-2). Exhausted after delivery 
attempt: 1 caught: org.apache.camel.CamelExchangeException: No response 
received from remote server: quickstart.cloudera:11000. 
Exchange[ID-Alexs-Laptop-local-56143-1512049637396-7-2]
...
Stacktrace
---
org.apache.camel.CamelExchangeException: No response received from remote 
server: quickstart.cloudera:11000. 
Exchange[ID-Alexs-Laptop-local-56143-1512049637396-7-2]
at 
org.apache.camel.component.netty4.handlers.ClientChannelHandler.channelInactive(ClientChannelHandler.java:130)[51:org.apache.camel.camel-netty4:2.17.4]
at 
io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:241)[32:io.netty.transport:4.0.43.Final]

Notice the error occurs in a different thread.
I don’t know why this error is occurring because there is a response,  and why 
is it not handling the exchange synchronous ?


Best regards,
Alex soto





Re: Property with key XXX not found in properties from text (blueprint, sslContextParameters)

2017-02-02 Thread Alex Soto
I found this which looks very similar to my problem:

https://access.redhat.com/solutions/1428583 
<https://access.redhat.com/solutions/1428583>

Anybody knows about this?

Best regards,
Alex soto



> On Jan 11, 2017, at 2:55 PM, Alex Soto <alex.s...@envieta.com> wrote:
> 
> I think it is related to the camel:sslContextParameters.  I am creating and 
> exporting this object as a service from one bundle to the other.
> The client bundle imports the service:
> 
>  interface="org.apache.camel.util.jsse.SSLContextParameters" 
> ext:proxy-method=“classes”/>
> 
> 
> but the property should have been resolved already within the exporting 
> bundle.  The It seems to be looking for the property in the client bundle 
> context, and not in the context of the defining bundle.
> 
> Best regards,
> Alex soto
> 
> 
> 
>> On Jan 11, 2017, at 1:58 PM, Quinn Stevenson <qu...@pronoia-solutions.com 
>> <mailto:qu...@pronoia-solutions.com>> wrote:
>> 
>> Could it be because you’ve changed the placeholder prefix/suffix?
>> 
>> 
>>> On Jan 11, 2017, at 10:15 AM, Alex Soto <alex.s...@envieta.com 
>>> <mailto:alex.s...@envieta.com>> wrote:
>>> 
>>> Actually, the error is coming from a different Blueprint context/bundle, 
>>> not the one I pasted below. 
>>> This other context does not reference this property, so this is very 
>>> strange.
>>> 
>>> How is this possible: 
>>> 
>>> Blueprint context A depends on a service exposed by Blueprint B.
>>> Blueprint B uses a property XXX.
>>> Blueprint B deploys without errors.  Property XX has default value.
>>> Blueprint A does not reference/use property XXX.
>>> Blueprint A produces the error below.
>>> Persistent ID in A and B are different,
>>> 
>>> It looks like the dependency on property XXX from B is leaking to A.
>>> Again, this same code deploys fine with Camel 2.17.4, not so with 2.18.x
>>> 
>>> Any ideas?
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>>> 
>>>> On Jan 10, 2017, at 6:05 PM, Alex Soto <alex.s...@envieta.com 
>>>> <mailto:alex.s...@envieta.com>> wrote:
>>>> 
>>>> Hello,
>>>> 
>>>> Starting with Camel 2.18.0, and including 2.18.1, I am getting this error 
>>>> during deployment of my Blueprint routes.  The exact same blueprint 
>>>> deploys fine with version 2.17.4, so it looks like something was changed 
>>>> in 2.18.x that is causing this.  Here is a fragment of my blueprint xml:  
>>>> 
>>>> 
>>>> http://www.osgi.org/xmlns/blueprint/v1.0.0 
>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0><http://www.osgi.org/xmlns/blueprint/v1.0.0
>>>>  <http://www.osgi.org/xmlns/blueprint/v1.0.0>>"
>>>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 
>>>> <http://www.w3.org/2001/XMLSchema-instance><http://www.w3.org/2001/XMLSchema-instance
>>>>  <http://www.w3.org/2001/XMLSchema-instance>>"
>>>>xmlns:camel="http://camel.apache.org/schema/blueprint 
>>>> <http://camel.apache.org/schema/blueprint><http://camel.apache.org/schema/blueprint
>>>>  <http://camel.apache.org/schema/blueprint>>"
>>>>xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 
>>>> <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0><http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
>>>>  <http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0>>"
>>>>xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0 
>>>> <http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0><http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0
>>>>  <http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0>>"
>>>>xsi:schemaLocation="
>>>>http://www.osgi.org/xmlns/blueprint/v1.0.0 
>>>> <http://www.osgi.org/xmlns/blueprint/v1.0.0><http://www.osgi.org/xmlns/blueprint/v1.0.0
>>>>  <http://www.osgi.org/xmlns/blueprint/v1.0.0>> 
>>>> https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd 
>>>> <https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd><https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>>>>  <https://www.osgi.or

Re: How to destroy Netty Pools in Blueprint

2016-08-24 Thread Alex Soto
Yes, this is what I ended up doing.  I followed the example of Camel’s Pool 
Builders NettyWorkerPoolBuilder and NettyServerBossPoolBuilder.  
NettyWorkerPoolBuilder has a destroy method, although it does not actually wait 
for completion, and NettyServerBossPoolBuilder does not even have a destroy 
method.  As they are, these classes seem to be of very little use, if at all.

Best regards,
Alex soto



> On Aug 24, 2016, at 11:43 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> You can maybe build your own pojo that shutdown the pool and has a
> void method so you can use destroy-method in the blueprint xml file.
> 
> On Wed, Aug 24, 2016 at 4:25 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> Hello,
>> 
>> Is there a way to destroy the Netty (Boss or Worker) thread pools when using 
>> BluePrint xml?
>> I am trying this:
>> 
>> >class="io.netty.channel.EventLoopGroup"
>>factory-ref="nettyWorkerPoolBuilder"
>>factory-method="build"
>>destroy-method="shutdownGracefully">
>> 
>> 
>> But Blueprint does not like the shutdownGracefully method because it is not 
>> a void method (it returns Future).
>> What are other people doing in this case?
>> 
>> (I am using Camel 2.17.0)
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



How to destroy Netty Pools in Blueprint

2016-08-24 Thread Alex Soto
Hello,

Is there a way to destroy the Netty (Boss or Worker) thread pools when using 
BluePrint xml?
I am trying this:




But Blueprint does not like the shutdownGracefully method because it is not a 
void method (it returns Future).
What are other people doing in this case?  

(I am using Camel 2.17.0)

Best regards,
Alex soto





Re: poll enrich and file endpoint

2016-08-18 Thread Alex Soto
Dennis,

In your case, I think you are missing the idempotent option in the File URI.   

Best regards,
Alex soto



> On Aug 18, 2016, at 10:59 AM, Dennis Bohnstedt Hansen <d...@miracle.dk> wrote:
> 
> Hi
> 
> I’m seeing the same problem with pollEnrich, using a dynamic endpoint. I
> send a my route a filename in the message-body, and expect the file content
> as a reply:
> 
> from("direct:getFileContent")
>.log("Filename : ${body}")
>
> .pollEnrich().simple("file:/temp?readLock=none=true=${body}").aggregationStrategy(new
> BodyOnlyAggregationStrategy()).timeout(5000)
>.log(“FileContent: ${body}");
> 
> The first thing i experienced, was that i lost my headers, when i did not
> set an aggregation strategy, to my “BodyOnlyAggregationStrategy”, is a
> fairly started out as a fairly simple strategy, that just copied the body
> to the original exchange:
> 
> public Exchange aggregate(Exchange original, Exchange resource) {
>if (resource != null && resource.getIn() != null) {
>Object resourceResponse = resource.getIn().getBody();
>if (original.getPattern().isOutCapable()) {
>original.getOut().setBody(resourceResponse);
>} else {
>original.getIn().setBody(resourceResponse);
>}
>}
>return original;
> }
> 
> 
> The first time i hit my route, everything works just fine, but after that,
> i start waiting for the timeout, and returns null to the
> AggregationStrategy “resource” Exchange. If i do not set a timeout i hangs
> forever…
> 
> Regards
> / Dennis Bohnstedt Hansen
>  Software designer
>  Miracle A/S - www.miracle.dk <http://www.miracleas.dk/>
>  +45 53747254
> 
> 
> On Thu, Aug 18, 2016 at 8:12 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
>> Its easier to do a message transformation and set the body as a
>> java.io.File
>> 
>> 
>>  {{env:HOME}}/my-dir/${body}
>> 
>> 
>> 
>> On Tue, Aug 16, 2016 at 8:39 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>> Hello,
>>> 
>>> I am experiencing erratic results when using the Poll Enrich with a
>> static file.
>>> The file is static in the sense that it never changes, so I am setting
>> both the noop=true and the idempotent=false.
>>> Basically I need to be able to serve this same files for ever, and not
>> move it or deleted it.
>>> 
>>> My route sets the body with the file name, then it continues with:
>>> 
>>> 
>>>   file:{{env:HOME}}/my-dir?noop=truefileName=${
>> body}idempotent=false
>>> 
>>> 
>>> It works a few times, but after this is executed several times (from
>> multiple clients concurrently), the body becomes null, even though, the
>> file is still present in the directory.
>>> Am I setting the options correctly?  How can this be accomplished?
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> --
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>> 



Re: poll enrich and file endpoint

2016-08-18 Thread Alex Soto
Wow, I didn’t know this was possible.  Nice trick.  

Still the poll consumer seems to be the most intuitive choice if you come from 
EIP mindset.  I never thought of my route as doing a data transformation, but 
rather a content enrichment.   Anyway,  I wonder if others will be hit by the 
same problem where it does not work correctly when used under  high concurrency.

Thank you Claus.

Best regards,
Alex soto



> On Aug 18, 2016, at 2:12 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> Its easier to do a message transformation and set the body as a java.io.File
> 
> 
>  {{env:HOME}}/my-dir/${body}
> 
> 
> 
> On Tue, Aug 16, 2016 at 8:39 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> Hello,
>> 
>> I am experiencing erratic results when using the Poll Enrich with a static 
>> file.
>> The file is static in the sense that it never changes, so I am setting both 
>> the noop=true and the idempotent=false.
>> Basically I need to be able to serve this same files for ever, and not move 
>> it or deleted it.
>> 
>> My route sets the body with the file name, then it continues with:
>> 
>> 
>>   
>> file:{{env:HOME}}/my-dir?noop=truefileName=${body}idempotent=false
>> 
>> 
>> It works a few times, but after this is executed several times (from 
>> multiple clients concurrently), the body becomes null, even though, the file 
>> is still present in the directory.
>> Am I setting the options correctly?  How can this be accomplished?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



poll enrich and file endpoint

2016-08-16 Thread Alex Soto
Hello,

I am experiencing erratic results when using the Poll Enrich with a static file.
The file is static in the sense that it never changes, so I am setting both the 
noop=true and the idempotent=false.
Basically I need to be able to serve this same files for ever, and not move it 
or deleted it.  

My route sets the body with the file name, then it continues with:


   
file:{{env:HOME}}/my-dir?noop=truefileName=${body}idempotent=false
  


It works a few times, but after this is executed several times (from multiple 
clients concurrently), the body becomes null, even though, the file is still 
present in the directory.  
Am I setting the options correctly?  How can this be accomplished?

Best regards,
Alex soto





Re: Camel blueprint: Unable to load class org.apache.camel.builder.LoggingErrorHandler

2016-06-03 Thread Alex Soto
That worked, thanks!

Best regards,
Alex soto


> On Jun 2, 2016, at 11:20 PM, Quinn Stevenson <qu...@pronoia-solutions.com> 
> wrote:
> 
>> org.apache.camel.builder.LoggingErrorHandler



Camel blueprint: Unable to load class org.apache.camel.builder.LoggingErrorHandler

2016-06-01 Thread Alex Soto
ourceByDelegation(BundleWiringImpl.java:1574)[org.apache.felix.framework-5.4.0.jar:]
at 
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)[org.apache.felix.framework-5.4.0.jar:]
at 
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)[org.apache.felix.framework-5.4.0.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_45]
at 
org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1415)[org.apache.felix.framework-5.4.0.jar:]
at 
org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1595)[org.apache.felix.framework-5.4.0.jar:]
at 
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1525)[org.apache.felix.framework-5.4.0.jar:]
at 
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)[org.apache.felix.framework-5.4.0.jar:]
at 
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)[org.apache.felix.framework-5.4.0.jar:]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_45]
at 
org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1925)[org.apache.felix.framework-5.4.0.jar:]
at 
org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)[org.apache.felix.framework-5.4.0.jar:]
at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:439)[32:org.apache.aries.blueprint.core:1.4.5]
at 
org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:410)[32:org.apache.aries.blueprint.core:1.4.5]
at 
org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:113)[32:org.apache.aries.blueprint.core:1.4.5]
at 
org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:168)[32:org.apache.aries.blueprint.core:1.4.5]
... 26 more


I checked the OSGI manifest, and it does import the  org.apache.camel.builder  
package:

Import-Package: org.apache.camel.builder;version="[2.17,3)”

 Any ideas?

Best regards,
Alex soto





Re: Accessing the HTTP Response Code with netty4

2016-04-11 Thread Alex Soto
It was my fault,  I had a custom Trace Formatter that was printing null 
mistakenly. 
 
Best regards,
Alex soto



> On Apr 9, 2016, at 3:11 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> That would be a bit odd as this is the code that maps the netty status to 
> Camel
> 
> headers.put(Exchange.HTTP_RESPONSE_CODE, response.getStatus().code());
> headers.put(Exchange.HTTP_RESPONSE_TEXT, response.getStatus().reasonPhrase());
> 
> Have you turned off mapHeaders by any chance?
> 
> 
> 
> On Fri, Apr 8, 2016 at 4:39 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> Hello:
>> 
>> I am using Camel 2.16.2  and I have a route with a Netty4 HTTP producer 
>> calling a remote HTTP server.  I am passing the option 
>> throwExceptionOnFailure=false.  Upon return,  I need to check the HTTP 
>> response code like this:
>> 
>> 
>>${header.CamelHttpResponseCode} == 403
>> 
>>. . .
>> 
>> 
>> 
>> The problem is that the CamelHttpResponseCode is always null. I can see it 
>> the trace logs:
>> 
>> Headers:{CamelHttpResponseCode=null, Connection=keep-alive, 
>> CamelHttpResponseText=Not Modified, Content-Length=0}
>> 
>> 
>> How can I check the HTTP response code?
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Accessing the HTTP Response Code with netty4

2016-04-08 Thread Alex Soto
Hello:

I am using Camel 2.16.2  and I have a route with a Netty4 HTTP producer calling 
a remote HTTP server.  I am passing the option throwExceptionOnFailure=false.  
Upon return,  I need to check the HTTP response code like this:


${header.CamelHttpResponseCode} == 403

. . . 



The problem is that the CamelHttpResponseCode is always null. I can see it the 
trace logs:

Headers:{CamelHttpResponseCode=null, Connection=keep-alive, 
CamelHttpResponseText=Not Modified, Content-Length=0}


How can I check the HTTP response code?


Best regards,
Alex soto






Re: Bean instance is null. OGNL bean expressions requires bean instances.

2016-02-29 Thread Alex Soto
Thank you Claus,

Best regards,
Alex soto



> On Feb 28, 2016, at 1:30 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> I logged a ticket
> https://issues.apache.org/jira/browse/CAMEL-9653
> 
> On Sat, Feb 27, 2016 at 7:25 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>> It was not designed primary to call utility methods, but methods on
>> your existing message body and headers - where there is an instance.
>> 
>> You are welcome to log a JIRA ticket to see if we can adjust it to use
>> static methods only.
>> http://camel.apache.org/support.html
>> 
>> On Fri, Feb 26, 2016 at 11:07 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>> Hello,
>>> 
>>> Running Camel 2.16.1, I am trying to invoke a static method as follows:
>>> 
>>> 
>>>>>beanType="org.apache.camel.util.StringHelper"
>>>
>>> method="removeLeadingAndEndingQuotes(${header.If-None-Match})"
>>> />
>>> 
>>> 
>>> 
>>> However I get an exception with this message:
>>> 
>>> Bean instance is null. OGNL bean expressions requires bean instances.
>>> 
>>> Any idea why?
>>> 
>>> Thanks and best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> --
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Bean instance is null. OGNL bean expressions requires bean instances.

2016-02-26 Thread Alex Soto
Hello,

Running Camel 2.16.1, I am trying to invoke a static method as follows:






However I get an exception with this message:

Bean instance is null. OGNL bean expressions requires bean instances.

Any idea why?

Thanks and best regards,
Alex soto





Re: Unknown File Language Syntax

2016-02-24 Thread Alex Soto
So, to summarize:

 if I have ${} then use ,  if not, use 

I am not sure I have seen this explained anywhere in the documentation, perhaps 
it should be, to save others time.

Thanks for the help Claus.

Best regards,
Alex soto


> On Feb 24, 2016, at 12:04 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> Yes because you have ${ } somewhere in there so the backward
> compatible parser is not in use.
> 
> On Wed, Feb 24, 2016 at 5:54 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> Constant works, however it stops working when I add option to consume a 
>> specific file name:
>> 
>> 
>>   
>> file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=falsefileName=${body}
>> 
>> 
>> In this case, is is processing any file name, instead of the one I am 
>> passing in the body.
>> Curiously, changing back  to  works now without any issue.
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Feb 24, 2016, at 10:58 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>>> 
>>> Hi
>>> 
>>> Yeah there was a bug in the backwards compatible parser (checking the
>>> old simple style)
>>> https://issues.apache.org/jira/browse/CAMEL-9641
>>> 
>>> The problem is that your text starts with file: which is the file
>>> language part of simple where you can refer to ${file:name} etc. And
>>> the old parser supported without ${ } style hence file:xxx triggered
>>> it to barf.
>>> 
>>> So use constant instead.
>>> 
>>> 
>>> 
>>> 
>>> On Wed, Feb 24, 2016 at 4:26 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>>> Startup resolution is fine, as the home directory is not expected to 
>>>> change.
>>>> So it is  and not ?  This is strange, I wouldn’t have 
>>>> guessed it.
>>>> 
>>>> Thanks
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Feb 24, 2016, at 10:21 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>>>>> 
>>>>> The simple function is
>>>>> ${sysenv:HOME}
>>>>> 
>>>>> 
>>>>> The {{ }} is property placeholders, which is replaced upon startup
>>>>> 
>>>>> On Wed, Feb 24, 2016 at 4:13 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>>>>> Sorry,  I am using Camel 2.16.0
>>>>>> 
>>>>>> Do you mean, like this?
>>>>>> 
>>>>>> 
>>>>>> file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> My intention is to have {{env:HOME}}  substituted with the home 
>>>>>> directory at runtime
>>>>>> 
>>>>>> 
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Feb 24, 2016, at 10:09 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>>>>>>> 
>>>>>>> Use 
>>>>>>> 
>>>>>>> But what version of Camel are you using?
>>>>>>> 
>>>>>>> On Wed, Feb 24, 2016 at 4:04 PM, Alex Soto <alex.s...@envieta.com> 
>>>>>>> wrote:
>>>>>>>> Hello:
>>>>>>>> 
>>>>>>>> Anybody can tell me what is wrong with this?
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> I am getting this exception:
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Caused by: 
>>>>>>>> org.apache.camel.language.simple.types.SimpleParserException: Unknown 
>>>>>>>> file language syntax: 
>>>>>>>> /Users/asoto/.ra/chains?autoCreate=false=true=false
>>>>>>>> at 
>>>>>>>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleFileExpression(SimpleFunctionExpression.java:409)
>>>>>>>> at 
&

Re: Unknown File Language Syntax

2016-02-24 Thread Alex Soto
Constant works, however it stops working when I add option to consume a 
specific file name:


   
file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=falsefileName=${body}
  


In this case, is is processing any file name, instead of the one I am passing 
in the body.
Curiously, changing back  to  works now without any issue.


Best regards,
Alex soto



> On Feb 24, 2016, at 10:58 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> Hi
> 
> Yeah there was a bug in the backwards compatible parser (checking the
> old simple style)
> https://issues.apache.org/jira/browse/CAMEL-9641
> 
> The problem is that your text starts with file: which is the file
> language part of simple where you can refer to ${file:name} etc. And
> the old parser supported without ${ } style hence file:xxx triggered
> it to barf.
> 
> So use constant instead.
> 
> 
> 
> 
> On Wed, Feb 24, 2016 at 4:26 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> Startup resolution is fine, as the home directory is not expected to change.
>> So it is  and not ?  This is strange, I wouldn’t have 
>> guessed it.
>> 
>> Thanks
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Feb 24, 2016, at 10:21 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>>> 
>>> The simple function is
>>> ${sysenv:HOME}
>>> 
>>> 
>>> The {{ }} is property placeholders, which is replaced upon startup
>>> 
>>> On Wed, Feb 24, 2016 at 4:13 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>>> Sorry,  I am using Camel 2.16.0
>>>> 
>>>> Do you mean, like this?
>>>> 
>>>> 
>>>>  
>>>> file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
>>>> 
>>>> 
>>>> 
>>>> My intention is to have {{env:HOME}}  substituted with the home directory 
>>>> at runtime
>>>> 
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Feb 24, 2016, at 10:09 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>>>>> 
>>>>> Use 
>>>>> 
>>>>> But what version of Camel are you using?
>>>>> 
>>>>> On Wed, Feb 24, 2016 at 4:04 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>>>>> Hello:
>>>>>> 
>>>>>> Anybody can tell me what is wrong with this?
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> I am getting this exception:
>>>>>> 
>>>>>> 
>>>>>> Caused by: org.apache.camel.language.simple.types.SimpleParserException: 
>>>>>> Unknown file language syntax: 
>>>>>> /Users/asoto/.ra/chains?autoCreate=false=true=false
>>>>>>  at 
>>>>>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleFileExpression(SimpleFunctionExpression.java:409)
>>>>>>  at 
>>>>>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleExpression(SimpleFunctionExpression.java:144)
>>>>>>  at 
>>>>>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createExpression(SimpleFunctionExpression.java:55)
>>>>>>  at 
>>>>>> org.apache.camel.language.simple.SimpleBackwardsCompatibleParser.doParseExpression(SimpleBackwardsCompatibleParser.java:72)
>>>>>>  at 
>>>>>> org.apache.camel.language.simple.SimpleBackwardsCompatibleParser.parseExpression(SimpleBackwardsCompatibleParser.java:47)
>>>>>>  at 
>>>>>> org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:127)
>>>>>>  at 
>>>>>> org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:160)
>>>>>>  at 
>>>>>> org.apache.camel.builder.SimpleBuilder.createExpression(SimpleBuilder.java:107)
>>>>>>  ... 85 more
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Claus Ibsen
>>>>> -
>>>>> http://davsclaus.com @davsclaus
>>>>> Camel in Action 2: https://www.manning.com/ibsen2
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Claus Ibsen
>>> -
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Re: Unknown File Language Syntax

2016-02-24 Thread Alex Soto
Startup resolution is fine, as the home directory is not expected to change.
So it is  and not ?  This is strange, I wouldn’t have guessed 
it.

Thanks

Best regards,
Alex soto




> On Feb 24, 2016, at 10:21 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> The simple function is
> ${sysenv:HOME}
> 
> 
> The {{ }} is property placeholders, which is replaced upon startup
> 
> On Wed, Feb 24, 2016 at 4:13 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> Sorry,  I am using Camel 2.16.0
>> 
>> Do you mean, like this?
>> 
>> 
>>   
>> file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
>> 
>> 
>> 
>> My intention is to have {{env:HOME}}  substituted with the home directory at 
>> runtime
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Feb 24, 2016, at 10:09 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>>> 
>>> Use 
>>> 
>>> But what version of Camel are you using?
>>> 
>>> On Wed, Feb 24, 2016 at 4:04 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>>> Hello:
>>>> 
>>>> Anybody can tell me what is wrong with this?
>>>> 
>>>> 
>>>> 
>>>>  
>>>> file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
>>>> 
>>>> 
>>>> 
>>>> I am getting this exception:
>>>> 
>>>> 
>>>> Caused by: org.apache.camel.language.simple.types.SimpleParserException: 
>>>> Unknown file language syntax: 
>>>> /Users/asoto/.ra/chains?autoCreate=false=true=false
>>>>   at 
>>>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleFileExpression(SimpleFunctionExpression.java:409)
>>>>   at 
>>>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleExpression(SimpleFunctionExpression.java:144)
>>>>   at 
>>>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createExpression(SimpleFunctionExpression.java:55)
>>>>   at 
>>>> org.apache.camel.language.simple.SimpleBackwardsCompatibleParser.doParseExpression(SimpleBackwardsCompatibleParser.java:72)
>>>>   at 
>>>> org.apache.camel.language.simple.SimpleBackwardsCompatibleParser.parseExpression(SimpleBackwardsCompatibleParser.java:47)
>>>>   at 
>>>> org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:127)
>>>>   at 
>>>> org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:160)
>>>>   at 
>>>> org.apache.camel.builder.SimpleBuilder.createExpression(SimpleBuilder.java:107)
>>>>   ... 85 more
>>>> 
>>>> 
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Claus Ibsen
>>> -
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Re: Unknown File Language Syntax

2016-02-24 Thread Alex Soto
Sorry,  I am using Camel 2.16.0

Do you mean, like this?


   
file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
  



My intention is to have {{env:HOME}}  substituted with the home directory at 
runtime


Best regards,
Alex soto




> On Feb 24, 2016, at 10:09 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> Use 
> 
> But what version of Camel are you using?
> 
> On Wed, Feb 24, 2016 at 4:04 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> Hello:
>> 
>> Anybody can tell me what is wrong with this?
>> 
>> 
>> 
>>   
>> file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
>> 
>> 
>> 
>> I am getting this exception:
>> 
>> 
>> Caused by: org.apache.camel.language.simple.types.SimpleParserException: 
>> Unknown file language syntax: 
>> /Users/asoto/.ra/chains?autoCreate=false=true=false
>>at 
>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleFileExpression(SimpleFunctionExpression.java:409)
>>at 
>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleExpression(SimpleFunctionExpression.java:144)
>>at 
>> org.apache.camel.language.simple.ast.SimpleFunctionExpression.createExpression(SimpleFunctionExpression.java:55)
>>at 
>> org.apache.camel.language.simple.SimpleBackwardsCompatibleParser.doParseExpression(SimpleBackwardsCompatibleParser.java:72)
>>at 
>> org.apache.camel.language.simple.SimpleBackwardsCompatibleParser.parseExpression(SimpleBackwardsCompatibleParser.java:47)
>>at 
>> org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:127)
>>at 
>> org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:160)
>>at 
>> org.apache.camel.builder.SimpleBuilder.createExpression(SimpleBuilder.java:107)
>>... 85 more
>> 
>> 
>> 
>> Best regards,
>> Alex soto
>> 
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



Unknown File Language Syntax

2016-02-24 Thread Alex Soto
Hello:

Anybody can tell me what is wrong with this?



   
file:{{env:HOME}}/.ra/chains?autoCreate=falsenoop=trueidempotent=false
  



I am getting this exception:


Caused by: org.apache.camel.language.simple.types.SimpleParserException: 
Unknown file language syntax: 
/Users/asoto/.ra/chains?autoCreate=false=true=false
at 
org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleFileExpression(SimpleFunctionExpression.java:409)
at 
org.apache.camel.language.simple.ast.SimpleFunctionExpression.createSimpleExpression(SimpleFunctionExpression.java:144)
at 
org.apache.camel.language.simple.ast.SimpleFunctionExpression.createExpression(SimpleFunctionExpression.java:55)
at 
org.apache.camel.language.simple.SimpleBackwardsCompatibleParser.doParseExpression(SimpleBackwardsCompatibleParser.java:72)
at 
org.apache.camel.language.simple.SimpleBackwardsCompatibleParser.parseExpression(SimpleBackwardsCompatibleParser.java:47)
at 
org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:127)
at 
org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:160)
at 
org.apache.camel.builder.SimpleBuilder.createExpression(SimpleBuilder.java:107)
... 85 more



Best regards,
Alex soto




filtering, but not removing http producer headers

2015-11-10 Thread Alex Soto
Hello,

I have a route with some custom headers that I need to preserve after sending 
an HTTP client request (HTTP producer),  however, I do not want these headers 
to be sent as HTTP headers to the remote server.

Is there a way to accomplish this?

Best regards,
Alex soto





Re: filtering, but not removing http producer headers

2015-11-10 Thread Alex Soto
Thanks,  I will give it a try.

Do you know if there is some concern using exchange properties that I should 
worry about, perhaps with multi-threading?

Best regards,
Alex soto



> On Nov 10, 2015, at 2:57 PM, Daniel Lamb <dan...@discoverygarden.ca> wrote:
> 
> Store the headers as properties on the exchange before filtering them out.  
> Then you can pull them back out after you get your response from the remote 
> server and do what you need to do.
> 
> ~Danny
> 
> On Nov 10, 2015, at 3:52 PM, Alex Soto <alex.s...@envieta.com> wrote:
> 
>> In case its not clear,  I need my custom headers for after the HTTP request 
>> comes back,  I just don’t want these headers to go out to the remote server. 
>>   Currently, I am using a headerFilterStrategy, but that seems to remove the 
>> headers entirely, as opposed to filter them, as the name implies.   
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Nov 10, 2015, at 2:30 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>> 
>>> Hello,
>>> 
>>> I have a route with some custom headers that I need to preserve after 
>>> sending an HTTP client request (HTTP producer),  however, I do not want 
>>> these headers to be sent as HTTP headers to the remote server.
>>> 
>>> Is there a way to accomplish this?
>>> 
>>> Best regards,
>>> Alex soto
>>> 
>>> 
>>> 
>> 
> 



Re: filtering, but not removing http producer headers

2015-11-10 Thread Alex Soto
Great, in this case I am not doing any aggregation, so that won’t be a problem.
I just finished testing,  and it worked, so thats for the help.

Best regards,
Alex soto



> On Nov 10, 2015, at 3:23 PM, Daniel Lamb <dan...@discoverygarden.ca> wrote:
> 
> If you do some parallel processing and have an aggregation strategy for the 
> results, just make sure to put the properties from the old exchange onto the 
> exchange that you return.  Other than that, you’ll be fine.
> 
> ~Danny
> 
> On Nov 10, 2015, at 4:18 PM, Alex Soto <alex.s...@envieta.com> wrote:
> 
>> Thanks,  I will give it a try.
>> 
>> Do you know if there is some concern using exchange properties that I should 
>> worry about, perhaps with multi-threading?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Nov 10, 2015, at 2:57 PM, Daniel Lamb <dan...@discoverygarden.ca> wrote:
>>> 
>>> Store the headers as properties on the exchange before filtering them out.  
>>> Then you can pull them back out after you get your response from the remote 
>>> server and do what you need to do.
>>> 
>>> ~Danny
>>> 
>>> On Nov 10, 2015, at 3:52 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>> 
>>>> In case its not clear,  I need my custom headers for after the HTTP 
>>>> request comes back,  I just don’t want these headers to go out to the 
>>>> remote server.   Currently, I am using a headerFilterStrategy, but that 
>>>> seems to remove the headers entirely, as opposed to filter them, as the 
>>>> name implies.   
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>>> On Nov 10, 2015, at 2:30 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>>>> 
>>>>> Hello,
>>>>> 
>>>>> I have a route with some custom headers that I need to preserve after 
>>>>> sending an HTTP client request (HTTP producer),  however, I do not want 
>>>>> these headers to be sent as HTTP headers to the remote server.
>>>>> 
>>>>> Is there a way to accomplish this?
>>>>> 
>>>>> Best regards,
>>>>> Alex soto
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>> 
> 



Re: filtering, but not removing http producer headers

2015-11-10 Thread Alex Soto
In case its not clear,  I need my custom headers for after the HTTP request 
comes back,  I just don’t want these headers to go out to the remote server.   
Currently, I am using a headerFilterStrategy, but that seems to remove the 
headers entirely, as opposed to filter them, as the name implies.   

Best regards,
Alex soto



> On Nov 10, 2015, at 2:30 PM, Alex Soto <alex.s...@envieta.com> wrote:
> 
> Hello,
> 
> I have a route with some custom headers that I need to preserve after sending 
> an HTTP client request (HTTP producer),  however, I do not want these headers 
> to be sent as HTTP headers to the remote server.
> 
> Is there a way to accomplish this?
> 
> Best regards,
> Alex soto
> 
> 
> 



Nett shared worker pool

2015-10-12 Thread Alex Soto
Hello,

The documentation here http://camel.apache.org/netty4.html# 
<http://camel.apache.org/netty4.html#>  refers to class 
org.jboss.netty.channel.socket.nio.WorkerPool  however I can’t seem to find 
this class in anywhere.  I am using Camel version 2.15.1.  Is the class name 
correct?

Best regards,
Alex soto



Re: Nett shared worker pool

2015-10-12 Thread Alex Soto
I am trying to follow documentation to:
Reusing Netty boss and worker thread pools

with Netty4 component,  but if the page is referring to Netty3, how would this 
work with Netty-4?  Any pointers?

Best regards,
Alex soto



> On Oct 12, 2015, at 10:03 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> Its io.netty now. That link is for jetty 3.x
> 
> On Mon, Oct 12, 2015 at 3:52 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> Hello,
>> 
>> The documentation here http://camel.apache.org/netty4.html# 
>> <http://camel.apache.org/netty4.html#>  refers to class 
>> org.jboss.netty.channel.socket.nio.WorkerPool  however I can’t seem to find 
>> this class in anywhere.  I am using Camel version 2.15.1.  Is the class name 
>> correct?
>> 
>> Best regards,
>> Alex soto
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2nd edition:
> https://www.manning.com/books/camel-in-action-second-edition



Re: Nett shared worker pool

2015-10-12 Thread Alex Soto
Thank you Claus!
I found good example in the unit test of camel-netty4 component.  In case it 
helps anybody here is the fragment:


  
  

  

  
  
  

  http://camel.apache.org/schema/spring;>

  



Best regards,
Alex soto



> On Oct 12, 2015, at 10:15 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> 
> I think they are called EventLoopGroup now
> https://github.com/apache/camel/blob/master/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java#L95
> 
> But you can also check the netty 3 -> 4 migration guide, if they have
> any or netty 4 docs whats its called now.
> 
> And you are welcome to help update the docs
> http://camel.apache.org/contributing
> 
> On Mon, Oct 12, 2015 at 4:10 PM, Alex Soto <alex.s...@envieta.com> wrote:
>> I am trying to follow documentation to:
>> Reusing Netty boss and worker thread pools
>> 
>> with Netty4 component,  but if the page is referring to Netty3, how would 
>> this work with Netty-4?  Any pointers?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Oct 12, 2015, at 10:03 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
>>> 
>>> Its io.netty now. That link is for jetty 3.x
>>> 
>>> On Mon, Oct 12, 2015 at 3:52 PM, Alex Soto <alex.s...@envieta.com> wrote:
>>>> Hello,
>>>> 
>>>> The documentation here http://camel.apache.org/netty4.html# 
>>>> <http://camel.apache.org/netty4.html#>  refers to class 
>>>> org.jboss.netty.channel.socket.nio.WorkerPool  however I can’t seem to 
>>>> find this class in anywhere.  I am using Camel version 2.15.1.  Is the 
>>>> class name correct?
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Claus Ibsen
>>> -
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2nd edition:
>>> https://www.manning.com/books/camel-in-action-second-edition
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2nd edition:
> https://www.manning.com/books/camel-in-action-second-edition



Camel headers and Netty4 HTTP producer

2015-08-21 Thread Alex Soto
Hello,

I am using Camel 2.15.1.  I   have a Camel route that sets some custom headers, 
then calls a Nettt4-http endpoint:

to uri=netty4-http:https:// ...

Upon return from this,  all my custom headers are lost.  I would like to 
preserve these header values after the HTTP call.
Any suggestions?

Best regards,
Alex soto





Netty4 HTTP client body type

2015-07-28 Thread Alex Soto
Hello,

I am using Netty producer to implement an HTTP client:

Exchange response = testProducer.request(URL, new Processor() {
@Override
public void process(Exchange exchange) throws Exception 
{
exchange.getIn().setBody(body);
}
});

My problem is that the response is not available as InputStream or byte[]:

response.getOut().getBody(InputStream.class)
response.getOut().getBody(byte[].class);

Both return null. Looks like it comes back as a CompositeByteBuf, but isn’t 
Camel supposed to convert this automatically?

Best regards,
Alex soto

Re: Remove breadcrumbId from Rest Service Response Headers

2015-06-16 Thread Alex Soto
Hi Willem,

Thanks for the help; however I fail to understand why is the breadcrumbId 
header present in the exchange during integration test and not when manually 
testing with curl. 

If not the HTTP component, then it must be ProducerTemplate who is adding back 
this header during integration test execution, so the question is:  

How should I write the integration test code in order to verify the header is 
not present?
Is there some flag or setting I can set to prevent the ProducerTemplate from 
adding a bread crumb header? 


Best regards,
Alex soto


 On Jun 15, 2015, at 10:02 PM, Willem Jiang willem.ji...@gmail.com wrote:
 
 Current camel-http component just copy the in message header to the out 
 message header, so it can explain that why you get the Exchange.BREADCRUMB_ID 
 from the out message.
 
 --  
 Willem Jiang
 
 Red Hat, Inc.
 Web: http://www.redhat.com http://www.redhat.com/
 Blog: http://willemjiang.blogspot.com http://willemjiang.blogspot.com/ 
 (English)
 http://jnn.iteye.com http://jnn.iteye.com/ (Chinese)
 Twitter: willemjiang  
 Weibo: 姜宁willem
 
 
 
 On June 15, 2015 at 8:52:31 PM, Alex Soto (alex.s...@envieta.com 
 mailto:alex.s...@envieta.com) wrote:
 Hello:
 
 I guess it must be the way I am writing my integration test.
 
 When manually testing the service with curl, the header is not preset, as 
 expected.
 When I try to verify it in an integration test, the header is present:
 
 
 ProducerTemplate testProducer = camelContext.createProducerTemplate();
 testProducer.start();
 
 Exchange response =
 testProducer.request(
 https://localhost:8890/test?throwExceptionOnFailure=false;,
 new Processor() {
 @Override
 public void process(Exchange exchange) throws Exception {
 exchange.getIn().setHeader(Exchange.HTTP_METHOD, POST);
 }
 }
 );
 
 assertNotNull(response);
 assertTrue(response.hasOut());
 
 final Message out = response.getOut();
 assertNotNull(out);
 
 assertEquals(, out.getBody(String.class));
 
 int code = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
 assertEquals(500, code);
 
 final Map headers = out.getHeaders();
 assertNotNull(headers);
 
 assertFalse(headers.containsKey(Exchange.BREADCRUMB_ID));
 
 
 
 Last assertion is not passing!!!
 
 Best regards,
 Alex soto
 
 
 
 On Jun 14, 2015, at 11:44 AM, Claus Ibsen wrote:
 
 Hi
 
 You should be able to remove the header. Can you try adding a step
 after the removeHeader, eg
 
 
 
 
 And see if that works.
 
 
 On Wed, Jun 10, 2015 at 5:16 PM, Alex Soto wrote:
 Hi there,
 
 Is there a way to remove the “breadcrumbId header from the Rest Service 
 response?  
 
 I am using Camel 2.15.1
 Here is my Route :
 
 
 java.lang.Exception
 
 
 true
 
 
 500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 asyncDelayed=false
 callerRunsWhenRejected=false
 rejectExecution=true
 timePeriodMillis=1000
 1
 
 
 
 
 
 
 
 
 Adding the removeHeaders does not seem to cause any effect; I am still 
 getting the breadcrumbId  
 header in the HTTP response headers.
 
 
 Best regards,
 Alex soto
 
 
 
 
 
 
 --
 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: Remove breadcrumbId from Rest Service Response Headers

2015-06-15 Thread Alex Soto
Hello:

I guess it must be the way I am writing my integration test.

When manually testing the service with curl, the header is not preset, as 
expected. 
When I try to verify it in an integration test, the header is present:


ProducerTemplate testProducer = camelContext.createProducerTemplate();
testProducer.start();

Exchange response = 
testProducer.request(

https://localhost:8890/test?throwExceptionOnFailure=false;,
new Processor() {
@Override
public void process(Exchange exchange) 
throws Exception {

exchange.getIn().setHeader(Exchange.HTTP_METHOD, POST);
}
}
);

assertNotNull(response);
assertTrue(response.hasOut());

final Message out = response.getOut();
assertNotNull(out);

assertEquals(, out.getBody(String.class));

int code = out.getHeader(Exchange.HTTP_RESPONSE_CODE, Integer.class);
assertEquals(500, code);

final MapString, Object headers = out.getHeaders();
assertNotNull(headers);

assertFalse(headers.containsKey(Exchange.BREADCRUMB_ID));



Last assertion is not passing!!!

Best regards,
Alex soto



 On Jun 14, 2015, at 11:44 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 
 Hi
 
 You should be able to remove the header. Can you try adding a step
 after the removeHeader, eg
 
 removeHeader  headerName=breadcrumbId/
 log message=bla bla/
 
 And see if that works.
 
 
 On Wed, Jun 10, 2015 at 5:16 PM, Alex Soto alex.s...@envieta.com wrote:
 Hi there,
 
 Is there a way to remove the “breadcrumbId header from the Rest Service 
 response?
 
 I am using Camel 2.15.1
 Here is my Route :
 
 onException
exceptionjava.lang.Exception/exception
redeliveryPolicy maximumRedeliveries=1 /
handled
constanttrue/constant
/handled
camel:setHeader headerName=CamelHttpResponseCode
constant500/constant
/camel:setHeader
camel:setBody
constant/constant
/camel:setBody
camel:removeHeader headerName=breadcrumbId/
 /onException
 
 rest path=/
post uri=test
to uri=direct:test /
/post
 /rest
 
 route
from uri=direct:test /
throttle
asyncDelayed=false
callerRunsWhenRejected=false
rejectExecution=true
timePeriodMillis=1000
constant1/constant
 
 
unmarshal ref=myDataFormat/
removeHeader  headerName=breadcrumbId/
/throttle
 /route
 
 
 Adding the removeHeaders does not seem to cause any effect; I am still 
 getting the breadcrumbId header in the HTTP response headers.
 
 
 Best regards,
 Alex soto
 
 
 
 
 
 
 -- 
 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/



Remove breadcrumbId from Rest Service Response Headers

2015-06-10 Thread Alex Soto
Hi there,

Is there a way to remove the “breadcrumbId header from the Rest Service 
response?

I am using Camel 2.15.1
Here is my Route :

onException
exceptionjava.lang.Exception/exception
redeliveryPolicy maximumRedeliveries=1 /
handled
constanttrue/constant
/handled
camel:setHeader headerName=CamelHttpResponseCode
constant500/constant
/camel:setHeader
camel:setBody
constant/constant
/camel:setBody
camel:removeHeader headerName=breadcrumbId/
/onException

rest path=/
post uri=test
to uri=direct:test /
/post
/rest

route
from uri=direct:test /
throttle 
asyncDelayed=false 
callerRunsWhenRejected=false 
rejectExecution=true
timePeriodMillis=1000
constant1/constant


unmarshal ref=myDataFormat/
removeHeader  headerName=breadcrumbId/
/throttle
/route


Adding the removeHeaders does not seem to cause any effect; I am still getting 
the breadcrumbId header in the HTTP response headers.

 
Best regards,
Alex soto





Re: Using shared Netty configuration with Rest DSL

2015-05-22 Thread Alex Soto
It is working now.  Thanks!

Best regards,
Alex soto

 On May 22, 2015, at 3:53 AM, Willem Jiang willem.ji...@gmail.com wrote:
 
 You can setup the endpoint property just like this
 
 restConfiguration component=netty4-http” 
 camel:componentProperty key=“configuration value=#configuration/ 
 camel:endpointProperty key=“nettySharedHttpServer 
 value=#sharedNettyHttpServer/
 camel:endpointProperty key=“securityConfiguration 
 value=“#securityConfiguration/ 
 /restConfiguration 
 
 BTW, you need to create the securityConfiguration yourself.
 
 
 
 --  
 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 May 22, 2015 at 3:06:20 AM, Alex Soto (alex.s...@envieta.com) wrote:
 I would like to reuse the same Netty Service that is configured outside of 
 the Rest DSL.  
 For example I have the Netty and SSL configuration:
 
 
 
 
 type=JKS provider=SUN/
 
 
 type=JKS provider=SUN/
 
 
 
 
 
 
 
 
 
 
 
 init-method=start destroy-method=stop
 
 
 
 
 Now in my Camel Context I declare the Rest DSL:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 However, it does not seem to be picking up the shared configuration. Log 
 file shows:
 
 BootstrapFactory on port 0 is using bootstrap configuration: 
 [NettyServerBootstrapConfiguration{protocol='tcp',  
 host=‘X.local', port=0, broadcast=false, sendBufferSize=65536, 
 receiveBufferSize=65536,  
 receiveBufferSizePredictor=0, workerCount=0, bossCount=1, keepAlive=true, 
 tcpNoDelay=true,  
 reuseAddress=true, connectTimeout=1, backlog=0, 
 serverInitializerFactory=org.apache.camel.component.netty4.http.HttpServerInitializerFactory@2db0d008,
   
 nettyServerBootstrapFactory=null, options=null, ssl=false, sslHandler=null,  
 sslContextParameters='null', needClientAuth=false, 
 enabledProtocols='TLSv1,TLSv1.1,TLSv1.2,  
 keyStoreFile=null, trustStoreFile=null, keyStoreResource='null', 
 trustStoreResource='null',  
 keyStoreFormat='JKS', securityProvider='SunX509', passphrase='null', 
 bossGroup=null,  
 workerGroup=null, networkInterface='null’}]
 
 I could not find any examples of how to accomplish this. Any hints?
 
 Best regards,
 Alex soto
 



Using shared Netty configuration with Rest DSL

2015-05-21 Thread Alex Soto
I would like to reuse the same Netty Service that is configured outside of the 
Rest DSL.  For example I have the Netty and SSL configuration:


camel:sslContextParameters id=sslParams
 camel:keyManagers keyPassword=changeit
   camel:keyStore resource={{env:HOME}}/localhost.jks password=changeit 
type=JKS provider=SUN/
 /camel:keyManagers
 camel:trustManagers
   camel:keyStore resource={{env:HOME}}/localhost.jks password=changeit 
type=JKS provider=SUN/
 /camel:trustManagers
/camel:sslContextParameters

bean id=configuration 
class=org.apache.camel.component.netty4.http.NettySharedHttpServerBootstrapConfiguration
   property name=port value=8890/
   property name=host value=0.0.0.0/
   property name=backlog value=50/
   property name=sslContextParameters ref=sslParams/
   property name=ssl value=true/
/bean

bean id=sharedNettyHttpServer 
class=org.apache.camel.component.netty4.http.DefaultNettySharedHttpServer 
init-method=start destroy-method=stop
   property name=nettyServerBootstrapConfiguration ref=configuration/
/bean


Now in my Camel Context I declare the Rest DSL:


camelContext id=camel-context-name trace=true 
xmlns=http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring

 restConfiguration component=netty4-http  
  camel:componentProperty key=nettySharedHttpServer 
value=#sharedNettyHttpServer/
  componentProperty key=nettyServerBootstrapConfiguration 
value=#configuration/
  camel:endpointProperty key=nettyServerBootstrapConfiguration 
value=#configuration/
 /restConfiguration
  
 rest path=/customers/
get uri=/{id}
to uri=direct:getCustomers/
/get
get uri=/{id}/orders
to uri=direct:getCustomerOrders/
/get
post uri=/neworder
to uri=direct:newOrder/
/post
/rest


However, it does not seem to be picking up the shared configuration.  Log file 
shows:

BootstrapFactory on port 0 is using bootstrap configuration: 
[NettyServerBootstrapConfiguration{protocol='tcp', host=‘X.local', port=0, 
broadcast=false, sendBufferSize=65536, receiveBufferSize=65536, 
receiveBufferSizePredictor=0, workerCount=0, bossCount=1, keepAlive=true, 
tcpNoDelay=true, reuseAddress=true, connectTimeout=1, backlog=0, 
serverInitializerFactory=org.apache.camel.component.netty4.http.HttpServerInitializerFactory@2db0d008,
 nettyServerBootstrapFactory=null, options=null, ssl=false, sslHandler=null, 
sslContextParameters='null', needClientAuth=false, 
enabledProtocols='TLSv1,TLSv1.1,TLSv1.2, keyStoreFile=null, 
trustStoreFile=null, keyStoreResource='null', trustStoreResource='null', 
keyStoreFormat='JKS', securityProvider='SunX509', passphrase='null', 
bossGroup=null, workerGroup=null, networkInterface='null’}]

I could not find any examples of how to accomplish this.  Any hints?

Best regards,
Alex soto