Re: Code of calling rest service is not working

2019-07-29 Thread Jean-Baptiste Onofré
You can also use camel-cxfrs for rest server and/or client.

Regards
JB

Le 29 juil. 2019 à 15:36, à 15:36, Omar Al-Safi  a écrit:
>I am new to Camel as well, I was figuring things on the way :). First
>you
>need to use a REST component, you can use the REST DSL
>, however this is only a DSL
>not a
>actual http server, you will need to include an http server component
>as
>well (e.g:  camel-netty4-http, camel-restlet, camel-spark-rest ..etc),
>once
>you included it, you will need to tell Camel to use the specified
>component
>through the configuration RouteBuilder
>(e.g: restConfiguration().component("spark-rest").port(8000);). Also in
>your above example, the JVM will terminate immediately, and hence Camel
>will stop immediately. Therefore you need to either use the Main class
>that
>is shipped in Camel Core (example
>)
>or keep the JVM running indefinitely by adding
>(Thread.sleep(Integer.MAX_VALUE);)
>
>You can take a look here for an example:
>https://www.codepile.net/pile/p4dDJd4x
>
>Please note I also included the camel-spark-rest component in the POM
>file
>as well.
>
>On Mon, 29 Jul 2019 at 14:06, Jaiprakash Mewada <
>jaiprakash.mew...@hotwaxsystems.com> wrote:
>
>> Hi Team,
>>
>> I am beginner in apache camel. I want to make to rest call but not
>able to
>> get expected result. Can someone help me, what exact change I need to
>do in
>> below code in order to receive the json response.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *import org.apache.camel.CamelContext;import
>> org.apache.camel.ConsumerTemplate;import
>org.apache.camel.Exchange;import
>> org.apache.camel.Processor;import
>org.apache.camel.ProducerTemplate;import
>> org.apache.camel.builder.RouteBuilder;import
>> org.apache.camel.impl.DefaultCamelContext;public class
>> CamelHelloWorldExample { public static void main(String[] args)
>throws
>> Exception { CamelContext context = new DefaultCamelContext();
>> context.setTracing(true); context.addRoutes(new RouteBuilder() {
>@Override
>> public void configure() throws Exception {
>System.out.println("---Start
>> of RouteBuilder---");
>> from("direct:start").setHeader(Exchange.HTTP_METHOD, simple("GET"))
>> .to("http://dummy.restapiexample.com/api/v1/employee/330
>> ").process(new
>> Processor() { public void process(Exchange exchange) throws Exception
>{
>> System.out.println(exchange.getIn().getBody(String.class)); } } )
>> .to("seda:end"); System.out.println("---End of
>> RouteBuilder---"); } } ); context.start(); ProducerTemplate
>> prodTemp = context.createProducerTemplate();
>> prodTemp.sendBody("direct:start", "Hello"); ConsumerTemplate consTemp
>=
>> context.createConsumerTemplate(); String msg =
>> consTemp.receiveBody("seda:end", String.class);
>System.out.println(msg);
>> }}*
>>
>> --
>> *Thanks & Regards,*
>> *Jaiprakash Mewada*
>> Senior Enterprise Software Engineer
>>
>> *HotWax Systems*
>>


[ANNOUNCEMENT] Apache Camel Quarkus 0.0.2 released

2019-07-29 Thread Andrea Cosentino
The Camel community announces the immediate availability of Camel Quarkus 0.0.2
the first release of Camel Quarkus.

The artifacts are published and ready for you to download either
from the Apache mirrors or from the Github repository. For more details you can 
have a look 
at the github repository [1]

Many thanks to all who made this release possible.

On behalf of the Camel PMC,
Andrea Cosentino

[1] https://github.com/apache/camel-quarkus

--
Andrea Cosentino 
--
Apache Camel PMC Chair
Apache Karaf Committer
Apache Servicemix PMC Member
Email: ancosen1...@yahoo.com
Twitter: @oscerd2
Github: oscerd


Code of calling rest service is not working

2019-07-29 Thread Jaiprakash Mewada
Hi Team,

I am beginner in apache camel. I want to make to rest call but not able to
get expected result. Can someone help me, what exact change I need to do in
below code in order to receive the json response.











































*import org.apache.camel.CamelContext;import
org.apache.camel.ConsumerTemplate;import org.apache.camel.Exchange;import
org.apache.camel.Processor;import org.apache.camel.ProducerTemplate;import
org.apache.camel.builder.RouteBuilder;import
org.apache.camel.impl.DefaultCamelContext;public class
CamelHelloWorldExample { public static void main(String[] args) throws
Exception { CamelContext context = new DefaultCamelContext();
context.setTracing(true); context.addRoutes(new RouteBuilder() { @Override
public void configure() throws Exception { System.out.println("---Start
of RouteBuilder---");
from("direct:start").setHeader(Exchange.HTTP_METHOD, simple("GET"))
.to("http://dummy.restapiexample.com/api/v1/employee/330
").process(new
Processor() { public void process(Exchange exchange) throws Exception {
System.out.println(exchange.getIn().getBody(String.class)); } } )
.to("seda:end"); System.out.println("---End of
RouteBuilder---"); } } ); context.start(); ProducerTemplate
prodTemp = context.createProducerTemplate();
prodTemp.sendBody("direct:start", "Hello"); ConsumerTemplate consTemp =
context.createConsumerTemplate(); String msg =
consTemp.receiveBody("seda:end", String.class); System.out.println(msg); }}*

-- 
*Thanks & Regards,*
*Jaiprakash Mewada*
Senior Enterprise Software Engineer

*HotWax Systems*


[ANNOUNCEMENT] Apache Camel K 1.0.0-M1 released

2019-07-29 Thread Nicola Ferraro
The Camel community announces the immediate availability of Apache Camel K
1.0.0-M1, the first step towards version 1.0.0 of Camel K, with several
improvements and bug fixes.

The artifacts are published and ready for you to download either
from the Apache mirrors or from the Github repository. For more
details please take a look at the release notes [1].

Many thanks to all who made this release possible.

On behalf of the Camel PMC,
Nicola Ferraro

[1] https://github.com/apache/camel-k/releases/tag/1.0.0-M1


Re: Code of calling rest service is not working

2019-07-29 Thread Omar Al-Safi
I am new to Camel as well, I was figuring things on the way :). First you
need to use a REST component, you can use the REST DSL
, however this is only a DSL not a
actual http server, you will need to include an http server component as
well (e.g:  camel-netty4-http, camel-restlet, camel-spark-rest ..etc), once
you included it, you will need to tell Camel to use the specified component
through the configuration RouteBuilder
(e.g: restConfiguration().component("spark-rest").port(8000);). Also in
your above example, the JVM will terminate immediately, and hence Camel
will stop immediately. Therefore you need to either use the Main class that
is shipped in Camel Core (example
)
or keep the JVM running indefinitely by adding
(Thread.sleep(Integer.MAX_VALUE);)

You can take a look here for an example:
https://www.codepile.net/pile/p4dDJd4x

Please note I also included the camel-spark-rest component in the POM file
as well.

On Mon, 29 Jul 2019 at 14:06, Jaiprakash Mewada <
jaiprakash.mew...@hotwaxsystems.com> wrote:

> Hi Team,
>
> I am beginner in apache camel. I want to make to rest call but not able to
> get expected result. Can someone help me, what exact change I need to do in
> below code in order to receive the json response.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *import org.apache.camel.CamelContext;import
> org.apache.camel.ConsumerTemplate;import org.apache.camel.Exchange;import
> org.apache.camel.Processor;import org.apache.camel.ProducerTemplate;import
> org.apache.camel.builder.RouteBuilder;import
> org.apache.camel.impl.DefaultCamelContext;public class
> CamelHelloWorldExample { public static void main(String[] args) throws
> Exception { CamelContext context = new DefaultCamelContext();
> context.setTracing(true); context.addRoutes(new RouteBuilder() { @Override
> public void configure() throws Exception { System.out.println("---Start
> of RouteBuilder---");
> from("direct:start").setHeader(Exchange.HTTP_METHOD, simple("GET"))
> .to("http://dummy.restapiexample.com/api/v1/employee/330
> ").process(new
> Processor() { public void process(Exchange exchange) throws Exception {
> System.out.println(exchange.getIn().getBody(String.class)); } } )
> .to("seda:end"); System.out.println("---End of
> RouteBuilder---"); } } ); context.start(); ProducerTemplate
> prodTemp = context.createProducerTemplate();
> prodTemp.sendBody("direct:start", "Hello"); ConsumerTemplate consTemp =
> context.createConsumerTemplate(); String msg =
> consTemp.receiveBody("seda:end", String.class); System.out.println(msg);
> }}*
>
> --
> *Thanks & Regards,*
> *Jaiprakash Mewada*
> Senior Enterprise Software Engineer
>
> *HotWax Systems*
>