Re: Established Java DSL route into Camel Spring OSGi container - for use with Kataf container

2018-09-05 Thread Francois Papon
Hi,

As Quinn say, you can use Blueprint in Karaf.

If you are new on Karaf, you can start by looking at the examples in the
distribution :

https://karaf.apache.org/documentation.html

regards,

François Papon
fpa...@apache.org

Le 05/09/2018 à 17:17, John F. Berry a écrit :
> Thanks Quinn, 
> I haven't converted my jar at all.. I've only packaged my camel java DSL 
> project into an executable jar from maven.
> So I think you're giving me step #2 of a process if I already converted my 
> jar to an OSGi bundle.  I haven't and don't know offhand how to.
> If I had this jar as an OSGi bundle, couldn't I simply place it in the deploy 
> folder of Karaf?  
>
> Sorry folks!  I know this is a Camel thread not a Karaf or OSGi forum.
>
>
> On Wednesday, September 5, 2018, 9:10:33 AM EDT, Quinn Stevenson 
>  wrote: 
>
>
>
> The easiest way to bootstrap a route in Karaf is to use Blueprint.  I’m 
> assuming you’ve already converted your jar to an OSGi bundle.
>
> If you add a small XML file to src/main/resources/OSGI-INF/blueprint 
> (assuming you’re using Maven for this) the route should startup in Karaf when 
> you install your bundle.  The XML file will look something like this
>
> 
> http://www.osgi.org/xmlns/blueprint/v1.0.0";>
>
>   
>
>   http://camel.apache.org/schema/blueprint";>
>       
>   
>
> 
>
> HTH
>
>
>> On Sep 4, 2018, at 10:10 AM, John F. Berry  
>> wrote:
>>
>> I've posted a few questions over the past month about various steps in a 
>> camel route.  I had developed both a Spring version and a Java DSL version 
>> simultaneously at the beginning, because of either the lack or abundance of 
>> certain endpoint development in each.  The Java DSL version  worked out best 
>> in the continuing development, but then the "powers that be" asked me to 
>> make a Windows service for it.  
>> I ended up being able to package it to en executable jar, but then found 
>> that perhaps I should use Karaf as an OSGi container run as a windows 
>> service.  I have Karaf installed with it's awaiting service container, but 
>> it looks like it's a pain to configure a Camel Java DSL route to an OSGi 
>> container, but what I did seem to find was people have used a Spring OSGi 
>> Camel package and overrode the configuration to execute a java "bean".
>> My question is:  Can the entire Camel Context developed in Spring be pointed 
>> to the completed Java DSL developed package?  Can I just add a shell around 
>> my already completed work?  My route runs fine from maven using "mvn 
>> exec:java" or running java - jar  .
>> Now that I got this running, I'd rather not disassemble and re-wire, 
>> although it would be a good educational experience. 
>>
>> MyRouteBuilder.java :
>>
>> import java.util.Base64;
>> import org.apache.camel.spi.DataFormat;
>>
>>
>> import ca.uhn.hl7v2.parser.Parser;
>> import org.apache.commons.dbcp2.BasicDataSource;
>> import org.apache.camel.component.sql.SqlComponent;
>>
>> public class MyRouteBuilder extends RouteBuilder {
>>     @Override
>>     public void configure() throws Exception {
>>                 BasicDataSource basicDataSource = new BasicDataSource();
>>                 
>> basicDataSource.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
>>                 
>> basicDataSource.setUrl("jdbc:sqlserver://XXX:52739;databaseName=XXX;");
>>                 basicDataSource.setUsername("XXX");
>>                 basicDataSource.setPassword("XXX");
>>                 SqlComponent sqlComponent = new SqlComponent();
>>                 sqlComponent.setDataSource(basicDataSource);
>>                 getContext().addComponent("psoft-sql", sqlComponent);
>>
>>
>>         from("mllp://ZZZ:")
>>         .log("..Received HL7 message with control id 
>> ${header.CamelMllpMessageControlId}")
>>         .convertBodyTo(String.class)
>>         .unmarshal()
>>         .hl7(false)
>>         .process(new Processor() {
>>           public void process(Exchange exchange) throws Exception {
>>           Message message = exchange.getIn().getBody(Message.class);
>>           ca.uhn.hl7v2.util.Terser terser = new Terser(message);
>>           String obx5 = terser.get("/.OBX-5-5");
>>           String EDMId = terser.get("/.OBR-3") + ".pdf";
>>           String voucher = terser.get("/.OBR-2");
>>
>>           byte[] decoded = Base64.getDecoder().decode(obx5);
>>           exchange.getOut().setBody(decoded);
>>           exchange.getOut().setHeader("voucher", voucher);
>>           exchange.getOut().setHeader("CamelFileName", EDMId );
>>             }
>>           } )
>>       .log("..Processed voucher ${header.voucher} to file 
>> ${header.CamelFileName}")
>>       .to("file:target/messages/others")
>>       .recipientList(simple("psoft-sql:INSERT INTO lawsonprod.PeopleSoftVCR 
>> (Voucher, Facility, image) VALUES ('12345', '1', 
>> '${header.CamelFileName}')") )
>>       ;
>>
>>     }
>>
>> }
>>
>> POM.xml (given there's a lot of extras in here not used due to attempts 
>> during devel

***UNCHECKED*** Re: OSGI component not in Camel registry

2018-09-19 Thread Francois Papon
Hi,

The annotations @Component is for Declarative Service.

As Claus say, Camel support OSGi Blueprint so you have to declare your
component and your Camel context in a blueprint.xml

Regards,

François Papon
fpa...@apache.org

Le 19/09/2018 à 14:42, Claus Ibsen a écrit :
> Hi
>
> How are you running this in OSGi - eg are you using camel-blueprint or
> something?
>
> For OSGi we generally only support OSGi blueprint and therefore you
> should setup your beans in the xml file as .
>
> For any kind of @Component scanning in OSGi then I dont think its
> something we tend to use so much, or if so then maybe there is
> something
> you need to turn on in the OSGi blueprint xml file to enable this or
> what else may be required.
>
>
> On Thu, Sep 13, 2018 at 6:34 PM Rajith Muditha Attapattu
>  wrote:
>> I have a bean marked as follows
>> @Component(immediate = true, service = AggregationStrategy.class, property
>> = "name=myAggStrategy")
>>
>> Component is of type org.osgi.service.component.annotations.Component
>>
>> When my camel context is loaded it complains that it cannot find "
>> myAggStrategy".
>> It seems like I'm either using the wrong annotation or missing a step.
>>
>> Is there an example around this? Wondering what I'm missing.
>>
>> Regards,
>>
>> Rajith Muditha Attapattu 
>
>



Re: Camel 2.22.2 with bundle camel-elasticsearch-rest error

2019-01-24 Thread Francois Papon
Hi,

You can try to temporary fix it by using dynamic import:

https://karaf.apache.org/manual/latest/#_dynamic_import

Regards,

François Papon
fpa...@apache.org

Le 24/01/2019 à 13:31, Michele Andreoli a écrit :
> I'm trying to use the camel bundle camel-elasticsearch-rest in a karaf
> 4.2.2 environment.
>
> The camel version installed on my karaf environment is the 2.22.2.
> When I'm installing the camel bundle camel-elasticsearch-rest
> everything goes well and it install automatically its dependencies:
> - org.apache.servicemix.bundles.elasticsearch
> (org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch/6.1.1_1)
> - org.apache.servicemix.bundles.elasticsearch-client
> (org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch-client/6.1.1_1)
> - org.apache.httpcomponents.httpasyncclient
> (org.apache.httpcomponents/httpasyncclient-osgi/4.1.3)
> - org.apache.httpcomponents.httpclient
> (org.apache.httpcomponents/httpclient-osgi/4.5.5)
> - org.apache.httpcomponents.httpcore
> (org.apache.httpcomponents/httpcore-osgi/4.4.9)
>
> http://it.tinypic.com/r/i2tzc9/9
>
>
>
> In my code I call the camel-elasticsearch-rest in this way:
>
> import org.apache.camel.CamelContext;
> import org.apache.camel.builder.RouteBuilder;
>
> public class ServiceRouteBuilder extends RouteBuilder {
>
> @Override
> public void configure() throws Exception {
>
> CamelContext context = this.getContext();
> restConfiguration()
> .component("jetty")
> .host("localhost")
> .port(8200)
> .contextPath("/api")
> .dataFormatProperty("prettyPrint", "true")
> .apiProperty("cors", "true");
>
> rest("/elastic/test")
> .get("/")
> .route()
> .setBody(simple("{ \"indexName\": \"test-index\" }"))
>
> .to("elasticsearch-rest://elasticsearch?hostAddresses=127.0.0.1:9200&operation=INDEX&indexName=test-index&indexType=sample");
> }
> }
>
>
>
> I have installed my jar bundle on karaf, but when camel context
> starting I'm receiving this warning that cause the camel routes
> shutdown:
>
> 09:58:44.595 WARN [fileinstall-C:\Program
> Files\apache-karaf\4.2.2/deploy] Listener caused an exception, will be
> ignored
> java.util.concurrent.ExecutionException:
> java.lang.NoClassDefFoundError: org/apache/http/client/AuthCache
> at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:?]
> at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:?]
> at 
> java.util.concurrent.AbstractExecutorService.doInvokeAny(AbstractExecutorService.java:193)
> ~[?:?]
> at 
> java.util.concurrent.AbstractExecutorService.invokeAny(AbstractExecutorService.java:225)
> ~[?:?]
> at 
> org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$4.call(ScheduledExecutorServiceWrapper.java:185)
> ~[44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper$15.call(ScheduledExecutorServiceWrapper.java:446)
> ~[44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.utils.threading.RWLock.runReadOperation(RWLock.java:33)
> ~[44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.runUnlessShutdown(ScheduledExecutorServiceWrapper.java:443)
> ~[44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.utils.threading.ScheduledExecutorServiceWrapper.invokeAny(ScheduledExecutorServiceWrapper.java:180)
> ~[44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.container.BlueprintEventDispatcher.callListener(BlueprintEventDispatcher.java:188)
> [44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.container.BlueprintEventDispatcher.callListeners(BlueprintEventDispatcher.java:178)
> [44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.container.BlueprintEventDispatcher.blueprintEvent(BlueprintEventDispatcher.java:133)
> [44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:427)
> [44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:278)
> [44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:299)
> [44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:268)
> [44:org.apache.aries.blueprint.core:1.10.1]
> at 
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:2

Re: [DISCUSS] - Apache Camel 3 - A new tagline

2019-02-20 Thread Francois Papon
Hi,

I'm agree with Guillaume about not focuses too much on cloud, Camel can
be use in many other cases.

We can also have:

"Integrate the world" or "Integrate your business"

It's just ideas and may be too "enterprise"...

regards,

François Papon
fpa...@apache.org

Le 20/02/2019 à 11:38, Guillaume Nodet a écrit :
>> Apache Camel 3 - A full-stack integration framework for building
>> cloud-native micro integrations
>>
> I think the proposed tagline focuses too much on cloud, and even if that's
> definitely something we want to emphasize in the set of capabilities that
> Camel provides, having it in the tag line kinda implies that Camel is
> mainly focusing on cloud and not traditional integration.
>
>
>> "Integrate everything"
>> "Integrate everything without humps" ;-)
>>
> +1 I like both a lot.
>
> In the same direction, and to keep the versatile side we could have:
>   "Integrate everything everywhere"
> but not sure it's better.
>
> Guillaume
>
> Le mer. 20 févr. 2019 à 08:28, Burkard Stephan 
> a écrit :
>
>> Hi all
>>
>> +1 for "Integrate everything!"
>> because it is short, catchy and it refers to Camels outstanding
>> versatility with its hundreds of components.
>>
>> It is true that Camel has a lot of other noteworthy features like runtime
>> flexibility etc. but as soon as the tagline wants to cover multiple things,
>> it gets "bulky" or "buzzwordy".
>>
>> To link the tagline back to the project name and add a pinch of humor it
>> could also be
>> "Integrate everything without humps" ;-)
>>
>
>> -Ursprüngliche Nachricht-
>> Von: Steve Huston 
>> Gesendet: Dienstag, 19. Februar 2019 18:32
>> An: users@camel.apache.org
>> Betreff: RE: [DISCUSS] - Apache Camel 3 - A new tagline
>>
>> "Integrate everything!"
>>
>>> -Original Message-
>>> From: Claus Ibsen 
>>> Sent: Tuesday, February 19, 2019 10:52 AM
>>> To: users@camel.apache.org
>>> Subject: [DISCUSS] - Apache Camel 3 - A new tagline
>>>
>>> Hi
>>>
>>> As part of Apache Camel 3, we are working on a new modern website
>>> (yeah its long overdue, but work are in progress).
>>>
>>> As part of that, we should get a new front-page with a new short
>>> summary what Apache Camel is (eg a tagline).
>>>
>>> It would be good to get some ideas rolling what such a tagline could
>>> be and for users of Camel to come up with suggestions.
>>>
>>> As Apache Camel has been around for so long, and that it covers so
>>> many different use-cases, then its maybe harder to come up with a
>>> single tag-line that spans all use-cases.
>>>
>>> However with the new modern world of containers I came up with:
>>>
>>> * Apache Camel 3 - A full-stack integration framework for building
>>> cloud- native micro integrations
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> -
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2: https://www.manning.com/ibsen2
>



[java-dsl] - RouteBuilder

2019-05-19 Thread Francois Papon
Hi,

I'm trying to use a RouteDefintion to configure a RouteBuilder and it
doesn't work.

It works by setting the route in the first test but the endpoint is not
publish in the second test...

Any ideas?


@Test
    public void publishHttpCamelContextTest() throws Exception {
    CamelContext camelContext = new DefaultCamelContext();
    Assertions.assertNotNull(camelContext);

    DefaultCamelContext.class.cast(camelContext).setName("camel-labs");
    camelContext.start();
    Assertions.assertTrue(camelContext.getStatus().isStarted());
    System.out.println("camel context started");

    RouteBuilder routeBuilder = new RouteBuilder() {
    @Override
    public void configure() throws Exception {

    from("jetty:http://localhost:9090/labs";).
    id("jetty-example").
   
setHeader(Exchange.HTTP_RESPONSE_CODE,constant(200)).
    setBody(constant("it works well!"));
    }
    };
    camelContext.addRoutes(routeBuilder);
    System.out.println("camel routes jetty added ->
http://localhost:9090/labs";);
    Thread.sleep(1L);
    }

    @Test
    public void publishHttpCamelContextWithDefinitionTest() throws
Exception {
    CamelContext camelContext = new DefaultCamelContext();
    Assertions.assertNotNull(camelContext);

    DefaultCamelContext.class.cast(camelContext).setName("camel-labs");
    camelContext.start();
    Assertions.assertTrue(camelContext.getStatus().isStarted());
    System.out.println("camel context started");

    final RouteDefinition definition = new RouteDefinition();
   
definition.from("jetty:http://localhost:9090/labs";).id("jetty-example").
    setHeader(Exchange.HTTP_RESPONSE_CODE,constant(200)).
    setBody(constant("it works well!"));

    RouteBuilder routeBuilder = new RouteBuilder() {
    @Override
    public void configure() throws Exception {
    System.out.println(definition);
    configureRoute(definition);
    }
    };
    camelContext.addRoutes(routeBuilder);
    System.out.println("camel routes with definition jetty added ->
http://localhost:9090/labs";);
    Thread.sleep(1L);
    }

regards,

-- 
François
fpa...@apache.org



Re: [java-dsl] - RouteBuilder

2019-05-19 Thread Francois Papon
Hi Claus,

It works very well now :)

Thanks for your help!

regards,

François
fpa...@apache.org

Le 20/05/2019 à 08:10, Claus Ibsen a écrit :
> Hi
>
> You should add the definition via camel context api and not try to add
> it via the route builder.
>
>
> On Mon, May 20, 2019 at 5:47 AM Francois Papon
>  wrote:
>> Hi,
>>
>> I'm trying to use a RouteDefintion to configure a RouteBuilder and it
>> doesn't work.
>>
>> It works by setting the route in the first test but the endpoint is not
>> publish in the second test...
>>
>> Any ideas?
>>
>>
>> @Test
>> public void publishHttpCamelContextTest() throws Exception {
>> CamelContext camelContext = new DefaultCamelContext();
>> Assertions.assertNotNull(camelContext);
>>
>> DefaultCamelContext.class.cast(camelContext).setName("camel-labs");
>> camelContext.start();
>> Assertions.assertTrue(camelContext.getStatus().isStarted());
>> System.out.println("camel context started");
>>
>> RouteBuilder routeBuilder = new RouteBuilder() {
>> @Override
>> public void configure() throws Exception {
>>
>> from("jetty:http://localhost:9090/labs";).
>> id("jetty-example").
>>
>> setHeader(Exchange.HTTP_RESPONSE_CODE,constant(200)).
>> setBody(constant("it works well!"));
>> }
>> };
>> camelContext.addRoutes(routeBuilder);
>> System.out.println("camel routes jetty added ->
>> http://localhost:9090/labs";);
>> Thread.sleep(1L);
>> }
>>
>> @Test
>> public void publishHttpCamelContextWithDefinitionTest() throws
>> Exception {
>> CamelContext camelContext = new DefaultCamelContext();
>> Assertions.assertNotNull(camelContext);
>>
>> DefaultCamelContext.class.cast(camelContext).setName("camel-labs");
>> camelContext.start();
>> Assertions.assertTrue(camelContext.getStatus().isStarted());
>> System.out.println("camel context started");
>>
>> final RouteDefinition definition = new RouteDefinition();
>>
>> definition.from("jetty:http://localhost:9090/labs";).id("jetty-example").
>> setHeader(Exchange.HTTP_RESPONSE_CODE,constant(200)).
>> setBody(constant("it works well!"));
>>
>> RouteBuilder routeBuilder = new RouteBuilder() {
>> @Override
>> public void configure() throws Exception {
>> System.out.println(definition);
>> configureRoute(definition);
>> }
>> };
>> camelContext.addRoutes(routeBuilder);
>> System.out.println("camel routes with definition jetty added ->
>> http://localhost:9090/labs";);
>> Thread.sleep(1L);
>> }
>>
>> regards,
>>
>> --
>> François
>> fpa...@apache.org
>>
>


Re: [java-dsl] - RouteBuilder

2019-05-19 Thread Francois Papon
Just for sharing, here the code working:

@Test
    public void publishHttpCamelContextWithDefinitionTest() throws
Exception {
    CamelContext camelContext = new DefaultCamelContext();
    Assertions.assertNotNull(camelContext);

    DefaultCamelContext.class.cast(camelContext).setName("camel-labs");
    camelContext.start();
    Assertions.assertTrue(camelContext.getStatus().isStarted());
    System.out.println("camel context started");

    final RouteDefinition definition = new RouteDefinition();
   
definition.from("jetty:http://localhost:9090/labs";).id("jetty-example").
    setHeader(Exchange.HTTP_RESPONSE_CODE,constant(200)).
    setBody(constant("it works well!"));

   
DefaultCamelContext.class.cast(camelContext).addRouteDefinition(definition);
    System.out.println("camel routes with definition jetty added ->
http://localhost:9090/labs";);
    Thread.sleep(1L);
    }

regards,

François
fpa...@apache.org

Le 20/05/2019 à 08:47, Francois Papon a écrit :
> Hi Claus,
>
> It works very well now :)
>
> Thanks for your help!
>
> regards,
>
> François
> fpa...@apache.org
>
> Le 20/05/2019 à 08:10, Claus Ibsen a écrit :
>> Hi
>>
>> You should add the definition via camel context api and not try to add
>> it via the route builder.
>>
>>
>> On Mon, May 20, 2019 at 5:47 AM Francois Papon
>>  wrote:
>>> Hi,
>>>
>>> I'm trying to use a RouteDefintion to configure a RouteBuilder and it
>>> doesn't work.
>>>
>>> It works by setting the route in the first test but the endpoint is not
>>> publish in the second test...
>>>
>>> Any ideas?
>>>
>>>
>>> @Test
>>> public void publishHttpCamelContextTest() throws Exception {
>>> CamelContext camelContext = new DefaultCamelContext();
>>> Assertions.assertNotNull(camelContext);
>>>
>>> DefaultCamelContext.class.cast(camelContext).setName("camel-labs");
>>> camelContext.start();
>>> Assertions.assertTrue(camelContext.getStatus().isStarted());
>>> System.out.println("camel context started");
>>>
>>> RouteBuilder routeBuilder = new RouteBuilder() {
>>> @Override
>>> public void configure() throws Exception {
>>>
>>> from("jetty:http://localhost:9090/labs";).
>>> id("jetty-example").
>>>
>>> setHeader(Exchange.HTTP_RESPONSE_CODE,constant(200)).
>>> setBody(constant("it works well!"));
>>> }
>>> };
>>> camelContext.addRoutes(routeBuilder);
>>> System.out.println("camel routes jetty added ->
>>> http://localhost:9090/labs";);
>>> Thread.sleep(1L);
>>> }
>>>
>>> @Test
>>> public void publishHttpCamelContextWithDefinitionTest() throws
>>> Exception {
>>> CamelContext camelContext = new DefaultCamelContext();
>>> Assertions.assertNotNull(camelContext);
>>>
>>> DefaultCamelContext.class.cast(camelContext).setName("camel-labs");
>>> camelContext.start();
>>> Assertions.assertTrue(camelContext.getStatus().isStarted());
>>> System.out.println("camel context started");
>>>
>>> final RouteDefinition definition = new RouteDefinition();
>>>
>>> definition.from("jetty:http://localhost:9090/labs";).id("jetty-example").
>>> setHeader(Exchange.HTTP_RESPONSE_CODE,constant(200)).
>>> setBody(constant("it works well!"));
>>>
>>> RouteBuilder routeBuilder = new RouteBuilder() {
>>> @Override
>>> public void configure() throws Exception {
>>> System.out.println(definition);
>>> configureRoute(definition);
>>> }
>>> };
>>> camelContext.addRoutes(routeBuilder);
>>> System.out.println("camel routes with definition jetty added ->
>>> http://localhost:9090/labs";);
>>> Thread.sleep(1L);
>>> }
>>>
>>> regards,
>>>
>>> --
>>> François
>>> fpa...@apache.org
>>>


Re: Deploy custom Camel code on Apache Karaf

2019-10-04 Thread Francois Papon
Hi,

You have some examples here:

https://github.com/apache/karaf/tree/master/examples/karaf-camel-example

regards,

François
fpa...@apache.org

Le 04/10/2019 à 14:22, Kirti Arora a écrit :
> Hi,
>
> I'm trying to deploy my camel code(Java) on Apache Karaf. I had put my
> camel code bundle to deploy directory of Karaf but not able to find routes
> available in the code, also not able to request the endpoints.
>
> Can someone please guide me, how can I deploy camel code on Apache Karaf?
> It would be very helpful if someone can provide me an example.
>
> Thanks,
> Kirti Arora
>


Re: Stack trace after upgrading to Camel 3.0

2020-01-10 Thread Francois Papon
Hi,

Can you try with the 3.1.0-SNAPSHOT and the -U maven option?

regards,

François
fpa...@apache.org

Le 10/01/2020 à 16:02, Tom Coudyzer a écrit :
> Hi,
>
> Still no luck. Changed it to camel-core-engine and cleared the Maven cache
> after that.
>
> This is the code I'm testing (route + JUnit test)
>
> Test
> =
>
> import java.util.HashMap;
>
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.test.junit4.CamelTestSupport;
> import org.junit.Test;
>
> import com.google.gson.JsonObject;
>
> import camel.samples.routes;
> import camel.samples.utils.GsonUtils;
>
> public class APIRouteTest extends CamelTestSupport {
>
> @Override
>protected RouteBuilder createRouteBuilder() throws Exception {
>return new APIRoute();
>}
>
>
> @Test
> public void testResponseHasId() {
>
>  HashMap headers = new HashMap<>();
>  headers.put("apiURL","http://127.0.0.1:18002/api/rest/metadata";);
>
>  String apiResponse = template.requestBodyAndHeaders("direct:apiCall",
> "", headers, String.class);
>
>  JsonObject jsonObject = GsonUtils.fromJson( apiResponse,
> JsonObject.class);
>
>  assertTrue("Id key exists.", jsonObject.has("id"));
>
> }
>
>
> Route
> ==
>
> import org.apache.camel.Exchange;
> import org.apache.camel.builder.RouteBuilder;
>
>
> public class APIRoute extends RouteBuilder {
>
> @Override
> public void configure() throws Exception {
>
> from("direct:apiCall")
> .log("URL -> ${header.apiURL}")
> .to("log:?level=INFO&showBody=true")
> .setHeader(Exchange.HTTP_METHOD, constant("GET"))
> .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
> .toD("${header.apiURL}")
> .to("log:?level=INFO&showBody=true");
>
> }
>
> On Fri, Jan 10, 2020 at 3:54 PM Andrea Cosentino  wrote:
>
>> Change camel-core to camel-core-engine.
>>
>> Il giorno ven 10 gen 2020 alle ore 15:48 Tom Coudyzer 
>> ha scritto:
>>
>>> Hi,
>>>
>>> This is the POM
>>>
>>> http://maven.apache.org/POM/4.0.0";
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>>> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>>> 4.0.0
>>> com.xyz
>>> camel.samples
>>> 0.0.1-SNAPSHOT
>>> pom
>>>
>>> 
>>> UTF-8
>>> 11
>>> 11
>>> 3.0.0
>>> 1.7.29
>>> 5.15.10
>>> 2.10.0
>>> 5.1.6.RELEASE
>>> 2.1.4.RELEASE
>>> 4.12
>>> 1.4.0.Final
>>> 1.5.10
>>> 0.1.1
>>> 
>>>
>>> 
>>>
>>> 
>>> 
>>> org.apache.camel
>>> camel-core
>>> ${camel-version}
>>> 
>>> 
>>> org.apache.camel
>>> camel-jms
>>> ${camel-version}
>>> 
>>> 
>>> org.apache.camel
>>> camel-http
>>> ${camel-version}
>>> 
>>>
>>> 
>>> 
>>> org.apache.activemq
>>> activemq-all
>>> ${activemq-version}
>>> 
>>>
>>> 
>>> com.fasterxml.jackson.core
>>> jackson-databind
>>> ${jackson-version}
>>> 
>>>
>>> 
>>> 
>>> org.springframework
>>> spring-context
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-test
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-core
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-beans
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-web
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-aop
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-jdbc
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-orm
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-jms
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-context-support
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-tx
>>> ${spring-version}
>>> 
>>> 
>>> org.springframework
>>> spring-expression
>>> ${spring-version}
>>> 
>>>
>>> 
>>> 
>>> junit
>>> junit
>>> ${junit-version}
>>> 
>>>
>>> 
>>> org.apache.camel
>>> camel-test
>>> ${camel-version}
>>> test
>>> 
>>> 
>>> org.apache.camel
>>> camel-test-spring
>>> ${camel-version}
>>> test
>>> 
>>>
>>> 
>>> 
>>> org.slf4j
>>> slf4j-log4j12
>>> ${slf4j-version}
>>> 
>>>
>>> 
>>> com.google.code.gson
>>> gson
>>> 2.8.6
>>> 
>>>
>>> 
>>> 
>>> io.undertow
>>> undertow-core
>>> ${version.undertow}
>>> 
>>>
>>> 
>>> io.undertow
>>> undertow-core
>>> ${version.undertow}
>>> test-jar
>>> test
>>> 
>>>
>>> 
>>> io.undertow
>>> undertow-servlet
>>> 1.4.13.Final
>>> 
>>>
>>> 
>>>   org.apache.httpcomponents
>>>   httpclient
>>>   4.3.6
>>> 
>>>
>>> 
>>> 
>>> io.swagger
>>> swagger-annotations
>>> ${version.swagger}
>>> 
>>>
>>> 
>>> com.networknt
>>> server
>>> ${version.framework}
>>> 
>>>
>>> 
>>> 
>>> com.sun.activation
>>> javax.activation
>>> 1.2.0
>>> 
>>>
>>> 
>>>
>>> Camel Samples
>>> Camel Samples - POC
>>> 
>>> camel.samples.poc
>>> 
>>> 
>>>
>>> On Fri, Jan 10, 2020 at 3:36 PM Andrea Cosentino
>>>  wrote:
>>>
 What is your POM?
 --Andrea Cosentino --Apache Camel PMC
 ChairApache Karaf CommitterApache Servicemix PMC MemberEmail:
 ancosen1985@yahoo.comTwitte

Re: Stack trace after upgrading to Camel 3.0

2020-01-10 Thread Francois Papon
Any chances to share your project?

I can try to reproduce.

regards,

François
fpa...@apache.org

Le 10/01/2020 à 17:26, Tom Coudyzer a écrit :
> Thanks, got the 3.1.0-SNAPSHOTS libraries now on the classpath but still
> the same issue.
>
> On Fri, Jan 10, 2020 at 4:23 PM Andrea Cosentino  wrote:
>
>> The snapshot repository is
>>
>> https://repository.apache.org/snapshots/
>>
>> You can also try to build Camel locally.
>>
>> Il giorno ven 10 gen 2020 alle ore 16:21 Tom Coudyzer 
>> ha scritto:
>>
>>> Hi,
>>>
>>> Sorry but, what is the plugin repository for getting access to the
>> SNAPSHOT
>>> via Maven, guess it's not available from mvnrepository.com?
>>>
>>> Thank you. Regards /Tom
>>>
>>> On Fri, Jan 10, 2020 at 4:08 PM Francois Papon <
>>> francois.pa...@openobject.fr>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Can you try with the 3.1.0-SNAPSHOT and the -U maven option?
>>>>
>>>> regards,
>>>>
>>>> François
>>>> fpa...@apache.org
>>>>
>>>> Le 10/01/2020 à 16:02, Tom Coudyzer a écrit :
>>>>> Hi,
>>>>>
>>>>> Still no luck. Changed it to camel-core-engine and cleared the Maven
>>>> cache
>>>>> after that.
>>>>>
>>>>> This is the code I'm testing (route + JUnit test)
>>>>>
>>>>> Test
>>>>> =
>>>>>
>>>>> import java.util.HashMap;
>>>>>
>>>>> import org.apache.camel.builder.RouteBuilder;
>>>>> import org.apache.camel.test.junit4.CamelTestSupport;
>>>>> import org.junit.Test;
>>>>>
>>>>> import com.google.gson.JsonObject;
>>>>>
>>>>> import camel.samples.routes;
>>>>> import camel.samples.utils.GsonUtils;
>>>>>
>>>>> public class APIRouteTest extends CamelTestSupport {
>>>>>
>>>>> @Override
>>>>>protected RouteBuilder createRouteBuilder() throws Exception {
>>>>>return new APIRoute();
>>>>>}
>>>>>
>>>>>
>>>>> @Test
>>>>> public void testResponseHasId() {
>>>>>
>>>>>  HashMap headers = new HashMap<>();
>>>>>  headers.put("apiURL","http://127.0.0.1:18002/api/rest/metadata
>> ");
>>>>>  String apiResponse =
>>>> template.requestBodyAndHeaders("direct:apiCall",
>>>>> "", headers, String.class);
>>>>>
>>>>>  JsonObject jsonObject = GsonUtils.fromJson( apiResponse,
>>>>> JsonObject.class);
>>>>>
>>>>>  assertTrue("Id key exists.", jsonObject.has("id"));
>>>>>
>>>>> }
>>>>>
>>>>>
>>>>> Route
>>>>> ==
>>>>>
>>>>> import org.apache.camel.Exchange;
>>>>> import org.apache.camel.builder.RouteBuilder;
>>>>>
>>>>>
>>>>> public class APIRoute extends RouteBuilder {
>>>>>
>>>>> @Override
>>>>> public void configure() throws Exception {
>>>>>
>>>>> from("direct:apiCall")
>>>>> .log("URL -> ${header.apiURL}")
>>>>> .to("log:?level=INFO&showBody=true")
>>>>> .setHeader(Exchange.HTTP_METHOD, constant("GET"))
>>>>> .setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
>>>>> .toD("${header.apiURL}")
>>>>> .to("log:?level=INFO&showBody=true");
>>>>>
>>>>> }
>>>>>
>>>>> On Fri, Jan 10, 2020 at 3:54 PM Andrea Cosentino 
>>>> wrote:
>>>>>> Change camel-core to camel-core-engine.
>>>>>>
>>>>>> Il giorno ven 10 gen 2020 alle ore 15:48 Tom Coudyzer <
>>>> tcdm...@gmail.com>
>>>>>> ha scritto:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> This is the POM
>>>>>>>
>>>>>>> http://maven.apache.org/POM/4.0.0";
>>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance

Re: How Camel consumes files using multithreading

2021-10-25 Thread Francois Papon

Hi,

Did you try to add .threads() to your from("sftp") route?

regards,

Francois

On 25/10/2021 08:07, robbenp...@foxmail.com wrote:

Dear all,
  I am using Apache Camel to handle files from SFTP. Becausethere are too 
many file in the same directoty, I want to use multithreading to handle these 
files.

Hera is my code.
from("sftp://${sftp.username}:${sftp.password}@${sftp.host}:${sftp.port}/myDirectory?";
 +
 
"readLock=changed&readLockMinAge=10s&autoCreate=true&move=finish/$simple{date:now:MMdd}/$simple{file:onlyname}"
 +
 "&moveFailed=failed/$simple{date:now:MMdd}/$simple{file:onlyname}")
 .to("seda:img");

from("seda:img")
 .threads(5,20)
 .keepAliveTime(20)
 .process(parseTypeProcessor)
 .process(uploadToOSSProcessor)
 .process(saveImgProcessor)
 .end();
But it does not work.

 Is there any way to use multithreading  in Apache Camel?

 Any help or information that you can provide will be greatly appreciated.

Sincerely,
Robben


robbenp...@foxmail.com

Karaf/Camel camel-elasticsearch-rest component and Log4jShell

2022-01-03 Thread Francois Papon

Hi,

The Camel elasticsearch-rest-component depend on the version 7.10.2 of 
elasticsearch-client that has a dependency on log4j-core:2.13.3 and 
log4j-api:2.13.3


When installating the Karaf feature the log4j bundles are installed:

https://github.com/apache/camel-karaf/blob/e976acc7c1d6405b283ffe3e69d336aab854bd5b/pom.xml#L232

There is a comment about upgrading but with a warning about other 
features compatibility.


Does anyone has some information about this?

Do we need to upgrade?

The Elasticsearch team upgraded to log4j:2.17.0 on 7.16.2.

May be Servicemix bundle should be update too.

Regards,

Francois





Camel load resource from classloader broken

2022-01-03 Thread Francois Papon

Hi,

It seems like this commit broke the OSGi compatibility by loading 
resources from another classloader:


https://github.com/apache/camel/commit/11bd8012743868712904b449024344bcf8130d2b#diff-8514339d35970f5c1e68df154846a293656b9a482d332b7f4423755ba0d2b0f9

For example, when upgrading to Camel 3.14.0, we have this error when 
starting a quartz route endpoint:


Caused by: java.lang.RuntimeException: org.quartz.SchedulerException: 
Quartz properties file not found in classpath: org/quartz/quartz.properties


Regards,

Francois



Re: Camel load resource from classloader broken

2022-01-03 Thread Francois Papon

Hi JB,

Sure, here the Jira:

https://issues.apache.org/jira/browse/CAMEL-17425

Thanks for your help!

Regards,

François

On 03/01/2022 18:06, Jean-Baptiste Onofré wrote:

Hi François,

thanks for pointing this.

That's a *huge* regression impacting camel-karaf.
Definitely we have to fix that (I consider this regression as 
blocker/critical).


Can you create a Jira about that, I will fix that ?

Thanks,
Regards
JB

On 03/01/2022 17:35, Francois Papon wrote:

Hi,

It seems like this commit broke the OSGi compatibility by loading 
resources from another classloader:


https://github.com/apache/camel/commit/11bd8012743868712904b449024344bcf8130d2b#diff-8514339d35970f5c1e68df154846a293656b9a482d332b7f4423755ba0d2b0f9 



For example, when upgrading to Camel 3.14.0, we have this error when 
starting a quartz route endpoint:


Caused by: java.lang.RuntimeException: org.quartz.SchedulerException: 
Quartz properties file not found in classpath: 
org/quartz/quartz.properties


Regards,

Francois



Re: Karaf, Camel, and Spring

2023-04-28 Thread Francois Papon

Hi,

The Camel features are using a range for the Spring version:


    dependency='true'>mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1

    spring
    spring-tx
    camel-core
mvn:org.apache.camel/camel-core-xml/3.20.4
mvn:org.apache.camel/camel-spring/3.20.4
mvn:org.apache.camel/camel-spring-xml/3.20.4
  

So it will take the higher version of Spring available in Karaf.

Regards,

François

On 27/04/2023 19:37, Ephemeris Lappis wrote:

Hello.

We're upgrading Camel to 3.20.4. This version of Camel seems to depend
on Spring 5.3.27.

As the application should run on Karaf 4.4.3 that provides spring
components with version 5.3.23.

Should we either force our project dependencies to use Spring 5.3.23,
or try to upgrade the Karaf repository to use Spring 5.3.27 ?

Thanks for your help.

Regards.


Re: Karaf, Camel, and Spring

2023-04-28 Thread Francois Papon
Yes you can create your own feature.xml but it will depend on the 
lastest SMX bundle:


https://repo1.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.spring-core/

For now it's 5.3.26_1 so if you want to use the 5.3.27 you need to wait 
for the SMX release.


Regards,

On 28/04/2023 12:56, Ephemeris Lappis wrote:

Hello again.

Indeed, we could try to make our own feature repository to pull Spring
5.3.27, but I'm not very sure this is as easy as it seems : in fact I
think that features in the current Karaf repository, with version
"5.3.23.1", are all built with "service mix wrapped" bundles. I don't
know if we can easily create a 5.3.27 replacing repository.

Do you confirm ?

Thanks.

Regards

Le ven. 28 avr. 2023 à 10:14, Maurice Betzel
 a écrit :

Hi,

If there is no such feature XML like in maven central, you will have to create 
one yourself with the upped versions.
If your runtime has internet access, you can just drop that xml in deploy for 
provisioning.
As for the version numbering, the third digit(s), counted from left to right, 
represent bugfixes and must be binary compatible to the previous versions.

-Original Message-
From: Ephemeris Lappis 
Sent: Friday, April 28, 2023 9:59 AM
To: u...@karaf.apache.org
Cc: users@camel.apache.org
Subject: Re: Karaf, Camel, and Spring

  CAUTION: This email originated from outside of Gaston Schul. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.


Hello.

If I'm not wrong, most of Spring dependencies in Karaf come with this feature 
repository :

feature:provided mvn:org.apache.karaf.features/spring/4.4.3/xml/features
Name   │ Version
───┼─
spring │ 5.3.23.1
spring-aspects │ 5.3.23.1
spring-instrument  │ 5.3.23.1
spring-jdbc│ 5.3.23.1
spring-jms │ 5.3.23.1
spring-messaging   │ 5.3.23.1
spring-test│ 5.3.23.1
spring-orm │ 5.3.23.1
spring-oxm │ 5.3.23.1
spring-tx  │ 5.3.23.1
spring-web │ 5.3.23.1
spring-websocket   │ 5.3.23.1
spring-security│ 5.6.3.1
spring-security│ 5.7.3.1
aries-blueprint-spring │ 0.0.0

I don't know if another version of this repository exists that I could add in 
one of our features files before Spring (spring or
camel-spring) dependencies are resolved.

I don't know if changing the Karaf version of Spring to match the Camel version 
may have an impact on other features that do not relate to Camel...

Your point of view is welcome :) !

Thanks again.

Regards.

Le ven. 28 avr. 2023 à 09:04, Maurice Betzel  a 
écrit :

Hi,

You should be able to add the feature repo and install with version.
Something like this from the Karaf docs:

karaf@root()> feature:repo-add
mvn:org.ops4j.pax.jdbc/pax-jdbc-features/1.3.0/xml/features

-Original Message-
From: Ephemeris Lappis 
Sent: Thursday, April 27, 2023 7:37 PM
To: u...@karaf.apache.org; users@camel.apache.org
Subject: Karaf, Camel, and Spring

  CAUTION: This email originated from outside of Gaston Schul. Do not click 
links or open attachments unless you recognize the sender and know the content 
is safe.


Hello.

We're upgrading Camel to 3.20.4. This version of Camel seems to depend on 
Spring 5.3.27.

As the application should run on Karaf 4.4.3 that provides spring components 
with version 5.3.23.

Should we either force our project dependencies to use Spring 5.3.23, or try to 
upgrade the Karaf repository to use Spring 5.3.27 ?

Thanks for your help.

Regards.
Al onze verrichtingen geschieden op basis van de Algemene voorwaarden der 
Expediteurs van België, gepubliceerd in de bijlage tot het Belgisch Staatsblad 
dd. 24 juni 2005 onder nr. 0090237. De tekst van deze voorwaarden wordt op uw 
verzoek gratis toegezonden.
All our transactions are subject to the General Conditions of the Belgian Forwarders 
Association which have been published under nr. 0090237 in the "Bijlage tot het 
Belgisch Staatsblad" dated June 24th, 2005, and is available free of charge upon 
request.
Toutes nos opérations se font sur base des Conditions Générales des Expéditeurs 
de Belgique. Le texte en a été publié dans l' Annexe au Moniteur Belge du 24 
juin 2005 sous le n° 0090237. Ce texte sera vous envoyé gratuitment sur demande.
Email confidentiality notice:
This email and any files transmitted with it are confidential and intended only 
for the use of the recipient. If you have received this email in error please 
notify its sender.


Al onze verrichtingen geschieden op basis van de Algemene voorwaarden der 
Expediteurs van België, gepubliceerd in de bijlage tot het Belgisch Staatsblad 
dd. 24 juni 2005 onder nr. 0090237. De tekst van deze voorwaarden wordt op uw 
verzoek gratis toegezonden.
All our transactions are subject to the General Conditions of the Belgian Forwarders 
Association which have been published under nr. 0090237 in the "Bi

Re: Karaf, Camel, and Spring

2023-04-28 Thread Francois Papon

I think that 5.3.x unit tests are backward compatible so will not be broken.

On 28/04/2023 12:51, Ephemeris Lappis wrote:

Hello again.

François, I agree : the range [5,6) should allow Camel to use the 5.x
version that is available. But as the current Karaf repository comes
with 5.3.23, Camel routes in unit tests and at runtime do not use the
same Spring versions.

So, can we just ignore it, or do we have to adapt our projects to be
sure that something that passes successfully unit tests in 5.3.27 will
not be broken at runtime with 5.3.23 ???

Thanks.

Regards.

Le ven. 28 avr. 2023 à 10:12, Francois Papon
 a écrit :

Hi,

The Camel features are using a range for the Spring version:


  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  spring
  spring-tx
  camel-core
mvn:org.apache.camel/camel-core-xml/3.20.4
mvn:org.apache.camel/camel-spring/3.20.4
mvn:org.apache.camel/camel-spring-xml/3.20.4


So it will take the higher version of Spring available in Karaf.

Regards,

François

On 27/04/2023 19:37, Ephemeris Lappis wrote:

Hello.

We're upgrading Camel to 3.20.4. This version of Camel seems to depend
on Spring 5.3.27.

As the application should run on Karaf 4.4.3 that provides spring
components with version 5.3.23.

Should we either force our project dependencies to use Spring 5.3.23,
or try to upgrade the Karaf repository to use Spring 5.3.27 ?

Thanks for your help.

Regards.