i am new to camel
hi i am newbie to camel.the guide is not to helpful for basic. i would be very thankful if any person guide me about a basic app whose basic purpose is to read an XML and write it to the file. Also please guide me about routes and proccessor. Thanks alot -- View this message in context: http://camel.465427.n5.nabble.com/i-am-new-to-camel-tp5594434p5594434.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: i am new to camel
Hi Welcome to the community. I suggest to read this article that talks what Camel is, and shows what it can do. http://java.dzone.com/articles/open-source-integration-apache Also chapter 1 of this book gives you introduction to Camel, and more details about the Camel concepts http://manning.com/ibsen/ The Camel web site itself unfortunately doesn't have the very best introduction code. http://camel.apache.org/getting-started.html A long time ago I wrote this tutorial, the information is still relevant and could also be a good read http://camel.apache.org/tutorial-example-reportincident.html The first link talks about an application that can read files (XML and CSV) and shows how to work with these. On Mon, Mar 26, 2012 at 9:10 AM, shaharyar wrote: > hi > i am newbie to camel.the guide is not to helpful for basic. i would be very > thankful if any person guide me about a basic app whose basic purpose is to > read an XML and write it to the file. > Also please guide me about routes and proccessor. > Thanks alot > > -- > View this message in context: > http://camel.465427.n5.nabble.com/i-am-new-to-camel-tp5594434p5594434.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Mock testing route ends prematurely
Hello, I am trying to test the number of messages and there is something I do not understand. The test ends successfully before the messages arrive at the mock endpoint. here is the test class: public class WeatherCurrentTest extends CamelTestSupport { @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { DataFormat jaxbDataFormat = new JaxbDataFormat("com.mycompany.model.entities.weather"); from("file:src/test/resources") .split() .tokenizeXML("metData") .unmarshal(jaxbDataFormat) .to("log:com.mycompany.datarobot?level=INFO") .to("mock:meteo1"); } }; } @Test public void testNumberOfWeatherStations() throws Exception { MockEndpoint mock = getMockEndpoint("mock:meteo1"); mock.expectedMessageCount(5); String fileName = "src/test/resources/observation_si_latest.xml"; Endpoint endpoint = new FileEndpoint("file:" + fileName, new FileComponent()); File meteo = new File(fileName); String content = context.getTypeConverter().convertTo(String.class, meteo); //send data to route template.sendBodyAndHeader(endpoint, content, Exchange.FILE_NAME, fileName); Thread.sleep(1000); mock.assertIsSatisfied(); } } The input XML file has 9 elements by which the file is splitted and converted to pojos. I would expect the above test to fail, as I am expecting only 5 messages, but the test output (.to("log:com.mycompany.datarobot?level=INFO")) prints out 5 messages and then "quits": [2012/03/26 10:42:22.901] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 jasno 0 0 Bilje pri Novi Gorici 15 V 22 ] [2012/03/26 10:42:22.907] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 pretežno jasno 0 0 Kredarica -10 S 11 ] [2012/03/26 10:42:22.912] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 pretežno jasno 0 0 Letališče Cerklje ob Krki 11 V 14 ] [2012/03/26 10:42:22.917] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 zmerno oblačno 0 0 Letališče Edvarda Rusjana Maribor 10 SV 11 ] [2012/03/26 10:42:22.927] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 delno oblačno 0 0 Letališče Jožeta Pučnika Ljubljana 12 JV 25 ] [2012/03/26 10:42:22.929] INFO [s.n.d.WeatherCurrentTest:tearDown]: [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: Testing done: (com.mycompany.datarobot.WeatherCurrentTest) [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: Took: 1.126 seconds (1126 millis) [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: [2012/03/26 10:42:22.931] INFO [o.a.c.i.DefaultCamelContext:doStop]: Apache Camel 2.9.1 (CamelContext: camel-1) is shutting down [2012/03/26 10:42:22.931] INFO [o.a.c.i.DefaultShutdownStrategy:doShutdown]: Starting to graceful shutdown 1 routes (timeout 10 seconds) [2012/03/26 10:42:22.932] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 jasno 0 0 Letališče Portorož 15 SV 22 ] [2012/03/26 10:42:22.934] INFO [o.a.c.i.DefaultShutdownStrategy:run]: Waiting as there are still 3 inflight and pending exchanges to complete, timeout in 10 seconds. [2012/03/26 10:42:22.937] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 0 0 Lisca 0 0 ] [2012/03/26 10:42:22.941] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 pretežno jasno 0 0 Ljubljana 12 V 14 ] [2012/03/26 10:42:22.945] INFO [s.n.datarobot:log]: Exchange[ExchangePattern:InOnly, BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: 0 31 0 Novo mesto 10 V 18 ] [2012/03/26 10:42:23.935] INFO [o.a.c.i.DefaultShutdownStrategy:run]: Route: route1 shutdown complete, was consuming from: Endpoint[file://src/test/resources] [2012/03/26 10:42:23.936] INFO [o.a.c.i.DefaultShutdownStrategy:doShutdown]: Graceful shutdown of 1 routes completed in 1 seconds [2012/03/26 10:42:23.937] INFO [o.a.c.i.DefaultInflightRepository:doStop]: Shutting down with n
Get routeId from Exchange / in Processor
Is it possible to get the ID of the current route from an Exchange, or to have the routeId provided to a processor/beanRef method as an argument?
Re: Headers disappearing in RoutingSlip
On 23 March 2012 16:33, Claus Ibsen wrote: > Hi > > You can use the tracer to help see where the headers dissappear > http://camel.apache.org/tracer > > And see this FAQ as well > http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html Thanks, Claus. This helped me debug to some extent and is great to know about for future use. However, from what I can tell, no headers that are set in the router reach the processor. The exchange seen in the router has a different hashCode to that which is seen in the processor. I double checked and I'm not using a routing slip - it's a dynamic router. Not sure that should make any difference. Perhaps there is a different pattern I should be using - the exchange is passed to a maximum of one SEDA queue in the router, and if no suitable queue is found an Exception is thrown. I'd be grateful for any more tips! Alex
Re: Get routeId from Exchange / in Processor
Hi The Exchange itself has a getFromRouteId which returns the id of the route, that created the exchange. If you pass the exchange in multiple routes, you can get the current route via UnitOfWork -> getRouteContext -> Route -> Id. You can get the UoW from the exchange. This is likely to be improved in Camel 3.x as we will do some internal cleanup and optimizations. And the "message history" pattern is something I would like to get easier and cleaner. Currently the data is a bit scattered. On Mon, Mar 26, 2012 at 11:14 AM, Alex Anderson wrote: > Is it possible to get the ID of the current route from an Exchange, or > to have the routeId provided to a processor/beanRef method as an > argument? -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Mock testing route ends prematurely
Hi Its not really clear from your description what is your problem. I think you talk about that there is 9 messages, but after 5 messages it completes, but you want it to fail. Or something like that. The assertion will complete when the expectations is satisfied. In your case thats when 5 messages reached. Then its regarded as completed. And then maybe a little sec later a new message arrives, so there is 6 messages. But the mock is still satisfied. There is a setAssertPeriod method you can use to let Camel "wait" after the mock is satisfied, to ensure no other messages arrives afterwards. On Mon, Mar 26, 2012 at 10:59 AM, Borut Bolčina wrote: > Hello, > > I am trying to test the number of messages and there is something I do not > understand. The test ends successfully before the messages arrive at the > mock endpoint. here is the test class: > > public class WeatherCurrentTest extends CamelTestSupport { > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > DataFormat jaxbDataFormat = new > JaxbDataFormat("com.mycompany.model.entities.weather"); > from("file:src/test/resources") > .split() > .tokenizeXML("metData") > .unmarshal(jaxbDataFormat) > .to("log:com.mycompany.datarobot?level=INFO") > .to("mock:meteo1"); > } > }; > } > @Test > public void testNumberOfWeatherStations() throws Exception { > MockEndpoint mock = getMockEndpoint("mock:meteo1"); > mock.expectedMessageCount(5); > > String fileName = "src/test/resources/observation_si_latest.xml"; > Endpoint endpoint = new FileEndpoint("file:" + fileName, new > FileComponent()); > File meteo = new File(fileName); > String content = context.getTypeConverter().convertTo(String.class, meteo); > //send data to route > template.sendBodyAndHeader(endpoint, content, Exchange.FILE_NAME, fileName); > > Thread.sleep(1000); > mock.assertIsSatisfied(); > } > } > > The input XML file has 9 elements by which the file is splitted > and converted to pojos. I would expect the above test to fail, as I am > expecting only 5 messages, but the test output > (.to("log:com.mycompany.datarobot?level=INFO")) prints out 5 messages and > then "quits": > > [2012/03/26 10:42:22.901] INFO [s.n.datarobot:log]: > Exchange[ExchangePattern:InOnly, > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: version="1.0" encoding="UTF-8" standalone="yes"?> > > 0 > jasno > 0 > 0 > > Bilje pri Novi Gorici > 15 > V > 22 > > ] > [2012/03/26 10:42:22.907] INFO [s.n.datarobot:log]: > Exchange[ExchangePattern:InOnly, > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: version="1.0" encoding="UTF-8" standalone="yes"?> > > 0 > pretežno jasno > 0 > 0 > > Kredarica > -10 > S > 11 > > ] > [2012/03/26 10:42:22.912] INFO [s.n.datarobot:log]: > Exchange[ExchangePattern:InOnly, > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: version="1.0" encoding="UTF-8" standalone="yes"?> > > 0 > pretežno jasno > 0 > 0 > > Letališče Cerklje ob Krki > 11 > V > 14 > > ] > [2012/03/26 10:42:22.917] INFO [s.n.datarobot:log]: > Exchange[ExchangePattern:InOnly, > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: version="1.0" encoding="UTF-8" standalone="yes"?> > > 0 > zmerno oblačno > 0 > 0 > > Letališče Edvarda Rusjana Maribor > 10 > SV > 11 > > ] > [2012/03/26 10:42:22.927] INFO [s.n.datarobot:log]: > Exchange[ExchangePattern:InOnly, > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: version="1.0" encoding="UTF-8" standalone="yes"?> > > 0 > delno oblačno > 0 > 0 > > Letališče Jožeta Pučnika Ljubljana > 12 > JV > 25 > > ] > [2012/03/26 10:42:22.929] INFO [s.n.d.WeatherCurrentTest:tearDown]: > > [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: > Testing done: (com.mycompany.datarobot.WeatherCurrentTest) > [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: Took: > 1.126 seconds (1126 millis) > [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: > > [2012/03/26 10:42:22.931] INFO [o.a.c.i.DefaultCamelContext:doStop]: > Apache Camel 2.9.1 (CamelContext: camel-1) is shutting down > [2012/03/26 10:42:22.931] INFO > [o.a.c.i.DefaultShutdownStrategy:doShutdown]: Starting to graceful > shutdown 1 routes (timeout 10 seconds) > [2012/03/26 10:42:22.932] INFO [s.n.datarobot:log]: > Exchange[ExchangePattern:InOnly, > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: version="1.0" encoding="UTF-8" standalone="yes"?> > > 0 > jasno > 0 > 0 > > Letališče Portorož > 15 > SV > 22 > > ] > [2012/03/26 10:42:22.
Re: multiple from endpoints and jmx console
Hi This is currently a limitation. What version of Camel do you use? On Thu, Mar 22, 2012 at 9:58 PM, surya wrote: > Hi, > > While monitoring camel app using Jconsole I observed that when we use > multiple endpoints in from() to create multiple routes..like below: > > from("jms:route1","direct:route1").to("otherendpoint") > > Only the route with first endpoint in from() is shown in jconsole. in the > above case only route with from("jms:route1") is visible. > > Is there a workaround or needs enhancement in camel? suggest. > > Regards, > Surya > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/multiple-from-endpoints-and-jmx-console-tp5587775p5587775.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: i am new to camel
thanx alot for your kind help.I hope this will help me -- View this message in context: http://camel.465427.n5.nabble.com/i-am-new-to-camel-tp5594434p5594726.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Passing post parameter as body in the cxfrs call.
HI Team, Could anyone please reply to this. Many thanks in advance. --cheers, atg roxx On Fri, Mar 23, 2012 at 5:05 PM, atg roxx wrote: > Hi Team, > > I have a unusually requirement. > > I have to send a request xml to a restful service as as body generated > from POST parameter. > > I am using cxfrs for this, setting the method type to POST, setting some > values to be passed in headers > using CxfConstants.CAMEL_CXF_RS_USING_HTTP_API > > but I am not getting how to pass the POST parameters as body. > > Is there any way to do that? > > --Regards, > atg roxx >
Re: Get routeId from Exchange / in Processor
Thanks, this (temporarily) solves my missing header issues :¬) On 26 March 2012 12:24, Claus Ibsen wrote: > Hi > > The Exchange itself has a getFromRouteId which returns the id of the > route, that created the exchange. > > If you pass the exchange in multiple routes, you can get the current > route via UnitOfWork -> getRouteContext -> Route -> Id. > You can get the UoW from the exchange. > > This is likely to be improved in Camel 3.x as we will do some internal > cleanup and optimizations. > And the "message history" pattern is something I would like to get > easier and cleaner. Currently the data is a bit scattered. > > > > On Mon, Mar 26, 2012 at 11:14 AM, Alex Anderson wrote: >> Is it possible to get the ID of the current route from an Exchange, or >> to have the routeId provided to a processor/beanRef method as an >> argument? > > > > -- > Claus Ibsen > - > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/
Re: Mock testing route ends prematurely
Hello, Dne 26. marec 2012 11:29 je Claus Ibsen napisal/-a: > Hi > > Its not really clear from your description what is your problem. > > I think you talk about that there is 9 messages, but after 5 messages > it completes, but you want it to fail. > Or something like that. > Exactly. > > The assertion will complete when the expectations is satisfied. > In your case thats when 5 messages reached. Then its regarded as > completed. And then maybe a little sec later a new message > arrives, so there is 6 messages. > But the mock is still satisfied. > > There is a setAssertPeriod method you can use to let Camel "wait" > after the mock is satisfied, to ensure no other messages arrives > afterwards. > I added mock.setAssertPeriod(1000); and the test now correctly fails if there are more messages then expected. FAILED: testNumberOfWeatherStations java.lang.AssertionError: mock://meteo1 Received message count. Expected: <5> but was: <9> Thanks Ibsen, Borut > > On Mon, Mar 26, 2012 at 10:59 AM, Borut Bolčina > wrote: > > Hello, > > > > I am trying to test the number of messages and there is something I do > not > > understand. The test ends successfully before the messages arrive at the > > mock endpoint. here is the test class: > > > > public class WeatherCurrentTest extends CamelTestSupport { > > @Override > > protected RouteBuilder createRouteBuilder() throws Exception { > > return new RouteBuilder() { > > @Override > > public void configure() throws Exception { > > DataFormat jaxbDataFormat = new > > JaxbDataFormat("com.mycompany.model.entities.weather"); > > from("file:src/test/resources") > > .split() > > .tokenizeXML("metData") > > .unmarshal(jaxbDataFormat) > > .to("log:com.mycompany.datarobot?level=INFO") > > .to("mock:meteo1"); > > } > > }; > > } > > @Test > > public void testNumberOfWeatherStations() throws Exception { > > MockEndpoint mock = getMockEndpoint("mock:meteo1"); > > mock.expectedMessageCount(5); > > > > String fileName = "src/test/resources/observation_si_latest.xml"; > > Endpoint endpoint = new FileEndpoint("file:" + fileName, new > > FileComponent()); > > File meteo = new File(fileName); > > String content = context.getTypeConverter().convertTo(String.class, > meteo); > > //send data to route > > template.sendBodyAndHeader(endpoint, content, Exchange.FILE_NAME, > fileName); > > > > Thread.sleep(1000); > > mock.assertIsSatisfied(); > > } > > } > > > > The input XML file has 9 elements by which the file is splitted > > and converted to pojos. I would expect the above test to fail, as I am > > expecting only 5 messages, but the test output > > (.to("log:com.mycompany.datarobot?level=INFO")) prints out 5 messages and > > then "quits": > > > > [2012/03/26 10:42:22.901] INFO [s.n.datarobot:log]: > > Exchange[ExchangePattern:InOnly, > > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: > version="1.0" encoding="UTF-8" standalone="yes"?> > > > >0 > >jasno > >0 > >0 > > > >Bilje pri Novi Gorici > >15 > >V > >22 > > > > ] > > [2012/03/26 10:42:22.907] INFO [s.n.datarobot:log]: > > Exchange[ExchangePattern:InOnly, > > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: > version="1.0" encoding="UTF-8" standalone="yes"?> > > > >0 > >pretežno jasno > >0 > >0 > > > >Kredarica > >-10 > >S > >11 > > > > ] > > [2012/03/26 10:42:22.912] INFO [s.n.datarobot:log]: > > Exchange[ExchangePattern:InOnly, > > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: > version="1.0" encoding="UTF-8" standalone="yes"?> > > > >0 > >pretežno jasno > >0 > >0 > > > >Letališče Cerklje ob Krki > >11 > >V > >14 > > > > ] > > [2012/03/26 10:42:22.917] INFO [s.n.datarobot:log]: > > Exchange[ExchangePattern:InOnly, > > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: > version="1.0" encoding="UTF-8" standalone="yes"?> > > > >0 > >zmerno oblačno > >0 > >0 > > > >Letališče Edvarda Rusjana Maribor > >10 > >SV > >11 > > > > ] > > [2012/03/26 10:42:22.927] INFO [s.n.datarobot:log]: > > Exchange[ExchangePattern:InOnly, > > BodyType:com.mycompany.model.entities.weather.WeatherCurrent, Body: > version="1.0" encoding="UTF-8" standalone="yes"?> > > > >0 > >delno oblačno > >0 > >0 > > > >Letališče Jožeta Pučnika > Ljubljana > >12 > >JV > >25 > > > > ] > > [2012/03/26 10:42:22.929] INFO [s.n.d.WeatherCurrentTest:tearDown]: > > > > > [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: > > Testing done: (com.mycompany.datarobot.WeatherCurrentTest) > > [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: > Took: > > 1.126 seconds (1126 millis) > > [2012/03/26 10:42:22.930] INFO [s.n.d.WeatherCurrentTest:tearDown]: > > >
Configuring endpoint programmatically
Hello again, The File component can be configured with some options, I am interested in "noop=true". What can be done by: from("file:src/test/resources?fileName=myFile.xml&noop=true") is what I want to do it with code: String fileName = "src/test/resources/myFile.xml"; Endpoint endpoint = new FileEndpoint("file:" + fileName, new FileComponent()); Map options = new HashMap(); options.put("noop", "true"); endpoint.configureProperties(options); but it does not work - the file is still moved, which is something I do not want. I tried with boolean value as well, but the same result. I found nothing in the mailing list, nor in the Camel book. I also tried: String fileName = "myFile.xml"; FileComponent fileComponent = new FileComponent(); fileComponent.setCamelContext(context); Endpoint endpoint = fileComponent.createEndpoint("file:" + fileName); Map options = new HashMap(); options.put("noop", "true"); endpoint.configureProperties(options); but no success either. -borut
How to handle attachments in JMS message
Hi all Camels DefaultMessage has an attachment map and CXFs message also knows attachments. But a JMS message does not know about attachments. I have an mtom-enabled SOAP service that sends an object along with file attachments (mtom to serialize attachments as binary data instead of base64). I consume these messages with CXF to get a Camel Exchange for further processing. But how would I handle the attachments to put the messages on a plain JMS-queue? Is there any standard way or a recommendation how to handle file attachments in JMS messages? I can of course marshal and unmarshal the messages with JAXB, but then the attachments are serialized as base64. Thanks Stefan
Re: Configuring endpoint programmatically
Hi Just use the setters on the file endpoint FileEndpoint endpoint = ... endpoint.setNoop(true); On Mon, Mar 26, 2012 at 1:16 PM, Borut Bolčina wrote: > Hello again, > > The File component can be configured with some options, I am interested in > "noop=true". What can be done by: > > from("file:src/test/resources?fileName=myFile.xml&noop=true") > > is what I want to do it with code: > > String fileName = "src/test/resources/myFile.xml"; > Endpoint endpoint = new FileEndpoint("file:" + fileName, new > FileComponent()); > Map options = new HashMap(); > options.put("noop", "true"); > endpoint.configureProperties(options); > > but it does not work - the file is still moved, which is something I do not > want. I tried with boolean value as well, but the same result. I found > nothing in the mailing list, nor in the Camel book. > > I also tried: > > String fileName = "myFile.xml"; > FileComponent fileComponent = new FileComponent(); > fileComponent.setCamelContext(context); > Endpoint endpoint = fileComponent.createEndpoint("file:" + fileName); > Map options = new HashMap(); > options.put("noop", "true"); > endpoint.configureProperties(options); > > but no success either. > > -borut -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Configuring endpoint programmatically
It felt like a solution, but still fails. The file is moved one level lower to src/test/resources/.camel folder just like before. @Test public void testNumberOfWeatherStations() throws Exception { MockEndpoint mock = getMockEndpoint("mock:meteo1"); mock.expectedMessageCount(9); mock.setAssertPeriod(1000); String fileName = "src/test/resources/observation_si_latest.xml"; FileEndpoint endpoint = new FileEndpoint("file:" + fileName, new FileComponent()); endpoint.setNoop(true); File meteo = new File(fileName); String content = context.getTypeConverter().convertTo(String.class, meteo); //send data to route template.sendBodyAndHeader(endpoint, content, Exchange.FILE_NAME, fileName); mock.assertIsSatisfied(); } Am I constructing the endpoint wrong? -borut Dne 26. marec 2012 13:37 je Claus Ibsen napisal/-a: > Hi > > Just use the setters on the file endpoint > > FileEndpoint endpoint = ... > endpoint.setNoop(true); > > > On Mon, Mar 26, 2012 at 1:16 PM, Borut Bolčina > wrote: > > Hello again, > > > > The File component can be configured with some options, I am interested > in > > "noop=true". What can be done by: > > > > from("file:src/test/resources?fileName=myFile.xml&noop=true") > > > > is what I want to do it with code: > > > > String fileName = "src/test/resources/myFile.xml"; > > Endpoint endpoint = new FileEndpoint("file:" + fileName, new > > FileComponent()); > > Map options = new HashMap(); > > options.put("noop", "true"); > > endpoint.configureProperties(options); > > > > but it does not work - the file is still moved, which is something I do > not > > want. I tried with boolean value as well, but the same result. I found > > nothing in the mailing list, nor in the Camel book. > > > > I also tried: > > > > String fileName = "myFile.xml"; > > FileComponent fileComponent = new FileComponent(); > > fileComponent.setCamelContext(context); > > Endpoint endpoint = fileComponent.createEndpoint("file:" + fileName); > > Map options = new HashMap(); > > options.put("noop", "true"); > > endpoint.configureProperties(options); > > > > but no success either. > > > > -borut > > > > -- > Claus Ibsen > - > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ >
Re: Configuring endpoint programmatically
It's the route that one is testing that matters. I added the noop option to: from("file:src/test/resources?noop=true") and then in the test method it does not matter how one constructs the endpoint. So it boils down to: @Test public void testNumberOfWeatherStations() throws Exception { MockEndpoint mock = getMockEndpoint("mock:meteo1"); mock.expectedMessageCount(9); mock.setAssertPeriod(1000); String fileName = "src/test/resources/observation_si_latest.xml"; File meteo = new File(fileName); FileEndpoint endpoint = new FileEndpoint(); endpoint.setFile(meteo); String content = context.getTypeConverter().convertTo(String.class, meteo); //send data to route template.sendBodyAndHeader(endpoint, content, Exchange.FILE_NAME, fileName); mock.assertIsSatisfied(); } Just curious, is there another way to send data to route than template.sendBodyAndHeader? -borut Dne 26. marec 2012 14:04 je Borut Bolčina napisal/-a: > It felt like a solution, but still fails. The file is moved one level > lower to src/test/resources/.camel folder just like before. > > @Test > public void testNumberOfWeatherStations() throws Exception { > MockEndpoint mock = getMockEndpoint("mock:meteo1"); > mock.expectedMessageCount(9); > mock.setAssertPeriod(1000); > > String fileName = "src/test/resources/observation_si_latest.xml"; > FileEndpoint endpoint = new FileEndpoint("file:" + fileName, new > FileComponent()); > endpoint.setNoop(true); > File meteo = new File(fileName); > String content = context.getTypeConverter().convertTo(String.class, > meteo); > //send data to route > template.sendBodyAndHeader(endpoint, content, Exchange.FILE_NAME, > fileName); > mock.assertIsSatisfied(); > } > > Am I constructing the endpoint wrong? > > -borut > > Dne 26. marec 2012 13:37 je Claus Ibsen napisal/-a: > > Hi >> >> Just use the setters on the file endpoint >> >> FileEndpoint endpoint = ... >> endpoint.setNoop(true); >> >> >> On Mon, Mar 26, 2012 at 1:16 PM, Borut Bolčina >> wrote: >> > Hello again, >> > >> > The File component can be configured with some options, I am interested >> in >> > "noop=true". What can be done by: >> > >> > from("file:src/test/resources?fileName=myFile.xml&noop=true") >> > >> > is what I want to do it with code: >> > >> > String fileName = "src/test/resources/myFile.xml"; >> > Endpoint endpoint = new FileEndpoint("file:" + fileName, new >> > FileComponent()); >> > Map options = new HashMap(); >> > options.put("noop", "true"); >> > endpoint.configureProperties(options); >> > >> > but it does not work - the file is still moved, which is something I do >> not >> > want. I tried with boolean value as well, but the same result. I found >> > nothing in the mailing list, nor in the Camel book. >> > >> > I also tried: >> > >> > String fileName = "myFile.xml"; >> > FileComponent fileComponent = new FileComponent(); >> > fileComponent.setCamelContext(context); >> > Endpoint endpoint = fileComponent.createEndpoint("file:" + fileName); >> > Map options = new HashMap(); >> > options.put("noop", "true"); >> > endpoint.configureProperties(options); >> > >> > but no success either. >> > >> > -borut >> >> >> >> -- >> Claus Ibsen >> - >> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >> FuseSource >> Email: cib...@fusesource.com >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.blogspot.com/ >> Author of Camel in Action: http://www.manning.com/ibsen/ >> > >
Re: How to handle attachments in JMS message
Hi The JMS data model is - body - headers / properties You can read how Camel maps to this from the Camel JMS wiki page http://camel.apache.org/jms And JMS have limitations what data type you can send, especially for its properties. So for attachments, you must transfer that in a way that is supported by JMS. Either in the body itself as a bytes message. Or somehow encode it and attach as a property. I can't recall if there is some limitations on the length of JMS properties. But I would assume. Check the JMS spec and/or JMS javadoc. http://docs.oracle.com/javaee/6/api/javax/jms/Message.html Some message brokers have special support for large payloads (out of bands), and allow to transfer the big data using other means such as over HTTP / FTP / SCP etc. So that could be an alternative for very large data. But I do not think its so very commonly used. On Mon, Mar 26, 2012 at 1:19 PM, Stefan Burkard wrote: > Hi all > > Camels DefaultMessage has an attachment map and CXFs message also > knows attachments. But a JMS message does not know about attachments. > > I have an mtom-enabled SOAP service that sends an object along with > file attachments (mtom to serialize attachments as binary data instead > of base64). I consume these messages with CXF to get a Camel Exchange > for further processing. But how would I handle the attachments to put > the messages on a plain JMS-queue? > > Is there any standard way or a recommendation how to handle file > attachments in JMS messages? > > I can of course marshal and unmarshal the messages with JAXB, but then > the attachments are serialized as base64. > > Thanks > Stefan -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
How to register a datasource, on configure() method or constructor of a RoutBuilder ?
Hello, I can not run camel-jdbc in java. I defines a route with camel-blueprint, via a road builder (not in XML) because I know the road to be built when bundle start. when starting the bundle, I read a database that contains definitions of endpoints. with there informations, I build the road. where in the database I have a record defining an endpoint jdbc datasource I create a datasource "myDataSourceName" and the uri "jdbc:myDataSourceName" in the documentation I've read, I had to do JndiRegistry reg = super.createRegistry(); reg.bind("testdb", db); return reg; but I'm in the configure method or in constructor of route builder I can not call super.createRegistry(); the register already exists I tried context.getRegistry (); who gets a JndiRegistry but getRegistry() return a simple Registry. The bind method does not exist on Registry. I tried (JndiRegistry) context.getRegistry(); but I get a CastException. public RouteBuilder() super(); inUrl = getParameter("input.url"); //... read configuration datas DataSourceName = "myDataSourceName"; DataSource DS = DataSourceFactory.create(DataSourceName, ); //using pooled datasource factory (c3p0) JndiRegistry reg = (JndiRegistry) getContext().getRegistry(); //CastException reg.bind("myDataSourceName", reg);// //Or Registry reg = getContext().getRegistry(); reg.bind("myDataSourceName", reg);//compil error bind is not method of Registry dsUri = "jdbc:" DataSourceName; } public void configure() { RouteDefinition r = from(inUrl); if ("sommeValue".equals(sommeParameter) {} r.bean(MyBean.class); //... r.to("dsUri) I have a similar problem in JUnit CamelTestSupport created a camelContext and a Registry then create the RouteBuilder (calls constructor) and calls the configure() method I've created an object datasource but inpossible to put it in the registry. can you help me ? A JYT PS: Sorry for my approximative english -- View this message in context: http://camel.465427.n5.nabble.com/How-to-register-a-datasource-on-configure-method-or-constructor-of-a-RoutBuilder-tp5595165p5595165.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Throttling: maximumRequestsPerPeriod problem
These namespaces are already declared. The browser you´re using probably hides the namespace declarations. If you right click my attached xml and choose "Show Source Code" (or something like, depending on your browser) the namespace will be shown. I´ll checkout your test and post the results. thanx again regards -- View this message in context: http://camel.465427.n5.nabble.com/Throttling-maximumRequestsPerPeriod-problem-tp5586898p5595328.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to handle attachments in JMS message
Doesn't the ws-spec cover this in some way? As JMS is one possible transport? 2012/3/26 Claus Ibsen : > Hi > > The JMS data model is > - body > - headers / properties > > You can read how Camel maps to this from the Camel JMS wiki page > http://camel.apache.org/jms > > And JMS have limitations what data type you can send, especially for > its properties. > > So for attachments, you must transfer that in a way that is supported by JMS. > Either in the body itself as a bytes message. > Or somehow encode it and attach as a property. I can't recall if there > is some limitations on the length of JMS properties. But I would > assume. > Check the JMS spec and/or JMS javadoc. > http://docs.oracle.com/javaee/6/api/javax/jms/Message.html > > > Some message brokers have special support for large payloads (out of > bands), and allow to transfer the big data using other means > such as over HTTP / FTP / SCP etc. So that could be an alternative for > very large data. But I do not think its so very commonly used. > > > On Mon, Mar 26, 2012 at 1:19 PM, Stefan Burkard wrote: >> Hi all >> >> Camels DefaultMessage has an attachment map and CXFs message also >> knows attachments. But a JMS message does not know about attachments. >> >> I have an mtom-enabled SOAP service that sends an object along with >> file attachments (mtom to serialize attachments as binary data instead >> of base64). I consume these messages with CXF to get a Camel Exchange >> for further processing. But how would I handle the attachments to put >> the messages on a plain JMS-queue? >> >> Is there any standard way or a recommendation how to handle file >> attachments in JMS messages? >> >> I can of course marshal and unmarshal the messages with JAXB, but then >> the attachments are serialized as base64. >> >> Thanks >> Stefan > > > > -- > Claus Ibsen > - > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ -- -- David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
Re: RESTful web service support from Camel
Hi, Forwarding to the users list. On 26/03/12 15:36, Zemin Hu wrote: Hi, I have couple of RESTful web service that I want to use Camel as integration point. I had a brief review for restlet which is supposed to be the solution, but from I have seen, it's not straight forward to use: 1. straight forward support/constrcut RESTful dynamic URL for both and: http://host:port/services/{uid}/table1/{item_id} 2. it supports request methods GET,POST,PUT, DELETE, I did not see how Camel handles these methods. Can Camel handle dynamic URL construction with variables? in ideal case, it should support: http://host:port/services/{uid}/table1/${header.type}?access_token=12345 /> One option is to use a cxfrs component: http://camel.apache.org/cxfrs.html The variation on it is to use the Camel transport and link directly to CXF JAXRS endpoint declarations (jaxrs:server), example http://camel.apache.org/schema/spring";> http://0.0.0.0:9002/bookstore?matchOnUriPrefix=true"/> HTH, Sergey Since many social network APIs are in this format, for instance: http://graph.facebook.com/{uid}/picture http://graph.facebook.com/{uid}/friends http://graph.facebook.com/{uid}/{about_everything} Can Camel at least support dynamic construction of URL of out box even without PUT and DELETE support? I don't know how big effort is needed to do this. If required, I am willing to contribute. Zemin -- View this message in context: http://camel.465427.n5.nabble.com/RESTful-web-service-support-from-Camel-tp5595408p5595408.html Sent from the Camel Development mailing list archive at Nabble.com. -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/ Blog: http://sberyozkin.blogspot.com
Re: How to handle attachments in JMS message
I guess you can use SOAP and MTOM with JMS (have not tried it though). The question is how big your attachment is and if it would be better to transport it outside JMS Christian Am 26.03.2012 16:11, schrieb David Karlsen: Doesn't the ws-spec cover this in some way? As JMS is one possible transport? 2012/3/26 Claus Ibsen: Hi The JMS data model is - body - headers / properties You can read how Camel maps to this from the Camel JMS wiki page http://camel.apache.org/jms And JMS have limitations what data type you can send, especially for its properties. So for attachments, you must transfer that in a way that is supported by JMS. Either in the body itself as a bytes message. Or somehow encode it and attach as a property. I can't recall if there is some limitations on the length of JMS properties. But I would assume. Check the JMS spec and/or JMS javadoc. http://docs.oracle.com/javaee/6/api/javax/jms/Message.html Some message brokers have special support for large payloads (out of bands), and allow to transfer the big data using other means such as over HTTP / FTP / SCP etc. So that could be an alternative for very large data. But I do not think its so very commonly used. On Mon, Mar 26, 2012 at 1:19 PM, Stefan Burkard wrote: Hi all Camels DefaultMessage has an attachment map and CXFs message also knows attachments. But a JMS message does not know about attachments. I have an mtom-enabled SOAP service that sends an object along with file attachments (mtom to serialize attachments as binary data instead of base64). I consume these messages with CXF to get a Camel Exchange for further processing. But how would I handle the attachments to put the messages on a plain JMS-queue? Is there any standard way or a recommendation how to handle file attachments in JMS messages? I can of course marshal and unmarshal the messages with JAXB, but then the attachments are serialized as base64. Thanks Stefan -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ -- Christian Schneider http://www.liquid-reality.de Open Source Architect Talend Application Integration Division http://www.talend.com
Re: Configuring endpoint programmatically
On Mon, Mar 26, 2012 at 2:23 PM, Borut Bolčina wrote: > It's the route that one is testing that matters. I added the noop option to: > > from("file:src/test/resources?noop=true") > This is a consumer which "pickup the files". And the noop option is only for the consumer. > and then in the test method it does not matter how one constructs the > endpoint. So it boils down to: > > @Test > public void testNumberOfWeatherStations() throws Exception { > MockEndpoint mock = getMockEndpoint("mock:meteo1"); > mock.expectedMessageCount(9); > mock.setAssertPeriod(1000); > > String fileName = "src/test/resources/observation_si_latest.xml"; > File meteo = new File(fileName); > FileEndpoint endpoint = new FileEndpoint(); > endpoint.setFile(meteo); > String content = context.getTypeConverter().convertTo(String.class, meteo); > //send data to route > template.sendBodyAndHeader(endpoint, content, Exchange.FILE_NAME, fileName); > mock.assertIsSatisfied(); > } The template is a ProducerTemplate which is for the *producer*, which creates new messages. So in this case it writes a new file. The noop option is NOT for the producer. > > Just curious, is there another way to send data to route > than template.sendBodyAndHeader? > > -borut > > Dne 26. marec 2012 14:04 je Borut Bolčina napisal/-a: > >> It felt like a solution, but still fails. The file is moved one level >> lower to src/test/resources/.camel folder just like before. >> >> @Test >> public void testNumberOfWeatherStations() throws Exception { >> MockEndpoint mock = getMockEndpoint("mock:meteo1"); >> mock.expectedMessageCount(9); >> mock.setAssertPeriod(1000); >> >> String fileName = "src/test/resources/observation_si_latest.xml"; >> FileEndpoint endpoint = new FileEndpoint("file:" + fileName, new >> FileComponent()); >> endpoint.setNoop(true); >> File meteo = new File(fileName); >> String content = context.getTypeConverter().convertTo(String.class, >> meteo); >> //send data to route >> template.sendBodyAndHeader(endpoint, content, Exchange.FILE_NAME, >> fileName); >> mock.assertIsSatisfied(); >> } >> >> Am I constructing the endpoint wrong? >> >> -borut >> >> Dne 26. marec 2012 13:37 je Claus Ibsen napisal/-a: >> >> Hi >>> >>> Just use the setters on the file endpoint >>> >>> FileEndpoint endpoint = ... >>> endpoint.setNoop(true); >>> >>> >>> On Mon, Mar 26, 2012 at 1:16 PM, Borut Bolčina >>> wrote: >>> > Hello again, >>> > >>> > The File component can be configured with some options, I am interested >>> in >>> > "noop=true". What can be done by: >>> > >>> > from("file:src/test/resources?fileName=myFile.xml&noop=true") >>> > >>> > is what I want to do it with code: >>> > >>> > String fileName = "src/test/resources/myFile.xml"; >>> > Endpoint endpoint = new FileEndpoint("file:" + fileName, new >>> > FileComponent()); >>> > Map options = new HashMap(); >>> > options.put("noop", "true"); >>> > endpoint.configureProperties(options); >>> > >>> > but it does not work - the file is still moved, which is something I do >>> not >>> > want. I tried with boolean value as well, but the same result. I found >>> > nothing in the mailing list, nor in the Camel book. >>> > >>> > I also tried: >>> > >>> > String fileName = "myFile.xml"; >>> > FileComponent fileComponent = new FileComponent(); >>> > fileComponent.setCamelContext(context); >>> > Endpoint endpoint = fileComponent.createEndpoint("file:" + fileName); >>> > Map options = new HashMap(); >>> > options.put("noop", "true"); >>> > endpoint.configureProperties(options); >>> > >>> > but no success either. >>> > >>> > -borut >>> >>> >>> >>> -- >>> Claus Ibsen >>> - >>> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >>> FuseSource >>> Email: cib...@fusesource.com >>> Web: http://fusesource.com >>> Twitter: davsclaus, fusenews >>> Blog: http://davsclaus.blogspot.com/ >>> Author of Camel in Action: http://www.manning.com/ibsen/ >>> >> >> -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Passing post parameter as body in the cxfrs call.
Hi Team, I got the solution for ti. its simple we have to exchange.getIn().setHeader(Exchange.HTTP_METHOD, "POST"); exchange.getIn().setHeader(Exchange.CONTENT_TYPE ,"application/x-www-form-urlencoded"); exchange.getOut().setBody("Xml="+ exchange.getIn().getBody()); --Regards, atg roxx On Mon, Mar 26, 2012 at 10:58 AM, atg roxx wrote: > HI Team, > > > Could anyone please reply to this. > > Many thanks in advance. > > > --cheers, > atg roxx > > > On Fri, Mar 23, 2012 at 5:05 PM, atg roxx wrote: > >> Hi Team, >> >> I have a unusually requirement. >> >> I have to send a request xml to a restful service as as body generated >> from POST parameter. >> >> I am using cxfrs for this, setting the method type to POST, setting >> some values to be passed in headers >> using CxfConstants.CAMEL_CXF_RS_USING_HTTP_API >> >> but I am not getting how to pass the POST parameters as body. >> >> Is there any way to do that? >> >> --Regards, >> atg roxx >> > >
Apache >> Camel >> Missing Headers
When i am routing a message from endpoint to a "bean", i can't access the headers i set. Is this the way it works ? -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Missing-Headers-tp5595800p5595800.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Passing post parameter as body in the cxfrs call.
Good to know you found a solution which works for you. I want to respond to your mail later, because I didn't understood what you was trying to do. Now, I understood... ;-) Best, Christian On Mon, Mar 26, 2012 at 6:39 PM, atg roxx wrote: > Hi Team, > > I got the solution for ti. > > its simple we have to > >exchange.getIn().setHeader(Exchange.HTTP_METHOD, "POST"); > > > exchange.getIn().setHeader(Exchange.CONTENT_TYPE > ,"application/x-www-form-urlencoded"); > exchange.getOut().setBody("Xml="+ exchange.getIn().getBody()); > > > --Regards, > atg roxx > > > > > On Mon, Mar 26, 2012 at 10:58 AM, atg roxx wrote: > > > HI Team, > > > > > > Could anyone please reply to this. > > > > Many thanks in advance. > > > > > > --cheers, > > atg roxx > > > > > > On Fri, Mar 23, 2012 at 5:05 PM, atg roxx wrote: > > > >> Hi Team, > >> > >> I have a unusually requirement. > >> > >> I have to send a request xml to a restful service as as body generated > >> from POST parameter. > >> > >> I am using cxfrs for this, setting the method type to POST, setting > >> some values to be passed in headers > >> using CxfConstants.CAMEL_CXF_RS_USING_HTTP_API > >> > >> but I am not getting how to pass the POST parameters as body. > >> > >> Is there any way to do that? > >> > >> --Regards, > >> atg roxx > >> > > > > >
Re: Apache >> Camel >> Missing Headers
Yes you can. you can annotate the arguments with @Header to wire them in - or use the expression language/beanbinding 2012/3/26 sambardar : > When i am routing a message from endpoint to a "bean", i can't access the > headers i set. Is this the way it works ? > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Apache-Camel-Missing-Headers-tp5595800p5595800.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- -- David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
Re: How to register a datasource, on configure() method or constructor of a RoutBuilder ?
If you are talking about unit testing, simply override the "createRegistry()" method as in [1]. If you are talking about the real application, simply define the datasource in your spring xml and use the endpoint uri "jdbc:". Look at [2] and [3] for an example. [1] https://svn.apache.org/repos/asf/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/AbstractJdbcTestSupport.java [2] https://svn.apache.org/repos/asf/camel/trunk/components/camel-jdbc/src/test/java/org/apache/camel/component/jdbc/JdbcSpringAnotherRouteTest.java [3] https://svn.apache.org/repos/asf/camel/trunk/components/camel-jdbc/src/test/resources/org/apache/camel/component/jdbc/camelContext.xml Best, Christian On Mon, Mar 26, 2012 at 3:06 PM, sekaijin wrote: > Hello, > I can not run camel-jdbc in java. > > I defines a route with camel-blueprint, via a road builder (not in XML) > because I know the road to be built when bundle start. > > when starting the bundle, I read a database that contains definitions of > endpoints. with there informations, I build the road. where in the database > I have a record defining an endpoint jdbc datasource I create a datasource > "myDataSourceName" and the uri "jdbc:myDataSourceName" > > in the documentation I've read, I had to do > JndiRegistry reg = super.createRegistry(); > reg.bind("testdb", db); > return reg; > > but I'm in the configure method or in constructor of route builder > I can not call super.createRegistry(); the register already exists > I tried context.getRegistry (); who gets a JndiRegistry but getRegistry() > return a simple Registry. > The bind method does not exist on Registry. > I tried (JndiRegistry) context.getRegistry(); > but I get a CastException. > > public RouteBuilder() > super(); > inUrl = getParameter("input.url"); > //... read configuration datas > DataSourceName = "myDataSourceName"; > > DataSource DS = DataSourceFactory.create(DataSourceName, ); //using > pooled datasource factory (c3p0) > > JndiRegistry reg = (JndiRegistry) getContext().getRegistry(); > //CastException > reg.bind("myDataSourceName", reg);// > //Or > Registry reg = getContext().getRegistry(); > reg.bind("myDataSourceName", reg);//compil error bind is not method of > Registry > > dsUri = "jdbc:" DataSourceName; > } > > public void configure() { > RouteDefinition r = from(inUrl); > if ("sommeValue".equals(sommeParameter) {} >r.bean(MyBean.class); > //... > r.to("dsUri) > > > > I have a similar problem in JUnit > CamelTestSupport created a camelContext and a Registry > then create the RouteBuilder (calls constructor) > and calls the configure() method > > I've created an object datasource but inpossible to put it in the registry. > > can you help me ? > A JYT > PS: Sorry for my approximative english > > -- > View this message in context: > http://camel.465427.n5.nabble.com/How-to-register-a-datasource-on-configure-method-or-constructor-of-a-RoutBuilder-tp5595165p5595165.html > Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Throttling: maximumRequestsPerPeriod problem
Yes, I missed this... Could you also remove the following definitions because you don't use it: Best, Christian On Mon, Mar 26, 2012 at 4:10 PM, garrydias wrote: > These namespaces are already declared. The browser you´re using probably > hides the namespace declarations. If you right click my attached xml and > choose "Show Source Code" (or something like, depending on your browser) > the > namespace will be shown. > > I´ll checkout your test and post the results. > > thanx again > > regards > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Throttling-maximumRequestsPerPeriod-problem-tp5586898p5595328.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Apache >> Camel >> Missing Headers
The issue i found was that in one of the beans i modify the body of the message. After that the header is lost. But if i set back the header in the same bean where i modify the body, then header is propogated. I did e.getOut.setHeaders(e.getIn().getHeaders()) it works after i do this -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Missing-Headers-tp5595800p5595918.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Apache >> Camel >> Missing Headers
On Mon, Mar 26, 2012 at 7:25 PM, sambardar wrote: > The issue i found was that in one of the beans i modify the body of the > message. After that the header is lost. But if i set back the header in the > same bean where i modify the body, then header is propogated. I did > > e.getOut.setHeaders(e.getIn().getHeaders()) > > it works after i do this > See this FAQ http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html > -- > View this message in context: > http://camel.465427.n5.nabble.com/Apache-Camel-Missing-Headers-tp5595800p5595918.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Apache >> Camel >> Missing Headers
Thanks. I went through it and was very helpful in understanding what was happening. -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Missing-Headers-tp5595800p5595971.html Sent from the Camel - Users mailing list archive at Nabble.com.
Apache >> Camel >> Aggregation EIP
How can we configure multiple headers in the correlationExpression for aggregate EIP? Currently I have dictionary Can i specify multiple headers as the co-relation key ? -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Aggregation-EIP-tp5596001p5596001.html Sent from the Camel - Users mailing list archive at Nabble.com.
CXFRS and Processing
Gents- Thanks much for the help so far. I am trying to do some processing on my CXFRS route before it goes back to the browser, but the body becomes null after I process. I modified an example to demonstrate my issue. In https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/jaxrs/CxfRsSpringProducer.xml , if I add a route to process the such as: (EmptyProcessor is just an empty processor). The response from the testGetCostumerWithHttpCentralClientAPI() method of https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducerTest.java comes back null (not to mention many other tests throw exceptions). Can I not process cxfrs endpoints in this way? What am I doing wrong? -Shan -- View this message in context: http://camel.465427.n5.nabble.com/CXFRS-and-Processing-tp5596053p5596053.html Sent from the Camel - Users mailing list archive at Nabble.com.
"Camel on Google App Engine Tutorial" still working?
Hello. I wonder if this example is still working ( http://camel.apache.org/tutorial-for-camel-on-google-app-engine.html)? I built my own GAE app with the source code and deployed it successfully to GAE. Though, when I click on the submit button of the form, I get this error message: "Error: NOT_FOUND". If I try out the deployed example (http://camelcloud.appspot.com/), I do not get an error, but I also do NOT receive any email with weather information. I tried with different email addresses and checked the spam folders, too. Probabaly, some GAE stuff changed gradually, thus it is not working anymore with Camel 2.9 / 2.10-SNAPSHOT? Best regards, Kai
Re: Apache >> Camel >> Aggregation EIP
That's not possible at present. Could you please explain a bit detailed what your use case is? Maybe two aggregators or a composite header will fit your needs? Best, Christian On Mon, Mar 26, 2012 at 8:01 PM, sambardar wrote: > > How can we configure multiple headers in the correlationExpression for > aggregate EIP? Currently I have > > > dictionary > > > Can i specify multiple headers as the co-relation key ? > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Apache-Camel-Aggregation-EIP-tp5596001p5596001.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Throttling: maximumRequestsPerPeriod problem
i´ll change the route instead, so I can use the *ref* property. that´s my xml updated: http://camel.465427.n5.nabble.com/file/n5596345/throttler-test-context.xml throttler-test-context.xml (I´m still setting up the tests) regards -- View this message in context: http://camel.465427.n5.nabble.com/Throttling-maximumRequestsPerPeriod-problem-tp5586898p5596345.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Apache >> Camel >> Aggregation EIP
Yes, maybe a composite header and i need to know how can i specify a composite header in Spring DSL. My Need is simply that the aggregation should happen on 2 or more keys rather than one. For example, the aggregation should take place on 2 keys - CustomerId and BillingId. -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Aggregation-EIP-tp5596001p5596353.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Apache >> Camel >> Aggregation EIP
What's about this? ${in.headers.CustomerId}-${in.headers.BillingId} Best, Christian On Mon, Mar 26, 2012 at 10:51 PM, sambardar wrote: > Yes, maybe a composite header and i need to know how can i specify a > composite header in Spring DSL. > > My Need is simply that the aggregation should happen on 2 or more keys > rather than one. For example, the aggregation should take place on 2 keys > - > CustomerId and BillingId. > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Apache-Camel-Aggregation-EIP-tp5596001p5596353.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
Re: Apache >> Camel >> Aggregation EIP
Thanks Christian. Can you please point me to some documentation where i can find the syntax for things like these about what all can be put in Spring DSL and how. -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Aggregation-EIP-tp5596001p5596487.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Apache >> Camel >> Aggregation EIP
http://camel.apache.org/simple.html Best, Christian On Tue, Mar 27, 2012 at 12:03 AM, sambardar wrote: > Thanks Christian. > > Can you please point me to some documentation where i can find the syntax > for things like these about what all can be put in Spring DSL and how. > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Apache-Camel-Aggregation-EIP-tp5596001p5596487.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
JAR for IBM MQ
Hi, I am getting BUILD error because following JARS could not be found. com.ibm.mq:com.ibm.mq.jmqi:jar:7.0.1.3 com.ibm:com.ibm.mqjms:jar:7.0.1.3 com.ibm:com.ibm.mqjms:jar:7.0.1.3 To use IBM MQ, I have added following in my POM: com.ibm.mq com.ibm.mq.jmqi 7.0.1.3 compile com.ibm com.ibm.mqjms 7.0.1.3 compile com.ibm.mq.dhbcore dhbcore 7.0.1.3 compile How can I download the JAR manually. What is the site address where these JARs are available or is there a way to fix the issue? Thank you -- View this message in context: http://camel.465427.n5.nabble.com/JAR-for-IBM-MQ-tp5596719p5596719.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Apache >> Camel >> Missing Headers
Unfortunately, the link to the Gliffy diagram (Flow of an exchange through a route) is broken. Maybe someone can fix it? -- View this message in context: http://camel.465427.n5.nabble.com/Apache-Camel-Missing-Headers-tp5595800p5596987.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JAR for IBM MQ
Hi IBM MQ is a commercial product, so you have to purchase it from IBM. And IBM can deliver those JARs as part of Java JMS clients. IBM do not publish those JARs to a Maven repository. And I doubt it would be legal to do so by others. Hence you cannot find those JARs in the internet. If you have a IBM WebSphere AS installation on your computer. Then those JARs is often provided as part of the AS installation. You can then search for these JARs in that installation. I have done that in the past. Then you can install the JARs from the file system to your local m2 repo using a maven command. Check the maven documentation how to do that. And from that your Maven project should be able to pickup and use the JARs and compile the project. On Tue, Mar 27, 2012 at 3:17 AM, newbiee wrote: > Hi, > > I am getting BUILD error because following JARS could not be found. > > com.ibm.mq:com.ibm.mq.jmqi:jar:7.0.1.3 > com.ibm:com.ibm.mqjms:jar:7.0.1.3 > com.ibm:com.ibm.mqjms:jar:7.0.1.3 > > To use IBM MQ, I have added following in my POM: > > > com.ibm.mq > com.ibm.mq.jmqi > 7.0.1.3 > compile > > > > com.ibm > com.ibm.mqjms > 7.0.1.3 > compile > > > > com.ibm.mq.dhbcore > dhbcore > 7.0.1.3 > compile > > > How can I download the JAR manually. What is the site address where these > JARs are available or is there a way to fix the issue? > > Thank you > > -- > View this message in context: > http://camel.465427.n5.nabble.com/JAR-for-IBM-MQ-tp5596719p5596719.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: JAR for IBM MQ
Hi, If you have WMQ 7 installed on your computer the following environment variable will be set: MQ_JAVA_INSTALL_PATH If you only want to use WMQ as a client, the clients are freely available to download from IBM, think you need to register though. Search for Websphere MQ supportpac. However you still need to do as Claus wrote, install the jars you need to your local Maven repo. It is not legal to publish the (How to do it can be found in the Maven FAQ: http://maven.apache.org/general.html#importing-jars) Den 27 mars 2012 08:19 skrev Claus Ibsen : > Hi > > IBM MQ is a commercial product, so you have to purchase it from IBM. > And IBM can deliver those JARs as part of Java JMS clients. > IBM do not publish those JARs to a Maven repository. And I doubt it > would be legal to do so by others. Hence you cannot find those JARs in > the internet. > > If you have a IBM WebSphere AS installation on your computer. Then > those JARs is often provided as part of the AS installation. > You can then search for these JARs in that installation. I have done > that in the past. > > Then you can install the JARs from the file system to your local m2 > repo using a maven command. > Check the maven documentation how to do that. > > > And from that your Maven project should be able to pickup and use the > JARs and compile the project. > > > On Tue, Mar 27, 2012 at 3:17 AM, newbiee wrote: > > Hi, > > > > I am getting BUILD error because following JARS could not be found. > > > > com.ibm.mq:com.ibm.mq.jmqi:jar:7.0.1.3 > > com.ibm:com.ibm.mqjms:jar:7.0.1.3 > > com.ibm:com.ibm.mqjms:jar:7.0.1.3 > > > > To use IBM MQ, I have added following in my POM: > > > > > > com.ibm.mq > > com.ibm.mq.jmqi > > 7.0.1.3 > > compile > > > > > > > > com.ibm > > com.ibm.mqjms > > 7.0.1.3 > > compile > > > > > > > > com.ibm.mq.dhbcore > > dhbcore > > 7.0.1.3 > > compile > > > > > > How can I download the JAR manually. What is the site address where these > > JARs are available or is there a way to fix the issue? > > > > Thank you > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/JAR-for-IBM-MQ-tp5596719p5596719.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Claus Ibsen > - > CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com > FuseSource > Email: cib...@fusesource.com > Web: http://fusesource.com > Twitter: davsclaus, fusenews > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/ >