Re: File to JMS queue not working
Hi, Do you see anything comming up on logs ? if yes please share that. Regards, -Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/File-to-JMS-queue-not-working-tp5772904p5772923.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Exchanges body and properites are not collected if it contains reference object which lead to memory leak
Any help please ? - Othman Darwish ProgressSoft Corp. -- View this message in context: http://camel.465427.n5.nabble.com/Exchanges-body-and-properites-are-not-collected-if-it-contains-reference-object-which-lead-to-memoryk-tp5772861p5772922.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: [camel-cxf] using blueprint
> I cannot find any examples for setting up camel-cxf using blueprint, can > someone point me the right direction? > The one I have found uses spring, is there a way to not use spring for this > component? This is a stripped down blueprint XML file that works. If I stripped too much and it doesn't make sense, please let me know and I'll try to help. http://www.osgi.org/xmlns/blueprint/v1.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:camel-cxf="http://camel.apache.org/schema/blueprint/cxf"; xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/1.0.0/blueprint.xsd http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/cxf/camel-cxf-blueprint.xsd";> http://localhost:9000"; serviceClass="com.my.co.WebService" loggingFeatureEnabled="true"/> http://camel.apache.org/schema/blueprint";> http://localhost:9000?matchOnUriPrefix=true"/>
[camel-cxf] using blueprint
I cannot find any examples for setting up camel-cxf using blueprint, can someone point me the right direction? The one I have found uses spring, is there a way to not use spring for this component?
Re: Camel tracer logs in hawtio
Thank you! I can confirm it works very well -- View this message in context: http://camel.465427.n5.nabble.com/Camel-tracer-logs-in-hawtio-tp5772869p5772917.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel tracer logs in hawtio
Yes as then its the same jvm that host the same app and you are in better control of the logging. You can then add that log4j-insight mbean that is needed. See here how ActiveMQ does it https://github.com/apache/activemq/blob/master/assembly/src/release/conf/activemq.xml#L32 On Tue, Oct 20, 2015 at 5:22 PM, Karts wrote: > Would it work if we run Camel as a standalone app with hawtio embedded? It > should be possible for us to switch to this. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-tracer-logs-in-hawtio-tp5772869p5772910.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2nd edition: https://www.manning.com/books/camel-in-action-second-edition
Re: Camel tracer logs in hawtio
Would it work if we run Camel as a standalone app with hawtio embedded? It should be possible for us to switch to this. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-tracer-logs-in-hawtio-tp5772869p5772910.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Handle Mail exception
Yes *template* is null, you need to create the template one time before you can use it. Also a good idea during coding is to run and debug the code, and set a breakpoint. On Tue, Oct 20, 2015 at 4:26 PM, zied123456 wrote: > Also with only : > > public void handleException(final String message, final Exchange > originalExchange, final Throwable exception) { > > template.sendBody("file://mail?fileName=mailtext3.txt", > "Cannot connect:" > +exception); > } > } > > it doesn't work. > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Handle-Mail-exception-tp5772902p5772905.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2nd edition: https://www.manning.com/books/camel-in-action-second-edition
Re: Handle Mail exception
Also with only : public void handleException(final String message, final Exchange originalExchange, final Throwable exception) { template.sendBody("file://mail?fileName=mailtext3.txt", "Cannot connect:" +exception); } } it doesn't work. -- View this message in context: http://camel.465427.n5.nabble.com/Handle-Mail-exception-tp5772902p5772905.html Sent from the Camel - Users mailing list archive at Nabble.com.
File to JMS queue not working
{ CamelContext context = new DefaultCamelContext(); ConnectionFactory connectionFactory = new ActiveMQConnectionFactory( "tcp://localhost:61616"); context.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); context.addRoutes(new RouteBuilder() { public void configure() { // from("jms:test").process(new Processor() { // public void process(Exchange exchange) { // System.out.println("Hello "); // System.out.println(exchange.getIn().getHeader( // "CamelFileName")); // } // }).to("file:C:/users/abhishek.singh/Desktop/data/outbox"); from("file:C:/users/abhishek.singh/Desktop/data/inbox?noop=true").to( "jms:test"); } }); context.start(); Thread.sleep(2); context.stop(); } The folder contains text files. Also the commented code works well, I am able to fetch data from jms queue to file system but the reverse is not working. please help. -- View this message in context: http://camel.465427.n5.nabble.com/File-to-JMS-queue-not-working-tp5772904.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Handle Mail exception
Your produce template is very likely null On Tue, Oct 20, 2015 at 4:03 PM, zied123456 wrote: > I want to write the excpetion in a file : > > *This is the route:* > > class="com.ngtrend.readmail2.MyExceptionHandler"/> > > > > > > this is what i set in *myExceptionHandler class:* > > public class MyExceptionHandler implements ExceptionHandler { > private ProducerTemplate template; > public void *handleException*(String message,Throwable exception) { > handleException(exception.getMessage(), null, exception); > } > > @Override > public void *handleException*(final String message, final Exchange > originalExchange, final Throwable exception) { > > template.send("file://mail?fileName=mailtext3.txt", new > Processor() { > @Override > public void process(Exchange exchange) throws Exception { > exchange.getIn().setBody(message); > > } > }); > } > > But it doesn't work got this error message: > > WARN Error handling exception. This exception will be ignored. > java.lang.NullPointerException > > How can i fix it ? > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Handle-Mail-exception-tp5772902.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2nd edition: https://www.manning.com/books/camel-in-action-second-edition
Handle Mail exception
I want to write the excpetion in a file : *This is the route:* this is what i set in *myExceptionHandler class:* public class MyExceptionHandler implements ExceptionHandler { private ProducerTemplate template; public void *handleException*(String message,Throwable exception) { handleException(exception.getMessage(), null, exception); } @Override public void *handleException*(final String message, final Exchange originalExchange, final Throwable exception) { template.send("file://mail?fileName=mailtext3.txt", new Processor() { @Override public void process(Exchange exchange) throws Exception { exchange.getIn().setBody(message); } }); } But it doesn't work got this error message: WARN Error handling exception. This exception will be ignored. java.lang.NullPointerException How can i fix it ? -- View this message in context: http://camel.465427.n5.nabble.com/Handle-Mail-exception-tp5772902.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Netty for TCP communication
Hi, I am using netty to send a request over a TCP socket. When I send the request I need to send 4 bytes length of the message and then followed by an XML payload. On response I am getting 4 bytes length and then XML payload. Now I wrote a client code to connect the camel route and sending message as like below but am getting the following exception "io.netty.handler.codec.TooLongFrameException: Adjusted frame length exceeds 8192: 1214606448 - discarded" My request from client: 00 00 00 D0CRNCARD100010002120151007121700 51541612170010 Can someone give me some pointer / sample code example to send the request from client to my camel route. I am using netty in conjunction with Apache Camel. Help me to solve the below exception io.netty.handler.codec.TooLongFrameException: Adjusted frame length exceeds 8192: 808460340 - discarded at io.netty.handler.codec.LengthFieldBasedFrameDecoder.fail(LengthFieldBasedFrameDecoder.java:499) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.failIfNecessary(LengthFieldBasedFrameDecoder.java:477) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:403) at io.netty.handler.codec.LengthFieldBasedFrameDecoder.decode(LengthFieldBasedFrameDecoder.java:343) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:327) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:230) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) at java.lang.Thread.run(Thread.java:745) Thanks Denashkumar M Mobile: +91 9578605707,9962105706 denashkuma...@fisglobal.com [cid:image001.jpg@01CB42C7.8926D620] _ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
Re: ProducerTemplate creates too much threads
You can use the addService api on CamelContext - see its javadoc On Tue, Oct 20, 2015 at 1:55 PM, Shylendran C wrote: > Thanks for your reply. > So, just want to confirm - no need to put the start() and stop() for each > thread, is that correct? > And, our application will be running for ever (untill we manually kill the > process), so I am not sure where to put the stop() method. Any suggestions? > > Thanks again, > Shylendran.C > > On Tue, Oct 20, 2015 at 1:06 AM, Claus Ibsen wrote: > >> Dont start / stop it all the time, create it once and reuse it, and >> stop it when you stop your app. >> >> On Tue, Oct 20, 2015 at 6:17 AM, shylendran.c >> wrote: >> > Hi, >> > I am using camel-code-2.15.2.jar. I have a multi-threaded application >> where >> > I have to send message continuously and I am using >> > org.apache.camel.ProducerTemplate. But since it is a multi-threaded, it >> is >> > breaking and getting the below exceptions. So, I've tried with 'static >> > synchronized' where everything is working, but we can't go with 'static >> > synchronized'. So looking for a solution. >> > It is clear that the exception is happening when we have >> > ProducerTemplate.start() and stop() when multi-threads are invoking >> this. We >> > have created only one instance of ProducerTemplate. >> > >> > Is there a way which I can check whether the producer template is already >> > 'open' or 'stop'. I see few protected variables, and while debugging I >> see >> > exactly what I am looking. >> > Please let me know your opinion on this. >> > >> > class RMThread implements Runnable { >> > >> > ... >> > . >> > public void run() { >> > if (producerTemp != null) { >> > >> > producerTemp.start(); >> > producerTemp.sendBodyAndHeaders("", "", map); >> > producerTemp.stop(); >> > . >> > .. >> > } >> > } >> > >> > public class MainClass { >> > >> > ProducerTemplate producerTemplate = null; >> > producerTemplate = configureRoutes.getContext().createProducerTemplate(); >> > >> > ServerSocket ss = new ServerSocket(111 >> > while (true) { >> > new Thread(new RMThread(ss.accept(), log, producerTemplate, >> > producerTemplate_sendTransferMetrics)).start(); >> > >> > } >> > >> > >> > Exceptions:: >> > org.apache.camel.CamelExecutionException: Exception occurred during >> > execution on the exchange: Exchange[Message: ] >> > at >> > >> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635) >> > >> > Caused by: java.lang.IllegalStateException: Pool not open >> > at >> > >> org.apache.commons.pool.BaseObjectPool.assertOpen(BaseObjectPool.java:140) >> > ... >> > >> > >> > Thanks, >> > Shylendran.C >> > >> > >> > >> > >> > -- >> > View this message in context: >> http://camel.465427.n5.nabble.com/ProducerTemplate-creates-too-much-threads-tp5751299p5772885.html >> > Sent from the Camel - Users mailing list archive at Nabble.com. >> >> >> >> -- >> Claus Ibsen >> - >> http://davsclaus.com @davsclaus >> Camel in Action 2nd edition: >> https://www.manning.com/books/camel-in-action-second-edition >> -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2nd edition: https://www.manning.com/books/camel-in-action-second-edition
Re: ProducerTemplate creates too much threads
Thanks for your reply. So, just want to confirm - no need to put the start() and stop() for each thread, is that correct? And, our application will be running for ever (untill we manually kill the process), so I am not sure where to put the stop() method. Any suggestions? Thanks again, Shylendran.C On Tue, Oct 20, 2015 at 1:06 AM, Claus Ibsen wrote: > Dont start / stop it all the time, create it once and reuse it, and > stop it when you stop your app. > > On Tue, Oct 20, 2015 at 6:17 AM, shylendran.c > wrote: > > Hi, > > I am using camel-code-2.15.2.jar. I have a multi-threaded application > where > > I have to send message continuously and I am using > > org.apache.camel.ProducerTemplate. But since it is a multi-threaded, it > is > > breaking and getting the below exceptions. So, I've tried with 'static > > synchronized' where everything is working, but we can't go with 'static > > synchronized'. So looking for a solution. > > It is clear that the exception is happening when we have > > ProducerTemplate.start() and stop() when multi-threads are invoking > this. We > > have created only one instance of ProducerTemplate. > > > > Is there a way which I can check whether the producer template is already > > 'open' or 'stop'. I see few protected variables, and while debugging I > see > > exactly what I am looking. > > Please let me know your opinion on this. > > > > class RMThread implements Runnable { > > > > ... > > . > > public void run() { > > if (producerTemp != null) { > > > > producerTemp.start(); > > producerTemp.sendBodyAndHeaders("", "", map); > > producerTemp.stop(); > > . > > .. > > } > > } > > > > public class MainClass { > > > > ProducerTemplate producerTemplate = null; > > producerTemplate = configureRoutes.getContext().createProducerTemplate(); > > > > ServerSocket ss = new ServerSocket(111 > > while (true) { > > new Thread(new RMThread(ss.accept(), log, producerTemplate, > > producerTemplate_sendTransferMetrics)).start(); > > > > } > > > > > > Exceptions:: > > org.apache.camel.CamelExecutionException: Exception occurred during > > execution on the exchange: Exchange[Message: ] > > at > > > org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1635) > > > > Caused by: java.lang.IllegalStateException: Pool not open > > at > > > org.apache.commons.pool.BaseObjectPool.assertOpen(BaseObjectPool.java:140) > > ... > > > > > > Thanks, > > Shylendran.C > > > > > > > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/ProducerTemplate-creates-too-much-threads-tp5751299p5772885.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Claus Ibsen > - > http://davsclaus.com @davsclaus > Camel in Action 2nd edition: > https://www.manning.com/books/camel-in-action-second-edition >
Re: Camel Unit Test Cases - Using TestNG
Ah sorry I was to fast, there is a CamelSpringTestSupport in camel-testng you can use. See how it test itself in its own unit tests of camel-testng On Tue, Oct 20, 2015 at 9:34 AM, Claus Ibsen wrote: > If camel-context.xml is a spring xml file, then you must use > camel-test-spring for unit testing > > On Tue, Oct 20, 2015 at 9:17 AM, contactreji wrote: >> Hey all >> >> As of now, I have a route created using RouteBuilder API in my below test >> class. >> >> I was kinda wondering if I can start routes defined in camel-context.xml >> file in the project class path. What if I wanna unit test the routes in >> camel-context.xml file. Is there a way I can modify my below test class to >> start the routes in xml dsl file? >> >> >> * >> package com.ds.case1.test; >> >> import org.apache.camel.EndpointInject; >> import org.apache.camel.Produce; >> import org.apache.camel.ProducerTemplate; >> import org.apache.camel.builder.RouteBuilder; >> import org.apache.camel.component.mock.MockEndpoint; >> import org.apache.camel.testng.CamelTestSupport; >> import org.testng.Assert; >> import org.testng.annotations.Test; >> >> public class UnitTests extends CamelTestSupport { >> >> @EndpointInject(uri = "mock:result") >> protected MockEndpoint resultEndpoint; >> >> @Produce(uri = "direct:start") >> protected ProducerTemplate template; >> >> @Test >> public void testPrintMessage() { >> String message = "TestSample"; >> Assert.assertEquals(message, "TestSample"); >> } >> >> @Test >> public void testSendMatchingMessage() throws Exception { >> String expectedBody = ""; >> >> getMockEndpoint("mock:result").expectedBodiesReceived(expectedBody); >> template.sendBodyAndHeader("direct:start", expectedBody, >> "foo", "bar"); >> assertMockEndpointsSatisfied(); >> assertTrue(true); >> } >> >> @Override >> protected RouteBuilder createRouteBuilder() { >> System.out.println("Starting route..."); >> return new RouteBuilder() { >> public void configure() { >> >> from("direct:start").filter(header("foo").isEqualTo("bar")) >> .log("Route EXECUTED >> ...").to("mock:result"); >> } >> }; >> } >> } >> * >> >> >> >> - >> Reji Mathews >> Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & >> Jboss Fuse ESB | Mule ESB ) >> LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a >> Twitter - reji_mathews >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Camel-Unit-Test-Cases-Using-TestNG-tp5772886p5772895.html >> Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Claus Ibsen > - > http://davsclaus.com @davsclaus > Camel in Action 2nd edition: > https://www.manning.com/books/camel-in-action-second-edition -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2nd edition: https://www.manning.com/books/camel-in-action-second-edition
Re: Camel Unit Test Cases - Using TestNG
If camel-context.xml is a spring xml file, then you must use camel-test-spring for unit testing On Tue, Oct 20, 2015 at 9:17 AM, contactreji wrote: > Hey all > > As of now, I have a route created using RouteBuilder API in my below test > class. > > I was kinda wondering if I can start routes defined in camel-context.xml > file in the project class path. What if I wanna unit test the routes in > camel-context.xml file. Is there a way I can modify my below test class to > start the routes in xml dsl file? > > > * > package com.ds.case1.test; > > import org.apache.camel.EndpointInject; > import org.apache.camel.Produce; > import org.apache.camel.ProducerTemplate; > import org.apache.camel.builder.RouteBuilder; > import org.apache.camel.component.mock.MockEndpoint; > import org.apache.camel.testng.CamelTestSupport; > import org.testng.Assert; > import org.testng.annotations.Test; > > public class UnitTests extends CamelTestSupport { > > @EndpointInject(uri = "mock:result") > protected MockEndpoint resultEndpoint; > > @Produce(uri = "direct:start") > protected ProducerTemplate template; > > @Test > public void testPrintMessage() { > String message = "TestSample"; > Assert.assertEquals(message, "TestSample"); > } > > @Test > public void testSendMatchingMessage() throws Exception { > String expectedBody = ""; > > getMockEndpoint("mock:result").expectedBodiesReceived(expectedBody); > template.sendBodyAndHeader("direct:start", expectedBody, > "foo", "bar"); > assertMockEndpointsSatisfied(); > assertTrue(true); > } > > @Override > protected RouteBuilder createRouteBuilder() { > System.out.println("Starting route..."); > return new RouteBuilder() { > public void configure() { > > from("direct:start").filter(header("foo").isEqualTo("bar")) > .log("Route EXECUTED > ...").to("mock:result"); > } > }; > } > } > * > > > > - > Reji Mathews > Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & > Jboss Fuse ESB | Mule ESB ) > LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a > Twitter - reji_mathews > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-Unit-Test-Cases-Using-TestNG-tp5772886p5772895.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2nd edition: https://www.manning.com/books/camel-in-action-second-edition
Re: Camel Unit Test Cases - Using TestNG
Hey all As of now, I have a route created using RouteBuilder API in my below test class. I was kinda wondering if I can start routes defined in camel-context.xml file in the project class path. What if I wanna unit test the routes in camel-context.xml file. Is there a way I can modify my below test class to start the routes in xml dsl file? * package com.ds.case1.test; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.testng.CamelTestSupport; import org.testng.Assert; import org.testng.annotations.Test; public class UnitTests extends CamelTestSupport { @EndpointInject(uri = "mock:result") protected MockEndpoint resultEndpoint; @Produce(uri = "direct:start") protected ProducerTemplate template; @Test public void testPrintMessage() { String message = "TestSample"; Assert.assertEquals(message, "TestSample"); } @Test public void testSendMatchingMessage() throws Exception { String expectedBody = ""; getMockEndpoint("mock:result").expectedBodiesReceived(expectedBody); template.sendBodyAndHeader("direct:start", expectedBody, "foo", "bar"); assertMockEndpointsSatisfied(); assertTrue(true); } @Override protected RouteBuilder createRouteBuilder() { System.out.println("Starting route..."); return new RouteBuilder() { public void configure() { from("direct:start").filter(header("foo").isEqualTo("bar")) .log("Route EXECUTED ...").to("mock:result"); } }; } } * - Reji Mathews Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB ) LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a Twitter - reji_mathews -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Unit-Test-Cases-Using-TestNG-tp5772886p5772895.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Unit Test Cases - Using TestNG
Thanks Claus. It worked :-) . The import package statement was the culprit. I replaced it with import org.apache.camel.testng.CamelTestSupport; Cheers -Reji - Reji Mathews Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss Fuse ESB | Mule ESB ) LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a Twitter - reji_mathews -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Unit-Test-Cases-Using-TestNG-tp5772886p5772894.html Sent from the Camel - Users mailing list archive at Nabble.com.