Re: Camel Endpoint / Consumer startup
Hi, If the from(mqtt) component is not able yo establish a connection from the broker, then no apache camel exchange will be created. The issue could be if the .to(mqtt') producer tries to publish a message to a broker using the mqtt protocol. You can imagine to intercept the exception (due to the absence of the connection) and suspend the current route. Regards, On Thu, Oct 16, 2014 at 11:56 PM, ddewaele ddewa...@gmail.com wrote: I've run into this issue with the MQTTEndpoint where the MQTT endpoint is started (causing the MQTT connection to be established). As a result, the flow of mqtt messages is started *before* any consumers of that endpoint are registered. This puts the guaranteed delivery aspect of MQTT quality of service at risk, as on a protocol level these messages have been delivered, yet no consumer was available to process them. Is there a way for me to manipulate this behavior, or would this be considered a bug in the MQTT endpoint implementation. https://issues.apache.org/jira/browse/CAMEL-7922 -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Endpoint-Consumer-startup-tp5757635.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: Not all processors are listed in JMX, preventing detailed route statistics/profiling
I've seen issues like this in HawtIO, and it's actually a Jolokia issue. Basically, Jolokia will only fetch the first N elements (unsorted, I believe) from the server, and if your MBean isn't one of those N, then... bugger? The solution is to go into HawtIO / Preferences / Jolokia, and change Max Collection Size from 500 (the default) up to a larger number. I went to 5000, and all of a sudden all my routes appeared in the Camel console, and in the JMX tab. This will have an impact on browser performance, but I'm not sure there's much that can be done, apart from raising a feature request with Jolokia / HawtIO-Camel to fetch only a subset of available MBeans, rather than fetching them all and filtering on the client-side. Now, if you're looking at the JMX info through a different source (not HawtIO/Jolokia) and still not seeing them all, then this probably won't help much. - Andrew On Fri, Oct 17, 2014 at 7:41 AM, BlackTie jts...@hotmail.com wrote: I have a webapp using Camel (v2.13.2) about to go into production, at the point of trying to tune things for performance. I'm having an issue with getting detail statistics for some routes, though. I'm using Hawtio 1.2, and for some routes, Hawtio is displaying the statistics for each processor in the route, and others it only shows the statistics at the route level. I checked JMX with jconsole and noticed that, for the routes that don't show specifics for the processors, the processors in those routes are not listed under the processors section in JMX. Some routes with this problem are complex, others are fairly simple. Any ideas what would cause some to/choice/multicast/etc processors from not being listed in JMX at all? Without the statistics, it makes it very difficult to figure out where things are slowing down when the system is under heavy load. The jmxAgent is enabled for the camel context, with statisticsLevel set to All. Thanks for any help you can provide on this problem! -- View this message in context: http://camel.465427.n5.nabble.com/Not-all-processors-are-listed-in-JMX-preventing-detailed-route-statistics-profiling-tp5757634.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: ProducerTemplate without using Spring
Hi Lucas, This is correct. Here is a unit test part of the camel project where you can see that we support 2 options (using @Produce annotation or @Inject @Uri) https://github.com/apache/camel/blob/master/components/camel-cdi/src/test/java/org/apache/camel/cdi/ProduceInjectTest.java https://github.com/apache/camel/blob/master/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ProduceInjectedBean.java Regards, On Thu, Oct 16, 2014 at 8:25 PM, lucasweb lucas...@me.com wrote: I'm using the camel-cdi component to inject ProducerTemplates into my EJB's e.g. @Inject @Uri(jms:ToolQueue?preserveMessageQos=true) ProducerTemplate toolQueueMessageProducer; My understanding is that the camel-cdi component should manage the look up and lifecycle of the producer template for me. Is this correct? -- View this message in context: http://camel.465427.n5.nabble.com/ProducerTemplate-without-using-Spring-tp5739099p5757633.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Charles Moulliard Apache Committer / Architect @RedHat Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: Camel Endpoint / Consumer startup
We can force camel to start the connection when the consumer is stared, it can fix the issue that you hit. BTW, the patch is on the way, please keep an eye on the JIRA comments :) -- 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 October 17, 2014 at 5:56:46 AM, ddewaele (ddewa...@gmail.com) wrote: I've run into this issue with the MQTTEndpoint where the MQTT endpoint is started (causing the MQTT connection to be established). As a result, the flow of mqtt messages is started *before* any consumers of that endpoint are registered. This puts the guaranteed delivery aspect of MQTT quality of service at risk, as on a protocol level these messages have been delivered, yet no consumer was available to process them. Is there a way for me to manipulate this behavior, or would this be considered a bug in the MQTT endpoint implementation. https://issues.apache.org/jira/browse/CAMEL-7922 -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Endpoint-Consumer-startup-tp5757635.html Sent from the Camel - Users mailing list archive at Nabble.com.
Query paramteres in the REST DSL - Camel 2.14
I am unable to figure out how to expose Query params to a Rest resource exposed with the new Rest DSL in Camel 2.14 How would I go about to enable something like 'username' and 'password' via query params? rest(/user).description(User services) .get(/login).description(Login user. NB, user parameters 'username' and 'password') .outType(UserDTO.class) *-- missing setting of query params* Call: http://localhost:8080/user/get?username=blahblahpassword=secretstuff *NB! * The example above is constructed, What I am trying to convey is I am unable to find any way with the REST DSL to append a Query param. -- View this message in context: http://camel.465427.n5.nabble.com/Query-paramteres-in-the-REST-DSL-Camel-2-14-tp5757650.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Endpoint / Consumer startup
I'll keep an eye out for the JIRA. Currently created my own MQTT endpoint component that also delays the connection and lets each consumer / producer start a connection. But consider this a hack / workaround. i think the Camel MQTT component needs some attention. But I'm willing to test / help / report / debug issues. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Endpoint-Consumer-startup-tp5757635p5757719.html Sent from the Camel - Users mailing list archive at Nabble.com.
camel cxfrs with swagger.
Hi Team, I am using camel 2.14 and I am trying to expose rest endpoint using CXFRS and want to use swagger to expose the rest api. I am able to expose my rest service using cxfrs as described here : http://camel.apache.org/cxfrs.html My application is not a web application, and I am using spring and spring boot for my application. So I dont have web.xml in my case. Now for Integrating with Swagger, I looked at http://camel.apache.org/swagger.html but it uses web.xml for it. Is there anyways we can do it without using web.xml. I looked at the exmple camel-example-servlet-rest-tomcat ( http://camel.apache.org/examples.html) explaining swagger integration with Camel, but here too web application is used for example i.e web.xml for this integration. Could anyone suggest how can we integrate swagger without use of web.xml -Cheers, atg roxx
Re: camel cxfrs with swagger.
Hi Freeman added org.apache.cxf.jaxrs.swagger.SwaggerFeature to the CXF cxf-rt-rs-service-description module, you can register it as a CXFRS feature. Perhaps it can help ? Cheers, Sergey On 17/10/14 10:18, atg roxx wrote: Hi Team, I am using camel 2.14 and I am trying to expose rest endpoint using CXFRS and want to use swagger to expose the rest api. I am able to expose my rest service using cxfrs as described here : http://camel.apache.org/cxfrs.html My application is not a web application, and I am using spring and spring boot for my application. So I dont have web.xml in my case. Now for Integrating with Swagger, I looked at http://camel.apache.org/swagger.html but it uses web.xml for it. Is there anyways we can do it without using web.xml. I looked at the exmple camel-example-servlet-rest-tomcat ( http://camel.apache.org/examples.html) explaining swagger integration with Camel, but here too web application is used for example i.e web.xml for this integration. Could anyone suggest how can we integrate swagger without use of web.xml -Cheers, atg roxx -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/ Blog: http://sberyozkin.blogspot.com
Re: Camel Endpoint / Consumer startup
Yeah, I cannot agree with you more. Please keep testing and polishing the code if you like, that is how the open source community work :) BTW, I just commit a quick patch for it, you can try it with latest 2.15-SNAPSHOT or check out the master branch code and build it 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 October 17, 2014 at 5:06:25 PM, ddewaele (ddewa...@gmail.com) wrote: I'll keep an eye out for the JIRA. Currently created my own MQTT endpoint component that also delays the connection and lets each consumer / producer start a connection. But consider this a hack / workaround. i think the Camel MQTT component needs some attention. But I'm willing to test / help / report / debug issues. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Endpoint-Consumer-startup-tp5757635p5757719.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Query paramteres in the REST DSL - Camel 2.14
The query parameters are put into message header, you can get username and password just like this rest(/user).description(User services) .get(/login”).process(new Processor() { public void process(Exchange exchange) throws Exception { String username = exchange.getIn().getHeader(username, String.class); String password = exchange.getIn().getHeader(password, String.class); ... } }); -- 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 October 17, 2014 at 4:23:09 PM, panzerhans (espen+ca...@tjonneland.no) wrote: I am unable to figure out how to expose Query params to a Rest resource exposed with the new Rest DSL in Camel 2.14 How would I go about to enable something like 'username' and 'password' via query params? rest(/user).description(User services) .get(/login).description(Login user. NB, user parameters 'username' and 'password') .outType(UserDTO.class) *-- missing setting of query params* Call: http://localhost:8080/user/get?username=blahblahpassword=secretstuff *NB! * The example above is constructed, What I am trying to convey is I am unable to find any way with the REST DSL to append a Query param. -- View this message in context: http://camel.465427.n5.nabble.com/Query-paramteres-in-the-REST-DSL-Camel-2-14-tp5757650.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Query paramteres in the REST DSL - Camel 2.14
Thank you for your answer. If this is how the Rest DSL enables it, how is it then possible to tell E.G. the new Swagger component that we are supporting the two parameters? -- View this message in context: http://camel.465427.n5.nabble.com/Query-paramteres-in-the-REST-DSL-Camel-2-14-tp5757650p5757724.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Endpoint / Consumer startup
Just had a quick look at the commit, but won't we still have the issue that the endpoint will be creating the connection to the broker (and as a result messages will start flowing). By the time the first consumer will be added messages will be lost. (Camel always needs to start the endpoint first before adding consumers / producers) - The problem is not that the endpoint is not connected by the time consumers are added. - The problem is that the endpoint is already connected *before* consumers are added. Shouldn't it be the responsibility of the consumer / producer of the endpoint to create the connection ? -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Endpoint-Consumer-startup-tp5757635p5757725.html Sent from the Camel - Users mailing list archive at Nabble.com.
Documentation for JEE Transaction Handling in Camel needed
Hi, our application run in JBoss EAP 6.1 and uses different camel routes to read data from external servers, converts and writes them via jms (hornetQ) into database. The MDB reads values from queue, store them in database and put in a second queue. Sometimes an OptimisticLockException occurs in second MDB while trying to look up them in database. Very simplified scenario: from(ftp://server;).to(direct:convert); from(direct:convert).process(xyz).bean(myEJB).to(direct:save); from(direct:save).process(abc).to(jms://savequeue); My question is where can I find a description of how and when transactions are started and closed during a camel route using EJBs. Regards Robin
Re: camel cxfrs with swagger.
Here's how I did it. Application.java (to register Camel's servlet): import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.boot.context.embedded.ErrorPage; import org.springframework.boot.context.embedded.ServletRegistrationBean; import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; @Configuration @ComponentScan @EnableAutoConfiguration public class Application extends SpringBootServletInitializer { private static final String CAMEL_URL_MAPPING = /rest/*; private static final String CAMEL_SERVLET_NAME = CamelServlet; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } @Bean public ServletRegistrationBean servletRegistrationBean() { ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(), CAMEL_URL_MAPPING); registration.setName(CAMEL_SERVLET_NAME); return registration; } @Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, /401.html); ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, /404.html); ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, /500.html); container.addErrorPages(error401Page, error404Page, error500Page); } }; } } SwaggerConfig.java: @Configuration public class SwaggerConfig implements EnvironmentAware { private RelaxedPropertyResolver propertyResolver; @Override public void setEnvironment(Environment environment) { this.propertyResolver = new RelaxedPropertyResolver(environment, swagger.); } /** * Swagger Camel Configuration */ @Bean public ServletRegistrationBean swaggerServlet() { ServletRegistrationBean swagger = new ServletRegistrationBean(new SpringRestSwaggerApiDeclarationServlet(), /swagger/*); MapString, String params = new HashMap(); params.put(base.path, https://localhost:8443/rest;); params.put(api.title, propertyResolver.getProperty(title)); params.put(api.description, propertyResolver.getProperty(description)); params.put(api.termsOfServiceUrl, propertyResolver.getProperty(termsOfServiceUrl)); params.put(api.license, propertyResolver.getProperty(license)); params.put(api.licenseUrl, propertyResolver.getProperty(licenseUrl)); swagger.setInitParameters(params); return swagger; } } application.properties: # Swagger swagger.title = My API swagger.description = A description. swagger.termsOfServiceUrl = http://yourcompany.com/terms.html swagger.contact = swagger.license = Apache 2.0 swagger.licenseUrl = http://www.apache.org/licenses/LICENSE-2.0.html Hope this helps, Matt On Fri, Oct 17, 2014 at 3:18 AM, atg roxx atgr...@gmail.com wrote: Hi Team, I am using camel 2.14 and I am trying to expose rest endpoint using CXFRS and want to use swagger to expose the rest api. I am able to expose my rest service using cxfrs as described here : http://camel.apache.org/cxfrs.html My application is not a web application, and I am using spring and spring boot for my application. So I dont have web.xml in my case. Now for Integrating with Swagger, I looked at http://camel.apache.org/swagger.html but it uses web.xml for it. Is there anyways we can do it without using web.xml. I looked at the exmple camel-example-servlet-rest-tomcat ( http://camel.apache.org/examples.html) explaining swagger integration with Camel, but here too web application is used for example i.e web.xml for this integration. Could anyone suggest how can we integrate swagger without use of web.xml -Cheers,
Camel-Restlet 2.14.0 Convert response headers to MAP
Hi, The RestletOperationException.getResponseHeaders() returns a MapString,String with key value pair below: {*org.restlet.http.headers*=*[[Content-type: text/html; charset=UTF-8], [Content-length: 439], [Server: Restlet-Framework/2.2.1], [Date: Fri, 17 Oct 2014 13:16:36 GMT]]*} Is there a Camel utility that can convert the *value *to a MapString,String so that we could do a get(key) to retrieve the header of interest? -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Restlet-2-14-0-Convert-response-headers-to-MAP-tp5757728.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Endpoint / Consumer startup
In my patch MQTTEndpoint doesn’t start the connection until the first Customer or the first Producer is started. We just share the connection throw the MQTTEndpoint. -- 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 October 17, 2014 at 7:54:54 PM, ddewaele (ddewa...@gmail.com) wrote: Just had a quick look at the commit, but won't we still have the issue that the endpoint will be creating the connection to the broker (and as a result messages will start flowing). By the time the first consumer will be added messages will be lost. (Camel always needs to start the endpoint first before adding consumers / producers) - The problem is not that the endpoint is not connected by the time consumers are added. - The problem is that the endpoint is already connected *before* consumers are added. Shouldn't it be the responsibility of the consumer / producer of the endpoint to create the connection ? -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Endpoint-Consumer-startup-tp5757635p5757725.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XML Signature: XAdES-BES Support
HI Charles and Gonzalo, I do not think it is necessary to develop a new dataformat. There is already the component xmlsecurity ( see http://camel.apache.org/xml-security-component.html ) which supports XML Signature. XaDES-BES (http://www.w3.org/TR/XAdES/) just adds additional XML elements to the XML Signature, so it should be possible to add these additional elements in this component. Regards Franz On Tue, Oct 14, 2014 at 3:19 PM, Charles Moulliard ch0...@gmail.com wrote: An Apache project cannot include code developed under GPLv3 or LGPL license due to rights restrictions (more info here : http://www.apache.org/licenses/GPL-compatibility.html). On Tue, Oct 14, 2014 at 3:12 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote: Dear Charles, Can you please elaborate on such license model discrepancies as I'm not really aware of them? Regards, Gonzalo Vásquez Sáez Gerente Investigación y Desarrollo (RD) Altiuz Soluciones Tecnológicas de Negocios Ltda. Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099 +56 2 335 2461 gvasq...@altiuz.cl http://www.altiuz.cl http://www.altiuzreports.com El 14-10-2014, a las 10:02, Charles Moulliard ch0...@gmail.com escribió: Which API do you use ? For your information, we couldn't use xades4j with Apache Camel as the license model used which is GPLv3 is not compatible with Apache License 2 - http://www.apache.org/licenses/GPL-compatibility.html. I have created a ticket for the Apache Santuario project : https://issues.apache.org/jira/browse/SANTUARIO-402 On Tue, Oct 14, 2014 at 2:54 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote: OK, I'll try both approaches and as soon as I have something to show I'll let you know. Gonzalo Vásquez Sáez Gerente Investigación y Desarrollo (RD) Altiuz Soluciones Tecnológicas de Negocios Ltda. Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099 +56 2 335 2461 gvasq...@altiuz.cl http://www.altiuz.cl http://www.altiuzreports.com El 14-10-2014, a las 9:50, Charles Moulliard ch0...@gmail.com escribió: We could perhaps integrate your work with the existing xml-security data-format - http://camel.apache.org/xmlsecurity-dataformat.html instead of developing a new one. If we add a new value for this property (xmlCipherAlgorithm = XADES-BES) we could use the other API instead of Apache Santuario. We could also request to Santuario project that they support XADES-BES algorythm On Tue, Oct 14, 2014 at 2:43 PM, Charles Moulliard ch0...@gmail.com wrote: Excellent news. Could you please raise a ticket here to keep track of your development https://issues.apache.org/jira/browse/CAMEL ? On Tue, Oct 14, 2014 at 2:33 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote: Hi Charles, Sounds good, I'm actually already using the base64 dataformat, so using a new one wouldn't be complex. Although I'll first have to test the implementation using de xades4j API. Thanks. Gonzalo Vásquez Sáez Gerente Investigación y Desarrollo (RD) Altiuz Soluciones Tecnológicas de Negocios Ltda. Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099 +56 2 335 2461 gvasq...@altiuz.cl http://www.altiuz.cl http://www.altiuzreports.com El 14-10-2014, a las 9:28, Charles Moulliard ch0...@gmail.com escribió: Hi Gonzola, What I suggest is that you develop a new dataFormat (= class with 2 methods) for the apache Camel project if you agree as described here ( http://camel.apache.org/custom-dataformat.html) with the API supporting the XADES-BES. The dataformat could be integrated directly with the endpoint : http://camel.apache.org/dataformat-component.html. Regards, On Tue, Oct 14, 2014 at 1:49 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote: Ok, that means that I'll have to code my own endpoint then, am I right? Gonzalo Vásquez Sáez Gerente Investigación y Desarrollo (RD) Altiuz Soluciones Tecnológicas de Negocios Ltda. Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099 +56 2 335 2461 gvasq...@altiuz.cl http://www.altiuz.cl http://www.altiuzreports.com El 14-10-2014, a las 4:02, Charles Moulliard ch0...@gmail.com escribió: Hi Gonzalo, The xml-security dataformat of Camel uses behind the scene the Apache Santuario project (= http://santuario.apache.org/) which support different XMLCipher ( http://santuario.apache.org/Java/api/org/apache/xml/security/encryption/XMLCipher.html ) but unfortunately not XADES-BES. We should implement this API https://code.google.com/p/xades4j/ in this case. Regards, 2014-10-13 21:48 GMT+02:00 Gonzalo Vasquez gvasq...@altiuz.cl: Hi folks, Any hints on how/if the xml-security endpoint supports the XaDES-BES algorithm? Regards, Gonzalo Vásquez Sáez Gerente Investigación y Desarrollo (RD) Altiuz Soluciones Tecnológicas de Negocios Ltda. Av. Nueva Tajamar 555 Of. 802, Las Condes - CP
Re: camel cxfrs with swagger.
Hi Matt/Sergey, Thanks for replying. Sergey, I was not sure where and how to user your SwaggerFeature.. not sure where it will fit. Matt, In your approach too, could not see the use of camel cxfrs and also there are not camel routes to server the request. In Swagger config, could not see any resource location to search for resources class. Could you if possible , kindly let me know where how to use these in your sample program. -Regards, atg roxx On Fri, Oct 17, 2014 at 3:08 PM, Matt Raible m...@raibledesigns.com wrote: Here's how I did it. Application.java (to register Camel's servlet): import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.boot.context.embedded.ErrorPage; import org.springframework.boot.context.embedded.ServletRegistrationBean; import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; @Configuration @ComponentScan @EnableAutoConfiguration public class Application extends SpringBootServletInitializer { private static final String CAMEL_URL_MAPPING = /rest/*; private static final String CAMEL_SERVLET_NAME = CamelServlet; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } @Bean public ServletRegistrationBean servletRegistrationBean() { ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(), CAMEL_URL_MAPPING); registration.setName(CAMEL_SERVLET_NAME); return registration; } @Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, /401.html); ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, /404.html); ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, /500.html); container.addErrorPages(error401Page, error404Page, error500Page); } }; } } SwaggerConfig.java: @Configuration public class SwaggerConfig implements EnvironmentAware { private RelaxedPropertyResolver propertyResolver; @Override public void setEnvironment(Environment environment) { this.propertyResolver = new RelaxedPropertyResolver(environment, swagger.); } /** * Swagger Camel Configuration */ @Bean public ServletRegistrationBean swaggerServlet() { ServletRegistrationBean swagger = new ServletRegistrationBean(new SpringRestSwaggerApiDeclarationServlet(), /swagger/*); MapString, String params = new HashMap(); params.put(base.path, https://localhost:8443/rest;); params.put(api.title, propertyResolver.getProperty(title)); params.put(api.description, propertyResolver.getProperty(description)); params.put(api.termsOfServiceUrl, propertyResolver.getProperty(termsOfServiceUrl)); params.put(api.license, propertyResolver.getProperty(license)); params.put(api.licenseUrl, propertyResolver.getProperty(licenseUrl)); swagger.setInitParameters(params); return swagger; } } application.properties: # Swagger swagger.title = My API swagger.description = A description. swagger.termsOfServiceUrl = http://yourcompany.com/terms.html swagger.contact = swagger.license = Apache 2.0 swagger.licenseUrl = http://www.apache.org/licenses/LICENSE-2.0.html Hope this helps, Matt On Fri, Oct 17, 2014 at 3:18 AM, atg roxx atgr...@gmail.com wrote: Hi Team, I am using camel 2.14 and I am trying to expose rest endpoint using CXFRS and want to use swagger to expose the rest api. I am able to expose my rest service using cxfrs as described here :
Re: Camel Endpoint / Consumer startup
OK. We'll test with this on monday first thing. Are Camel snapshots automatically built and published on a remote maven repo somewhere ? If we point to 2.15-SNAPSHOT we should be good to go ? Is there a release schedule available for Camel so we can have a look when 2.15 is scheduled for release ? Thx for committing the fix ! -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Endpoint-Consumer-startup-tp5757635p5757737.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Not all processors are listed in JMX, preventing detailed route statistics/profiling
I am using hawtio as a standalone WAR, and did some research about accessing jolokia through hawtio. Browsing through the info that jolokia retrieves from JMX, not all the processors are listed. I added the maxObjects query param (with a value of 5000, which is higher than the number of beans we have) and still, not all the processors are listed. Coupled with the fact that if you set maxObjects lower than the max number of processor objects that are available to be retrieved, the json returned contains [Object limit exceeded] after it hits the number specified in maxObjects. Not only are some of the mbeans missing, but for some routes that actually did display statistics, after a while the statistics for some processors stop being shown on the profiling tab in Hawtio. The statistics for the processors that have stopped being shown in Hawtio are still in JMX. Weird! I have used jconsole to look at the list of processors, and it looks the same as the list through hawtio. Some of the processors are missing, even on a fresh startup of my webapp. It sounds like I am running into two separate problems: * Some processors are never showing up in JMX at all * Hawtio stops showing statistics at some point for some processors, but I can still look at the statistics through JMX -- View this message in context: http://camel.465427.n5.nabble.com/Not-all-processors-are-listed-in-JMX-preventing-detailed-route-statistics-profiling-tp5757634p5757739.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel cxfrs with swagger.
This is a link Freeman kindly shared with me earlier on http://svn.apache.org/viewvc?view=revisionrevision=r1537442 It refers to a ServiceMix demo, though I haven't tested the demo. I guess you'd register it the same way with cxfrs Cheers, Sergey On 17/10/14 16:19, atg roxx wrote: Hi Matt/Sergey, Thanks for replying. Sergey, I was not sure where and how to user your SwaggerFeature.. not sure where it will fit. Matt, In your approach too, could not see the use of camel cxfrs and also there are not camel routes to server the request. In Swagger config, could not see any resource location to search for resources class. Could you if possible , kindly let me know where how to use these in your sample program. -Regards, atg roxx On Fri, Oct 17, 2014 at 3:08 PM, Matt Raible m...@raibledesigns.com wrote: Here's how I did it. Application.java (to register Camel's servlet): import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.boot.context.embedded.ErrorPage; import org.springframework.boot.context.embedded.ServletRegistrationBean; import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpStatus; @Configuration @ComponentScan @EnableAutoConfiguration public class Application extends SpringBootServletInitializer { private static final String CAMEL_URL_MAPPING = /rest/*; private static final String CAMEL_SERVLET_NAME = CamelServlet; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } @Bean public ServletRegistrationBean servletRegistrationBean() { ServletRegistrationBean registration = new ServletRegistrationBean(new CamelHttpTransportServlet(), CAMEL_URL_MAPPING); registration.setName(CAMEL_SERVLET_NAME); return registration; } @Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomizer() { @Override public void customize(ConfigurableEmbeddedServletContainer container) { ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, /401.html); ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, /404.html); ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, /500.html); container.addErrorPages(error401Page, error404Page, error500Page); } }; } } SwaggerConfig.java: @Configuration public class SwaggerConfig implements EnvironmentAware { private RelaxedPropertyResolver propertyResolver; @Override public void setEnvironment(Environment environment) { this.propertyResolver = new RelaxedPropertyResolver(environment, swagger.); } /** * Swagger Camel Configuration */ @Bean public ServletRegistrationBean swaggerServlet() { ServletRegistrationBean swagger = new ServletRegistrationBean(new SpringRestSwaggerApiDeclarationServlet(), /swagger/*); MapString, String params = new HashMap(); params.put(base.path, https://localhost:8443/rest;); params.put(api.title, propertyResolver.getProperty(title)); params.put(api.description, propertyResolver.getProperty(description)); params.put(api.termsOfServiceUrl, propertyResolver.getProperty(termsOfServiceUrl)); params.put(api.license, propertyResolver.getProperty(license)); params.put(api.licenseUrl, propertyResolver.getProperty(licenseUrl)); swagger.setInitParameters(params); return swagger; } } application.properties: # Swagger swagger.title = My API swagger.description = A description. swagger.termsOfServiceUrl = http://yourcompany.com/terms.html swagger.contact = swagger.license = Apache 2.0 swagger.licenseUrl = http://www.apache.org/licenses/LICENSE-2.0.html Hope this helps, Matt On Fri, Oct 17, 2014 at 3:18 AM, atg roxx atgr...@gmail.com
custom converter to string (json, xml, csv)
I have a custom object that I will be passing through Camel routes and there may be times where I want to convert the object to different formats, which means that I need to write custom converters. My question is, how do I write a converter for the different String-based formats such as JSON, XML and CSV and have Camel be smart enough to choose the correct one? If I have the following methods @Converter public String myObjectToXml( MyObject event ){ // do stuff here return xmljunk/xml; } @Converter public String myObjectToJson( MyObject event ){ // do stuff here return {stuff:junk}; } @Converter public String myObjectToCsv( MyObject event ){ // do stuff here return junk,blah; } So I would marshal the object to a String-based format, but how does Camel know which one I want?
Re: custom converter to string (json, xml, csv)
You are looking for different data formats, not for different type converters. Best, Christian Am 17.10.2014 20:50 schrieb Mark Webb elihusma...@gmail.com: I have a custom object that I will be passing through Camel routes and there may be times where I want to convert the object to different formats, which means that I need to write custom converters. My question is, how do I write a converter for the different String-based formats such as JSON, XML and CSV and have Camel be smart enough to choose the correct one? If I have the following methods @Converter public String myObjectToXml( MyObject event ){ // do stuff here return xmljunk/xml; } @Converter public String myObjectToJson( MyObject event ){ // do stuff here return {stuff:junk}; } @Converter public String myObjectToCsv( MyObject event ){ // do stuff here return junk,blah; } So I would marshal the object to a String-based format, but how does Camel know which one I want?
Camel-Restlet 2.14.0 Client Address from Request
Hi, I'm trying to log the client address from a request. I set the useForwardedForHeader option to true on the RestletComponent. I see that the CamelRestletRequest carries a HttpExchangeCall object that contains the clientAddress, but that's always null. CamelRestletResponse carries a HttpExchangeCall object that contains the serverAddress, but that's always null too. Appreciate help on this. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Restlet-2-14-0-Client-Address-from-Request-tp5757736.html Sent from the Camel - Users mailing list archive at Nabble.com.