Re: Need camel jetty http2 support for server

2019-07-16 Thread Willem Jiang
First you need to check how to enable http2 support in Jetty, then you
change the code of camel-jetty to see if we can enable this kind
feature by applying some code change on the jetty engine.  Then we may
need to provide a setup option on the jetty endpoint.

My question is there are some other components[1] which provides the
http2 server side support,  why do you still need to use jetty?

[1]https://developers.redhat.com/blog/2017/12/12/using-camel-undertow-component-supporting-http2-connection/

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Tue, Jul 16, 2019 at 12:43 PM Wang Yan  wrote:
>
> Dear All,
>
> In my current project, we need camel jetty http2 support at the server
> I find the below post which related to my question, could anyone give
> me some hints where or what code should be modified to enable camel
> jetty component to support http2 feature?
>
> https://stackoverflow.com/questions/54180195/camel-jetty-http-2-support
>
> Thanks and Rgds
> W.Y


MQTT and Protobuf Route Test issue in Apache Camel 2.24.1

2019-07-16 Thread Imran Raza Khan
i have develop a route like below with test

public class ShutdownPC extends RouteBuilder
{
@Override
public void configure() throws Exception
{
from("mqtt:UpsStatus?host=tcp://1.1.1.1:1883
=x=x=ups_status")
.unmarshal()
.protobuf("com.my$UpsStatus")
.choice()
.when().simple("${body.getLowBattery()} == true")
.log("Shutdown PC")
.to("exec:shutdown?args=-h now")
.otherwise()
.log("Dont Shutdown PC")
.end();
}
}
This work fine but i write test for it which is failing and always connect
to real broker rather then local broker which i mentioned for testing and
how i can improve this test

public class ShutdownPCTest extends CamelTestSupport {
@Override
public void setUp() throws Exception {
super.setUp();
this.context.addRoutes(new ShutdownPC());
}

@Test
public void testShutdownPC() throws Exception {
UPSStatus upsStatus =
UPSStatus.newBuilder().setLowBattery(true).build();

MQTT mqtt = new MQTT();
mqtt.setHost("tcp://127.0.0.1:1883");
BlockingConnection publisherConnection =
mqtt.blockingConnection();
publisherConnection.connect();
publisherConnection.publish("ups_status",
upsStatus.toByteArray(), QoS.AT_LEAST_ONCE, false);
}

@After
public void tearDown() throws Exception {
super.tearDown();
}
}


Re: CxfRsProducer nullpo exception if @QueryParam is null

2019-07-16 Thread Zoltán Balogh
Hi,

the @POST seems to be work, what I  have done:
- set synchronous=true
- configure Jackson with FAIL_ON_EMPTY_BEANS

One thing that I can't solve it calling @POST method the payload not
return to the client! It returns to producer but only the response
code returns to client...

17:33:20,684 INFO  [org.apache.cxf.interceptor.LoggingInInterceptor]
(default task-55) Inbound Message

ID: 82
Response-Code: 201
Encoding: ISO-8859-1
Content-Type: application/json
Headers: {connection=[keep-alive], content-type=[application/json],
Date=[Tue, 16 Jul 2019 15:33:20 GMT], Server=[WildFly/10],
transfer-encoding=[chunked], X-Powered-By=[Undertow/1]}
Payload: 
{"id":1010,"parentId":null,"name":"kecske","type":"HATOSAGI_UGY_TIPUS","sorrend":null}
--
17:33:20,686 INFO  [org.apache.cxf.interceptor.LoggingOutInterceptor]
(default task-55) Outbound Message
---
ID: 81
Response-Code: 201
Content-Type: application/json
Headers: {connection=[keep-alive], content-type=[application/json],
Date=[Tue, 16 Jul 2019 15:33:20 GMT], Server=[WildFly/10],
transfer-encoding=[chunked], X-Powered-By=[Undertow/1],
Content-Type=[application/json]}
Payload: {}
--


