Re: Camel spring DSL validaiton
Hi Zoran, Thanks for prompt reply. This works for me. Regards, Vineet On 20/11/18, 4:17 PM, "Zoran Regvart" wrote: Hi Vineet, you could gather all `RouteDefinition` objects from that `RoutesDefinition` you get from `CamelContext::loadRoutesDefinition`, use `RouteDefinitionHelper::gatherAllEndpointUris` to fetch all endpoint URIs of that `RouteDefinition` and then try to resolve those endpoints via `CamelContextHelper::getMandatoryEndpoint`. Not sure if there is a more straightforward way of doing that, zoran On Tue, Nov 20, 2018 at 10:51 AM Gandhi, Vineet wrote: > > Hi, > > I have a use case where clients can send route xml files to my service which I add to camelContext > > Code for adding route looks like : > > public void createRoute(InputStream xmlRouteDefinition) throws Exception { > > > > RoutesDefinition routesDefinition = camelContext.loadRoutesDefinition(xmlRouteDefinition); > > camelContext.addRouteDefinitions(routesDefinition.getRoutes()); > >} > > Client can pass the following routes too – > > > http://camel.apache.org/schema/spring";> > > > > > > > Is there any way of validating whether the components and their corresponding URI’s are correctly passed without calling the startRoute API in DefaultCamelContext? > > Regards, > Vineet > > > This e-mail, including attachments, may include confidential and/or > proprietary information, and may be used only by the person or entity > to which it is addressed. If the reader of this e-mail is not the intended > recipient or his or her authorized agent, the reader is hereby notified > that any dissemination, distribution or copying of this e-mail is > prohibited. If you have received this e-mail in error, please notify the > sender by replying to this message and delete this e-mail immediately. -- Zoran Regvart This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.
Re: Camel CXFRS and Swagger/OpenAPI Feature
As far as I recall, a corresponding CXF filter is a blocking one and returns a JAX-RS Response. May be the CamelCXF RS code needs to be tweaked a bit to check if JAX-RS Response is already available before continuing with the route flow... Cheers, Sergey On Tue, Nov 20, 2018 at 5:20 PM #S-SmixDev wrote: > Hi Zoran, > > yeah, I suspected that might be the way it's supposed to work, but the > problem here of course is that I don't actually have a ResourceImpl of my > real service, only an interface, and therefore performInvocation doesn't > work for me unless I write a Dummy implementation, too. > > Cheers, > Jens > > [image: Inactive hide details for "Zoran Regvart" ---20.11.2018 > 17:28:53---Hi Jens, from the little exploration I did I think you need]"Zoran > Regvart" ---20.11.2018 17:28:53---Hi Jens, from the little exploration I > did I think you need to set > > Von: "Zoran Regvart" > An: users@camel.apache.org, > Datum: 20.11.2018 17:28 > Betreff: Re: Camel CXFRS and Swagger/OpenAPI Feature > -- > > > Hi Jens, > from the little exploration I did I think you need to set > `performInvocation` to `true`: the way OpenAPI support in CXF works is > by registering a resource that will generate the OpenAPI > specification, and that JAX-RS resource class[1] has an `getOpenApi` > method. > > So your routes need to look something like this: > > from("cxfrs:// > http://localhost:8080/api?features=#openApi&resourceClasses=...&performInvocation=true > ") > .toD("direct:${header.operationName}"); > > from("direct:getOpenApi").log("Fetching OpenAPI specification"); > > The `log` here is just in place of a dummy processor so that the route > has a `from` and a `to`. > > The way I came to think of it is that the resource classes give the > REST API shape, and the implementation is provided by Camel route, > which is kinda difficult to grasp since the most natural thing would > be to write the implementation within the resource method. > > zoran > > [1] > https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/integration/resources/OpenApiResource.java#L28 > On Mon, Nov 19, 2018 at 2:03 PM #S-SmixDev wrote: > > > > > > Hi Camel Riders, > > > > I'm trying to integrate a Camel-CXFRS endpoint with Swagger UI using the > > Swagger/OpenAPI Feature. > > > > This works fine with a "pure" CXF endpoint, no Camel involved. > > > > When using Camel-CXFRS, however, I can't make it work properly without > > extra implementation work in the Camel route. > > > > Using runAsFilter=false a call to > > http://localhost:8080/services/myCamelService/openapi.json > > results in a call of the Camel route with an operation "getOpenApi" > > > > http://localhost:8080/services/myCamelServive/api-docs?url=openapi.json > > results in call of the Camel route with an operation "getResource" > > > > Using runAsFilter=true the situation improves marginally: > > http://localhost:8080/services/myCamelService/openapi.json > > still results in a call of the Camel route with an operation "getOpenApi" > > > > http://localhost:8080/services/myCamelServive/api-docs?url=openapi.json > > at least now shows the Swagger UI page frame but still fails to load the > > actual service description since it again calls the Camel route with the > > "getOpenApi" operation. > > > > As far as I can see, calling the API description endpoints should not > > involve the Camel route at all, and this "getOpenApi" call should instead > > happen on the internal service resource. > > > > Has anyone successfully set this up just using the CXF feature out of the > > box? Is this even possible? > > > > Cheers, > > Jens > > ___ > > > > DZ BANK AG > > Deutsche Zentral-Genossenschaftsbank, Frankfurt am Main > > Platz der Republik, 60325 Frankfurt am Main > > Deutschland/Germany > > > > https://www.dzbank.de > > mailto:m...@dzbank.de , T +49 69 7447 01, F +49 69 7447 > 1685 > > > > https://twitter.com/dzbank > > > > Vorstand/Board of Directors: Wolfgang Kirsch (Vorsitzender/Chief > Executive Officer), > > Uwe Berghaus, Dr. Christian Brauckmann, Ulrike Brouzi, Wolfgang Köhler, > > Dr. Cornelius Riese, Michael Speth, Thomas Ullrich > > > > Generalbevollmächtigter/General Executive Manager: Uwe Fröhlich > > > > Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Henning > Deneke-Jöhrens > > Sitz/Registered Office: Stadt Frankfurt am Main, Amtsgericht Frankfurt > am Main > > Handelsregister/Register of Companies: HRB 45651. > > > > ___ > > > > Die mit dieser E-Mail-Kommunikation erhobenen personenbezogenen Daten > > werden ausschließlich zu diesem Zweck bzw. zur Bearbeitung Ihres > Anliegens weiterverarbeitet. > > Weitere Informationen zum Datenschutz finden Sie unter > https://www.dzbank.de/datenschutzhinweise > > > > The personal data collected by this e-mail communi
Re: Camel CXFRS and Swagger/OpenAPI Feature
Hi Zoran, yeah, I suspected that might be the way it's supposed to work, but the problem here of course is that I don't actually have a ResourceImpl of my real service, only an interface, and therefore performInvocation doesn't work for me unless I write a Dummy implementation, too. Cheers, Jens Von:"Zoran Regvart" An: users@camel.apache.org, Datum: 20.11.2018 17:28 Betreff:Re: Camel CXFRS and Swagger/OpenAPI Feature Hi Jens, from the little exploration I did I think you need to set `performInvocation` to `true`: the way OpenAPI support in CXF works is by registering a resource that will generate the OpenAPI specification, and that JAX-RS resource class[1] has an `getOpenApi` method. So your routes need to look something like this: from ("cxfrs://http://localhost:8080/api?features=#openApi&resourceClasses=...&performInvocation=true";) .toD("direct:${header.operationName}"); from("direct:getOpenApi").log("Fetching OpenAPI specification"); The `log` here is just in place of a dummy processor so that the route has a `from` and a `to`. The way I came to think of it is that the resource classes give the REST API shape, and the implementation is provided by Camel route, which is kinda difficult to grasp since the most natural thing would be to write the implementation within the resource method. zoran [1] https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/integration/resources/OpenApiResource.java#L28 On Mon, Nov 19, 2018 at 2:03 PM #S-SmixDev wrote: > > > Hi Camel Riders, > > I'm trying to integrate a Camel-CXFRS endpoint with Swagger UI using the > Swagger/OpenAPI Feature. > > This works fine with a "pure" CXF endpoint, no Camel involved. > > When using Camel-CXFRS, however, I can't make it work properly without > extra implementation work in the Camel route. > > Using runAsFilter=false a call to > http://localhost:8080/services/myCamelService/openapi.json > results in a call of the Camel route with an operation "getOpenApi" > > http://localhost:8080/services/myCamelServive/api-docs?url=openapi.json > results in call of the Camel route with an operation "getResource" > > Using runAsFilter=true the situation improves marginally: > http://localhost:8080/services/myCamelService/openapi.json > still results in a call of the Camel route with an operation "getOpenApi" > > http://localhost:8080/services/myCamelServive/api-docs?url=openapi.json > at least now shows the Swagger UI page frame but still fails to load the > actual service description since it again calls the Camel route with the > "getOpenApi" operation. > > As far as I can see, calling the API description endpoints should not > involve the Camel route at all, and this "getOpenApi" call should instead > happen on the internal service resource. > > Has anyone successfully set this up just using the CXF feature out of the > box? Is this even possible? > > Cheers, > Jens > ___ > > DZ BANK AG > Deutsche Zentral-Genossenschaftsbank, Frankfurt am Main > Platz der Republik, 60325 Frankfurt am Main > Deutschland/Germany > > https://www.dzbank.de > mailto:m...@dzbank.de, T +49 69 7447 01, F +49 69 7447 1685 > > https://twitter.com/dzbank > > Vorstand/Board of Directors: Wolfgang Kirsch (Vorsitzender/Chief Executive Officer), > Uwe Berghaus, Dr. Christian Brauckmann, Ulrike Brouzi, Wolfgang Köhler, > Dr. Cornelius Riese, Michael Speth, Thomas Ullrich > > Generalbevollmächtigter/General Executive Manager: Uwe Fröhlich > > Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Henning Deneke-Jöhrens > Sitz/Registered Office: Stadt Frankfurt am Main, Amtsgericht Frankfurt am Main > Handelsregister/Register of Companies: HRB 45651. > > ___ > > Die mit dieser E-Mail-Kommunikation erhobenen personenbezogenen Daten > werden ausschließlich zu diesem Zweck bzw. zur Bearbeitung Ihres Anliegens weiterverarbeitet. > Weitere Informationen zum Datenschutz finden Sie unter https://www.dzbank.de/datenschutzhinweise > > The personal data collected by this e-mail communication > are processed exclusively for this purpose or to process your request. > Further information on data protection can be found at https://www.dzbank.com/dataprotection -- Zoran Regvart ___ DZ BANK AG Deutsche Zentral-Genossenschaftsbank, Frankfurt am Main Platz der Republik, 60325 Frankfurt am Main Deutschland/Germany https://www.dzbank.de mailto:m...@dzbank.de, T +49 69 7447 01, F +49 69 7447 1685 https://twitter.com/dzbank Vorstand/Board of Directors: Wolfgang Kirsch (Vorsitzender/Chief Executive Officer), Uwe Berghaus, Dr. Christian Brauckmann, Ulrike Brouzi, Wolfgang Köhler, Dr. Cornelius Riese, Michael Speth, Thomas Ullrich Generalbevollmächtigter/General Executive Manager: Uwe F
to uri cxf endpoint in springdsl problem for SpringBoot+Camel
when i use SpringDSL under SpringBoot, i should only use routes in xml not camelContext, since springboot will take care of cameContext when i convert my javaDSL to below SpringDSL the to uri cxf endpoint below does not work , it used to work with javadsl http://localhost:/mock_service?dataFormat=MESSAGE&wsdlURL=wsdl%2Fmockservice.wsdl"; /> java.lang.IllegalArgumentException: Can't find the BindingOperationInfo with operation name http://camel.apache.org/schema/spring";> java.lang.Exception http://{{soap.ip}}:{{soap.port}}/{{soap.service}}?dataFormat=MESSAGE&wsdlURL=wsdl%2Fmyservice.wsdl"; /> http://localhost:/mock_service?dataFormat=MESSAGE&wsdlURL=wsdl%2Fmockservice.wsdl"; />
Re: Camel CXFRS and Swagger/OpenAPI Feature
Hi Jens, from the little exploration I did I think you need to set `performInvocation` to `true`: the way OpenAPI support in CXF works is by registering a resource that will generate the OpenAPI specification, and that JAX-RS resource class[1] has an `getOpenApi` method. So your routes need to look something like this: from("cxfrs://http://localhost:8080/api?features=#openApi&resourceClasses=...&performInvocation=true";) .toD("direct:${header.operationName}"); from("direct:getOpenApi").log("Fetching OpenAPI specification"); The `log` here is just in place of a dummy processor so that the route has a `from` and a `to`. The way I came to think of it is that the resource classes give the REST API shape, and the implementation is provided by Camel route, which is kinda difficult to grasp since the most natural thing would be to write the implementation within the resource method. zoran [1] https://github.com/swagger-api/swagger-core/blob/master/modules/swagger-jaxrs2/src/main/java/io/swagger/v3/jaxrs2/integration/resources/OpenApiResource.java#L28 On Mon, Nov 19, 2018 at 2:03 PM #S-SmixDev wrote: > > > Hi Camel Riders, > > I'm trying to integrate a Camel-CXFRS endpoint with Swagger UI using the > Swagger/OpenAPI Feature. > > This works fine with a "pure" CXF endpoint, no Camel involved. > > When using Camel-CXFRS, however, I can't make it work properly without > extra implementation work in the Camel route. > > Using runAsFilter=false a call to > http://localhost:8080/services/myCamelService/openapi.json > results in a call of the Camel route with an operation "getOpenApi" > > http://localhost:8080/services/myCamelServive/api-docs?url=openapi.json > results in call of the Camel route with an operation "getResource" > > Using runAsFilter=true the situation improves marginally: > http://localhost:8080/services/myCamelService/openapi.json > still results in a call of the Camel route with an operation "getOpenApi" > > http://localhost:8080/services/myCamelServive/api-docs?url=openapi.json > at least now shows the Swagger UI page frame but still fails to load the > actual service description since it again calls the Camel route with the > "getOpenApi" operation. > > As far as I can see, calling the API description endpoints should not > involve the Camel route at all, and this "getOpenApi" call should instead > happen on the internal service resource. > > Has anyone successfully set this up just using the CXF feature out of the > box? Is this even possible? > > Cheers, > Jens > ___ > > DZ BANK AG > Deutsche Zentral-Genossenschaftsbank, Frankfurt am Main > Platz der Republik, 60325 Frankfurt am Main > Deutschland/Germany > > https://www.dzbank.de > mailto:m...@dzbank.de, T +49 69 7447 01, F +49 69 7447 1685 > > https://twitter.com/dzbank > > Vorstand/Board of Directors: Wolfgang Kirsch (Vorsitzender/Chief Executive > Officer), > Uwe Berghaus, Dr. Christian Brauckmann, Ulrike Brouzi, Wolfgang Köhler, > Dr. Cornelius Riese, Michael Speth, Thomas Ullrich > > Generalbevollmächtigter/General Executive Manager: Uwe Fröhlich > > Aufsichtsratsvorsitzender/Chairman of the Supervisory Board: Henning > Deneke-Jöhrens > Sitz/Registered Office: Stadt Frankfurt am Main, Amtsgericht Frankfurt am Main > Handelsregister/Register of Companies: HRB 45651. > > ___ > > Die mit dieser E-Mail-Kommunikation erhobenen personenbezogenen Daten > werden ausschließlich zu diesem Zweck bzw. zur Bearbeitung Ihres Anliegens > weiterverarbeitet. > Weitere Informationen zum Datenschutz finden Sie unter > https://www.dzbank.de/datenschutzhinweise > > The personal data collected by this e-mail communication > are processed exclusively for this purpose or to process your request. > Further information on data protection can be found at > https://www.dzbank.com/dataprotection -- Zoran Regvart
Re: Camel spring DSL validaiton
Hi Vineet, you could gather all `RouteDefinition` objects from that `RoutesDefinition` you get from `CamelContext::loadRoutesDefinition`, use `RouteDefinitionHelper::gatherAllEndpointUris` to fetch all endpoint URIs of that `RouteDefinition` and then try to resolve those endpoints via `CamelContextHelper::getMandatoryEndpoint`. Not sure if there is a more straightforward way of doing that, zoran On Tue, Nov 20, 2018 at 10:51 AM Gandhi, Vineet wrote: > > Hi, > > I have a use case where clients can send route xml files to my service which > I add to camelContext > > Code for adding route looks like : > > public void createRoute(InputStream xmlRouteDefinition) throws Exception { > > > > RoutesDefinition routesDefinition = > camelContext.loadRoutesDefinition(xmlRouteDefinition); > > camelContext.addRouteDefinitions(routesDefinition.getRoutes()); > >} > > Client can pass the following routes too – > > > http://camel.apache.org/schema/spring";> > > > > > > > Is there any way of validating whether the components and their corresponding > URI’s are correctly passed without calling the startRoute API in > DefaultCamelContext? > > Regards, > Vineet > > > This e-mail, including attachments, may include confidential and/or > proprietary information, and may be used only by the person or entity > to which it is addressed. If the reader of this e-mail is not the intended > recipient or his or her authorized agent, the reader is hereby notified > that any dissemination, distribution or copying of this e-mail is > prohibited. If you have received this e-mail in error, please notify the > sender by replying to this message and delete this e-mail immediately. -- Zoran Regvart
Re: using springdsl instead of javadsl with file path
Hi wang, Yes we can give file paths for picking up routes during startup too. camel.springboot.xmlRoutes = on camel.springboot.xmlRoutes = file://x/xxx/*.xml I tested in my local and its working. Regards, Vineet On 20/11/18, 3:24 PM, "Wang Yan" wrote: using springdsl instead of javadsl, below is the example from camel website, is it possible to use file instead of classpath for configuration? for example camel.springboot.xmlRoutes = file:/com/foo/routes/*.xml any suggestions and hints are more than welcome! // turn off camel.springboot.xmlRoutes = false // scan in the com/foo/routes classpath camel.springboot.xmlRoutes = classpath:com/foo/routes/*.xml The XML files should be Camel XML routes (not CamelContext) such as http://camel.apache.org/schema/spring";> ref:myBean This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.
using springdsl instead of javadsl with file path
using springdsl instead of javadsl, below is the example from camel website, is it possible to use file instead of classpath for configuration? for example camel.springboot.xmlRoutes = file:/com/foo/routes/*.xml any suggestions and hints are more than welcome! // turn off camel.springboot.xmlRoutes = false // scan in the com/foo/routes classpath camel.springboot.xmlRoutes = classpath:com/foo/routes/*.xml The XML files should be Camel XML routes (not CamelContext) such as http://camel.apache.org/schema/spring";> ref:myBean
Camel spring DSL validaiton
Hi, I have a use case where clients can send route xml files to my service which I add to camelContext Code for adding route looks like : public void createRoute(InputStream xmlRouteDefinition) throws Exception { RoutesDefinition routesDefinition = camelContext.loadRoutesDefinition(xmlRouteDefinition); camelContext.addRouteDefinitions(routesDefinition.getRoutes()); } Client can pass the following routes too – http://camel.apache.org/schema/spring";> Is there any way of validating whether the components and their corresponding URI’s are correctly passed without calling the startRoute API in DefaultCamelContext? Regards, Vineet This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.