 In case of calling @GET method the payload getting on the client...

I have shared the project :
https://gitlab.com/topicfun/cxfrs-put/tree/master

The important classes, resources are:
- 
cxfrs-put/blob/master/tua-esb/src/main/java/hu/fornax/tua/esb/route/RestRouteBuilder.java
=> rest proxy
- 
cxfrs-put/blob/master/tua-esb/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
- 
cxfrs-put/blob/master/tua-kodtar/src/main/java/hu/fornax/tua/kodtar/route/KodtarRoute.java
=> rest service
- 
cxfrs-put/blob/master/tua-kodtar-protocol/src/main/java/hu/fornax/tua/kodtar/protocol/rest/KodtarREST.java
=> REST interface

and the full log calling @POST method:
https://gitlab.com/topicfun/cxfrs-put/blob/master/createPUT.log

Thanks in advance!
Topicfun

Freeman Fang  ezt írta (időpont: 2019. júl.
10., Sze, 20:44):
>
> Hi,
>
> Could you please append a reproducer project so that I can take a close look?
>
> Freeman
> -
> Freeman(Yue) Fang
>
> Red Hat, Inc.
>
>
>
>
>
> > On Jul 10, 2019, at 3:06 AM, Zoltán Balogh  wrote:
> >
> > thanks for your answer but now I'm totally confused...
> > If I set CamelCxfRsUsingHttpAPI to true the getKodtarElemListByType
> > works properly.
> > But in this case I got exception for
> >@POST
> >public Response createKodtarElem(KodtarDto dto);
> >
> > 08:49:11,874 SEVERE [org.apache.cxf.jaxrs.utils.JAXRSUtils] (default
> > task-10) No message body writer has been found for class
> > hu.fornax.tua.kodtar.dto.KodtarDto, ContentType: application/xml
> > 08:49:11,875 WARNING [org.apache.cxf.phase.PhaseInterceptorChain]
> > (default task-10) Interceptor for
> > {http://localhost:8080/tua-kodtar/rest}WebClient has thrown exception,
> > unwinding now: org.apache.cxf.interceptor.Fault: No message body
> > writer has been found for class hu.fornax.tua.kodtar.dto.KodtarDto,
> > ContentType: application/xml
> >
> > The json provider is set (=#jsonProvider), I have tried with
> > JacksonJaxbJsonProvider and with JacksonJsonProvider as well
> >
> > If I set CamelCxfRsUsingHttpAPI to false the @Post works. Otherwise
> > getting NPE to the @GET as I wrote in my first mail.
> >
> > I want only to proxy rest request to an other service where a cxfrs
> > rest endpoint consume, please help me how I can solve it?
> >
> > Thanks again your support!
> >
> >
> >
> >
> >
> >
> >
> > Freeman Fang  ezt írta (időpont: 2019. júl.
> > 9., K, 19:33):
> >>
> >> Hi,
> >>
> >> The difference with camel-cxf proxy is that you have 
> >> setHeader("CamelCxfRsUsingHttpAPI", constant("false”)) in the route, which 
> >> means you will use proxy client to invoke the RS server, so the para types 
> >> must match the one in resourceClasses, without camel-cxf proxy you 
> >> actually use http client. If you have setHeader("CamelCxfRsUsingHttpAPI", 
> >> constant(“true”)) in your router the behaviour should be same with or 
> >> without proxy.
> >>
> >> So if you have setHeader("CamelCxfRsUsingHttpAPI", constant("false”)) , 
> >> ensure you have all parameters available in the payload.
> >>
> >> I think we probably can enhance here a bit, instead of throw NPE, throwing 
> >> NoSuchMethodException if can’t find match method in the client proxy.
> >> -
> >> Freeman(Yue) Fang
> >>
> >> Red Hat, Inc.
> >>
> >>
> >>
> >>
> >>
> >>> On Jul 9, 2019, at 7:32 AM, Zoltán Balogh  wrote:
> >>>
> >>> Hi,
> >>>
> >>> why the cxfrs producer not accept null query params? Should I set an
> >>> additional parameter to pass null value?
> >>>
> >>> My route:
> >>>   from("cxfrs:http://localhost:8080/tua;
> >>>   + "?resourceClasses="
> >>>   + "hu.fornax.tua.kodtar.protocol.rest.KodtarREST"
> >>>   + "=true"
> >>>   + 

How to fix Missing ${ from the text: error - Apache Camel 2.12 to 2.16.4 uprade

2019-07-16 Thread Rajiv Jacob Cheriyan
Hello,

We are upgrading from Apache Camel 2.12 to 2.16.4 and running into issues
with one of the routes.

Caused by: java.lang.IllegalArgumentException: Missing ${ from the text:
file:C:\OnDemandOutput?fileName=RPFPos_L2W.$simple{in.header.accountNum}-${date:now:MMddHHmmssSSS}.csv












*http://camel.apache.org/schema/spring
">
*


As per documentation this should have worked. Can someone help me in
understanding what is wrong ?
http://camel.apache.org/using-propertyplaceholder.html

Clashing Spring Property Placeholders with Camels Simple Language Take
notice when using Spring bridging placeholder then the spring ${} syntax
clashes with the Simple in Camel, and therefore take care.

Example:

xml {{file.rootdir}}/${in.header.CamelFileName} clashes with Spring
property placeholders, and you should use $simple{} to indicate using the
Simple language in Camel.

xml {{file.rootdir}}/$simple{in.header.CamelFileName}