Re: java.lang.NoSuchMethodError: org.apache.camel.model.RouteDefinition.transacted()
I recompiled it with 2.12.1. I compiled this route for the first time, in 2.12.1 ( following an example that I found in Apache Camel site ) and this ends with error ( NoSuchMethodException ); then I tried to compile the same code with Camel 2.11.0 and it worked ( no Exception ). I don't know I have to change to make it work in Camel 2.12.1 Thanks. 2013/11/11 Willem jiang willem.ji...@gmail.com Hi, I think you may need to recompile the route instead of just change the class path when you move to use Camel 2.12.1. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Monday, November 11, 2013 at 5:39 AM, Agostino Calamita wrote: Hi, I'm trying to use transacted route with Camel 2.12.1. This is just a little example to test transacted() method: public static void main(String args[]) throws Exception { // create CamelContext CamelContext context = new DefaultCamelContext(); // add our route to the CamelContext context.addRoutes(new RouteBuilder() { public void configure() { from(activemq:topic:example_queue) .transacted() .to(log:mediationrouter?level=DEBUG); } }); This route is only an example. If I use this code with Camel 2.12.1, it throws a strange Exception: Exception in thread main java.lang.NoSuchMethodError: org.apache.camel.model.RouteDefinition.transacted()Lorg/apache/camel/model/PolicyDefinition; but, if I user Camel 2.11.0 it works ! I read in 2.12.1 Release Notes that something changed in transaction setting, but I didn't find any example or document. Can somebody help me ? Thanks.
Re: Test exception thrown in junit test
Thnx for the advise, My purpose was to test my general exception handling in routes. -- View this message in context: http://camel.465427.n5.nabble.com/Test-exception-thrown-in-junit-test-tp5742984p5743006.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: how to get the target url of a router
I can get the routedefinition instance by ListRoute routes = this.camelContext.getRoutes(); for (Route route : routes) { RouteDefinition routeDefinition = route.getRouteContext() .getRoute(); routerInfos.add(routerInfo); } But I don't find a intuitionistic method to get the destination url, Besides, the application startup the camel context, so whether I can vistit the mbean directly, without jmx. Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/how-to-get-the-target-url-of-a-router-tp5743001p5743008.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SJMS failure with stale reply queue
As a proof of concept, I created a new component camel-sjmsee as a simplified version of camel-sjms: https://github.com/hwellmann/camel/tree/sjmsee/components/camel-sjmsee Given that a Java EE container provides connection pools anyway, this component does not pool any connections, producers or InOut reply consumers but creates them on the fly (closing a managed connection simply returns it to the container-managed pool). There is still a pool for ordinary consumers. Each consumer registers an exception listener on its connection which removes the consumer from the pool when an exception occurs. There is a reconnect task submitted to the consumer's executor which tries to refill the pool every 10 seconds. I've tested this manually on JBoss AS 7.2.0 in the context of my application. I can now stop and restart the external ActiveMQ broker, and communication is restored automatically. If this approach makes sense, I'm happy to improve it and make an official contribution. My main question is whether or not this should be a separate component or be integrated into camel-sjms somehow. Feedback welcome. Best regards, Harald 2013/11/9 Harald Wellmann hwellmann...@gmail.com Ok, I'll watch that issue. Broadening the scope of the discussion a bit, is SJMS designed for Java SE, Java EE or both? In a Java EE 6/7 server, you get managed connections from a JCA resource adapter, pooling and reconnection is provided by the container, so there's no need to add reconnection to SJMS, and the pooling implemented in SJMS may be either redundant or even in conflict with connection pooling in the container. Would it make sense to implement Java EE-optimized behaviour in camel-sjms, activated by a bunch of new options? Or would this be a case for a new camel-jmsee component? Regads, Harald Am 09.11.2013 17:33, schrieb Raul Kripalani: Yes, exactly. JIRA: https://issues.apache.org/jira/browse/CAMEL-6950.
onCompletion() in apache camel called more than one time
I am new to the camel. I am using bindy to transform my csv file to object. Now i want to do some post processing once all the route completed. so i used camel .onCompletion() tag for the same. But in case of that if i have multiple lines in my csv file then i want to call onCompletion() after both lines of record processed. So for that changes i made are like : onCompletion().onWhen(property(CamelSplitComplete).isEqualTo(true)) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { LOG.info(Inside Split Complete processor); } }).to(log:global); and then i attached processor for post processing stuff. But in my case the above code executes more than one time and the Logger Inside Split Complete processor prints more than one time. So can you please advice me what to do so that my code executes on single time so that i can do some post processing stuff only once. Also i had tried options with .onCompletin().onCompleteOnly() in which it also got called more than one time and .onCompletin().onCompleteOnly() in which it didn't get called. Just for information, in my route builder i have many .from() and .to() endpoints and only single global onCompletion(). So can you please advice me what went wrong in my code / how to tackle this issue ? Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/onCompletion-in-apache-camel-called-more-than-one-time-tp5743011.html Sent from the Camel - Users mailing list archive at Nabble.com.
Model object into FIX message conversion using Bindy
Hi, I am trying to convert a model object into a FIX message using Bindy dataformat. This is my code: Purchase_order Model class: package CamelBindy.Test; import java.math.BigDecimal; import org.apache.camel.dataformat.bindy.annotation.DataField; import org.apache.camel.dataformat.bindy.annotation.Message; @Message(keyValuePairSeparator = =, pairSeparator = \\u0001, type = FIX, version = 4.1, isOrdered = true) public class Purchase_order { @DataField(pos = 1) private String name; @DataField(pos = 2, precision = 2) private BigDecimal price; @DataField(pos = 3) private int amount; getters() setters() } Camel class: package CamelBindy.Test; import java.math.BigDecimal; import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.model.dataformat.BindyType; public class BindyTest { public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); Purchase_order order = new Purchase_order(); order.setAmount(1); order.setPrice(new BigDecimal(39.95)); order.setName(Camel in Action); context.addRoutes(new RouteBuilder() { @Override public void configure() { from(direct:toCsv).marshal().bindy(BindyType.KeyValue,CamelBindy.Test) .to(file://test4?fileName=mano.txt); } }); ProducerTemplate template = context.createProducerTemplate(); context.start(); template.sendBody(direct:toCsv,order); Thread.sleep(1000); context.stop(); } } Here i am trying to convert the Purchase_order model class into FIX message dataformat. When trying for CSV dataformat its working fine. But for FIX message type its showing the following error. java.lang.ClassCastException: *CamelBindy.Test.Purchase_order cannot be cast to java.util.ArrayList* at org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat.marshal(BindyKeyValuePairDataFormat.java:63) ~[camel-bindy-2.12.1.jar:2.12.1] at org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:59) ~[camel-core-2.11.1.jar:2.11.1] at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ~[camel-core-2.11.1.jar:2.11.1] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.interceptor.BacklogTracerInterceptor.process(BacklogTracerInterceptor.java:84) ~[camel-core-2.11.1.jar:2.11.1] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) ~[camel-core-2.11.1.jar:2.11.1] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:391) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:273) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46) [camel-core-2.11.1.jar:2.11.1] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.11.1.jar:2.11.1] at
XML to JSON using XMLJSON - BufferDataException
Hi, I am trying to convert XML into JSON format using XMLJson in TCP client server program. I am having three files - TCPClient, TCPServer and CamelDemo class. In between client and server, i am using CamelDemo class for conversion. It shows BufferDataFormat Exception in CamelDemo class. This is my code *TCPClient Code:* public class TCPClient { public static void main(String[] args) throws IOException { Socket clientsoc = null; PrintWriter out = null; String inputMsg = null; try { clientsoc = new Socket(localhost, 6789); inputMsg=RootfirstNamexxx/firstNamelastNameyyy/lastName/Root; out = new PrintWriter(clientsoc.getOutputStream(), true); out.println(inputMsg); InputStream is = clientsoc.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String receivedMsg = br.readLine(); System.out.println(Message received from server is + receivedMsg); } catch (Exception e) { e.printStackTrace(); } finally { out.close(); clientsoc.close(); out = null; inputMsg = null; } } } *TCPServer Code:* public class TCPServer { public static void main(String[] args) { Socket socket =null; try { int port = 6123; ServerSocket serverSocket = new ServerSocket(port); System.out.println(Server Started and listening to the port 6123); while(true) { socket = serverSocket.accept(); InputStream is = socket.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String receivedMsg = br.readLine(); System.out.println(Message received from client is +receivedMsg); String returnMessage=receivedMsg; PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.println(returnMessage); System.out.println(Message sent to the client is +returnMessage); out.flush(); } } catch (Exception e) { e.printStackTrace(); } finally { try { socket.close(); } catch(Exception e){} } } } *CamelDemo Code:* public class CamelDemo { static CamelContext context = null; public static void main(String[] s) { try { context = new DefaultCamelContext(); final XmlJsonDataFormat xmlJsonFormat=new XmlJsonDataFormat(); xmlJsonFormat.setEncoding(UTF-8); xmlJsonFormat.setForceTopLevelObject(true); xmlJsonFormat.setTrimSpaces(true); xmlJsonFormat.setRootName(Root); xmlJsonFormat.setSkipNamespaces(true); xmlJsonFormat.setRemoveNamespacePrefixes(true); xmlJsonFormat.setExpandableProperties(Arrays.asList(d, e)); Component component = new org.apache.camel.component.mina.MinaComponent(); context.addComponent(tcp, component); context.addRoutes(new RouteBuilder() { public void configure() { from(mina:tcp://localhost:6789?textline=falsesync=true) .marshal(xmlJsonFormat) .process(new Processor() { // consumer public void process(Exchange e) { try { // Request message from client String inMsg = (String) e.getIn().getBody(); System.out.println(**+inMsg+**); // Configuring Destination Endpoint endpoint = context.getEndpoint(mina:tcp://127.0.0.1:6123?textline=falsesync=true); Exchange exchange = endpoint.createExchange(ExchangePattern.InOut); Message in = exchange.getIn();
Re: When - an Apache Camel Component for time slots management
Hi Nice work keep it going. A cron like predicate would be nice. And for compound predicates you can do that in Camel in Java DSL using the predicate builder. http://www.davsclaus.com/2009/02/apache-camel-and-using-compound.html Though when working with date/times. You need to consider the time zone as well. On Sun, Nov 10, 2013 at 5:16 PM, Lorenzo Bolzani l.bolz...@gmail.com wrote: Hi Christoph, thanks for your feedback. If I understand correctly you are suggesting to implement this on top of standard message filtering[1] and I think it's a good idea. So I could write a custom Predicate[2] and build a route like this: from(direct:start). filter().MY_PREDICATE(MON-FRI). to(mock:result); I do not think I can handle patterns like this: MON,WED,FRI 12-22; !WED 16-20; SAT 8-12 without a custom Predicate. For simple patterns a regexp could work, for complex one a custom bean or a groovy fragment could be fine but far less immediate. I think I'm going to add this option. Bye Lorenzo [1] http://camel.apache.org/message-filter.html [2] http://camel.apache.org/predicate.html 2013/11/10 Christoph Emmersberger cemme...@gmail.com: Hi Lorenzo, very interesting approach that you’ve been posing out there. I just wonder, if there is really a component necessary to integrate the date / time function, or if it might be better to implement an approach via the simple DSL. To me it seems that you are filtering exchange messages and the simple DSL would allow you access to the so called ‘date:command:pattern’. Therefore I’m not quite sure, if the implementation of a component is some overhead compared to the DSL approach, i.e. since the access of current time as well as exchange header information is already available (see also: http://camel.apache.org/simple.html) Kind regards, Christoph On 10 Nov 2013, at 15:14, Lorenzo Bolzani l.bolz...@gmail.com wrote: Hi, I just created this very simple component to allow/suspend a service at certain times. https://bitbucket.org/nottrz/when Any feedback is welcome. Bye Lorenzo -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Key (field name) required instead of Tag number
Hi, I am trying to convert a model object into FIX message using Bindy. I am passing the List object of the model class(purchase_order) and getting the following *output : 1=Camel in Action|3=19|4=40| * Here it is like* tag=value*, I need it as *Key(field name)=value*. What should I do for that here is my *purchase_order class*: package CamelBindy.Test; import java.math.BigDecimal; import org.apache.camel.dataformat.bindy.annotation.KeyValuePairField; import org.apache.camel.dataformat.bindy.annotation.Link; import org.apache.camel.dataformat.bindy.annotation.Message; import org.apache.camel.dataformat.bindy.annotation.Section; //@CsvRecord(separator = ,, crlf = UNIX) @Section(number = 2) @Message(keyValuePairSeparator = =, pairSeparator = ||, type = FIX, version = 4.1) public class Purchase_order { @Link Header header; @Link Trailer trailer; @KeyValuePairField(tag=1) private String name; @KeyValuePairField(tag = 4) private BigDecimal price; @KeyValuePairField(tag = 3) private int amount; getters() setters() } *Camelclass:*package CamelBindy.Test; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.model.dataformat.BindyType; public class BindyTest { public static void main(String[] args) throws Exception { CamelContext context = new DefaultCamelContext(); final ListMaplt;String, Object obj = new ArrayListMaplt;String, Object(); MapString, Object model = new HashMapString, Object(); Purchase_order order = new Purchase_order(); order.setAmount(19); order.setPrice(new BigDecimal(39.95)); order.setName(Camel in Action); model.put(order.getClass().getName(), order); obj.add(0, model); context.addRoutes(new RouteBuilder() { @Override public void configure() { from(direct:toCsv).marshal().bindy(BindyType.KeyValue,CamelBindy.Test) .to(file://test4?fileName=mano.txt); } }); ProducerTemplate template = context.createProducerTemplate(); context.start(); template.sendBody(direct:toCsv,obj); Thread.sleep(1000); context.stop(); } } -- View this message in context: http://camel.465427.n5.nabble.com/Key-field-name-required-instead-of-Tag-number-tp5743021.html Sent from the Camel - Users mailing list archive at Nabble.com.
How to retrieve only the last message from 10 messages passed to queue
I am trying to get only only the last message from 10 messages passed to queue. I read messages in XML format and extracted the dat and passed to activemq. My message in activemq in the form Sending message Broadcast Message 37 pReceived on : Mon Nov 11 15:41:2 5 IST 2013EURUSR1.358EUR/USR97.1296.70597.296.5650.4150.428.50.21EUR/USR1.60551. 60971.61011.6043-0.0041-0.268.50.21EUR/USR0.90540.90280.90670.90260.00250.288.50 .21EUR/USR0.94430.94280.94520.9410.00150.168.50.22EUR/USR1.03311.03131.03361.030 70.00180.178.50.21EUR/USR0.83020.83040.83160.827-0.0003-0.038.50.21EUR/USR6.1219 6.12056.12216.11790.00140.028:48 Help me to resolve Thanks Raji -- View this message in context: http://camel.465427.n5.nabble.com/How-to-retrieve-only-the-last-message-from-10-messages-passed-to-queue-tp5743024.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: When - an Apache Camel Component for time slots management
2013/11/11 Claus Ibsen claus.ib...@gmail.com: Hi Nice work keep it going. A cron like predicate would be nice. Hi Claus, thanks, I'll consider this. I was able to get this working from(direct:start).filter(when, MON-FRI 9:30-18:30).to(...) but I'm struggling with the matches method. This works: .filter(header(anyHeader).matches( new LanguageExpression(when, timeExpression) )) but I'd like to do something like: .filter(header(anyHeader).matches( language(when, MON-FRI) )) or even better .filter(header(anyHeader).matches(when, MON-FRI)) or maybe (quite dangerous, but more flexible): .filter(header(anyHeader).matches({when} MON-FRI)) Is this already possible? Should I file a RFE? Thanks, bye Lorenzo
AW: When - an Apache Camel Component for time slots management
I was able to get this working from(direct:start).filter(when, MON-FRI 9:30-18:30).to(...) Does that matches the current system time? but I'm struggling with the matches method. This works: .filter( header(anyHeader) .matches( new LanguageExpression(when, timeExpression) )) but I'd like to do something like: .filter( header(anyHeader) .matches( language(when, MON-FRI) )) A static import? public class LanguageExpression { public static LanguageExpression language(String s, String pattern) { return new LanguageExpression(s, pattern); } } import static LanguageExpression.language; public class MyBuilder { ... from(...).filter(language(when, MON-FRI)).to(...); } or even better .filter(header(anyHeader).matches(when, MON-FRI)) Not sure which method to modify ... or maybe (quite dangerous, but more flexible): .filter(header(anyHeader).matches({when} MON-FRI)) I found org.apache.camel.builder.BuilderSupport.header(String) : ValueBuilder. And in org.apache.camel.builder.ValueBuilder.matches(Expression) : Predicate. Maybe a Converter StringExpression? Jan
Re: How to retrieve only the last message from 10 messages passed to queue
Hi, take a look to advisory messages for activemq. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-retrieve-only-the-last-message-from-10-messages-passed-to-queue-tp5743024p5743037.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: When - an Apache Camel Component for time slots management
2013/11/11 Jan Matèrne (jhm) apa...@materne.de: I was able to get this working from(direct:start).filter(when, MON-FRI 9:30-18:30).to(...) Does that matches the current system time? Yes. You can also define an header called when.date to do the matching on this one instead. I do not like this trick, that's why I'm working on matches. A static import? Yes, it would work, but I feel like something is actually missing from BuilderSupport. Why can I do this .filter(header(anyHeader).matches(xpath(...)) or this .setHeader(any).language(groovy, 123) but not this? .filter(header(anyHeader).matches(language(when, MON-FRI))) It feels like it's extremely easy to plug-in a new DSL language but not always so immediate to use this new language in routes definition. or even better .filter(header(anyHeader).matches(when, MON-FRI)) Not sure which method to modify ... I would add this to ValueBuilder: public Predicate matches(String language, String expression) { return matches(new LanguageExpression(language, expression)); } just like the filter method. or maybe (quite dangerous, but more flexible): .filter(header(anyHeader).matches({when} MON-FRI)) I found org.apache.camel.builder.BuilderSupport.header(String) : ValueBuilder. And in org.apache.camel.builder.ValueBuilder.matches(Expression) : Predicate. Maybe a Converter StringExpression? Again this would work. But it's an extra setup to ask to the many users of my component ;) The filter method was overloaded to support custom languages. A lot of custom methods have been added for the main languages: groovy, xpath, etc. Maybe camel needs a simpler standard way to plug-in new expressions from other languages, from here the {prefix} idea. Just my 1 cent after a couple of experiments. Bye Lorenzo
HttpOperationFailedException not throwed on response code 302
Hello, I`m using camel ver. 2.11.0 and HTTP component to call SSL (port 443) REST web services like this: camel:to uri=http://{{address}}:{{port}}/{{context}}?httpClientConfigurerRef=httpClientConfig/ For SSL I used my implementation (httpClientConfig) of org.apache.camel.component.http.HttpClientConfigurer interface. After 8 months of production REST server failed and return response code 302 with redirect. After that I see deadlock of http component: o.a.c.h.HttpMethodDirector(439) - INFO - I/O exception (org.apache.commons.httpclient.NoHttpResponseException) caught when processing request: The server rest.myendpoint.com failed to respond o.a.c.h.HttpMethodDirector(445) - INFO - Retrying request And no more logs from this route.. In context I use 3 routes started using timer component. 2 of my routes (use http for REST calls) stoped for 11 days and only route for processing FILE still works. Why http component did not throw HttpOperationFailedException? How can I prevent from this deadlock? Thank you for your help -- View this message in context: http://camel.465427.n5.nabble.com/HttpOperationFailedException-not-throwed-on-response-code-302-tp5743039.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HttpOperationFailedException not throwed on response code 302
Maybe it follow redirects, you can see if you can turn that off. On Mon, Nov 11, 2013 at 3:30 PM, martin11 mato.kraj...@gmail.com wrote: Hello, I`m using camel ver. 2.11.0 and HTTP component to call SSL (port 443) REST web services like this: camel:to uri=http://{{address}}:{{port}}/{{context}}?httpClientConfigurerRef=httpClientConfig/ For SSL I used my implementation (httpClientConfig) of org.apache.camel.component.http.HttpClientConfigurer interface. After 8 months of production REST server failed and return response code 302 with redirect. After that I see deadlock of http component: o.a.c.h.HttpMethodDirector(439) - INFO - I/O exception (org.apache.commons.httpclient.NoHttpResponseException) caught when processing request: The server rest.myendpoint.com failed to respond o.a.c.h.HttpMethodDirector(445) - INFO - Retrying request And no more logs from this route.. In context I use 3 routes started using timer component. 2 of my routes (use http for REST calls) stoped for 11 days and only route for processing FILE still works. Why http component did not throw HttpOperationFailedException? How can I prevent from this deadlock? Thank you for your help -- View this message in context: http://camel.465427.n5.nabble.com/HttpOperationFailedException-not-throwed-on-response-code-302-tp5743039.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: onCompletion() in apache camel called more than one time
Please post your route. On Mon, Nov 11, 2013 at 1:26 AM, vishalfichadiya fichadiyavis...@gmail.com wrote: I am new to the camel. I am using bindy to transform my csv file to object. Now i want to do some post processing once all the route completed. so i used camel .onCompletion() tag for the same. But in case of that if i have multiple lines in my csv file then i want to call onCompletion() after both lines of record processed. So for that changes i made are like : onCompletion().onWhen(property(CamelSplitComplete).isEqualTo(true)) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { LOG.info(Inside Split Complete processor); } }).to(log:global); and then i attached processor for post processing stuff. But in my case the above code executes more than one time and the Logger Inside Split Complete processor prints more than one time. So can you please advice me what to do so that my code executes on single time so that i can do some post processing stuff only once. Also i had tried options with .onCompletin().onCompleteOnly() in which it also got called more than one time and .onCompletin().onCompleteOnly() in which it didn't get called. Just for information, in my route builder i have many .from() and .to() endpoints and only single global onCompletion(). So can you please advice me what went wrong in my code / how to tackle this issue ? Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/onCompletion-in-apache-camel-called-more-than-one-time-tp5743011.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Christian Posta http://www.christianposta.com/blog twitter: @christianposta
Camel-JPA for single select statements
I would like to use the Camel JPA component to perform single select statements, in other words, I would like to use the component as a consumer without the default polling behavior. I want to receive an invocation over HTTP (via the Jetty component perhaps) which will cause one select statement to be performed with the results going back to the HTTP consumer. I have not been able to figure out how to turn off the polling. I can cause my select statement to happen but it happens continuously. Is there a way to turn off polling or does this go against the grain of what the JPA component is intended for? Thanks, Scott Dawson -- View this message in context: http://camel.465427.n5.nabble.com/Camel-JPA-for-single-select-statements-tp5743045.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to retrieve only the last message from 10 messages passed to queue
What should happen to the messages ahead of the last 10? can those be tossed away? or do those need to remain somehow? On Mon, Nov 11, 2013 at 3:35 AM, Rajalakshmi Raman rajalakshmi.ra...@wipro.com wrote: I am trying to get only only the last message from 10 messages passed to queue. I read messages in XML format and extracted the dat and passed to activemq. My message in activemq in the form Sending message Broadcast Message 37 pReceived on : Mon Nov 11 15:41:2 5 IST 2013EURUSR1.358EUR/USR97.1296.70597.296.5650.4150.428.50.21EUR/USR1.60551. 60971.61011.6043-0.0041-0.268.50.21EUR/USR0.90540.90280.90670.90260.00250.288.50 .21EUR/USR0.94430.94280.94520.9410.00150.168.50.22EUR/USR1.03311.03131.03361.030 70.00180.178.50.21EUR/USR0.83020.83040.83160.827-0.0003-0.038.50.21EUR/USR6.1219 6.12056.12216.11790.00140.028:48 Help me to resolve Thanks Raji -- View this message in context: http://camel.465427.n5.nabble.com/How-to-retrieve-only-the-last-message-from-10-messages-passed-to-queue-tp5743024.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Christian Posta http://www.christianposta.com/blog twitter: @christianposta
Re: Camel-JPA for single select statements
Is camel-ibatis or camel-sql component an option? On Mon, Nov 11, 2013 at 8:34 AM, scottdawson sc.e.daw...@gmail.com wrote: I would like to use the Camel JPA component to perform single select statements, in other words, I would like to use the component as a consumer without the default polling behavior. I want to receive an invocation over HTTP (via the Jetty component perhaps) which will cause one select statement to be performed with the results going back to the HTTP consumer. I have not been able to figure out how to turn off the polling. I can cause my select statement to happen but it happens continuously. Is there a way to turn off polling or does this go against the grain of what the JPA component is intended for? Thanks, Scott Dawson -- View this message in context: http://camel.465427.n5.nabble.com/Camel-JPA-for-single-select-statements-tp5743045.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Christian Posta http://www.christianposta.com/blog twitter: @christianposta
Re: Camel-JPA for single select statements
You can just use regular JPA API and call it from a java bean, and have Camel call that bean. On Mon, Nov 11, 2013 at 4:34 PM, scottdawson sc.e.daw...@gmail.com wrote: I would like to use the Camel JPA component to perform single select statements, in other words, I would like to use the component as a consumer without the default polling behavior. I want to receive an invocation over HTTP (via the Jetty component perhaps) which will cause one select statement to be performed with the results going back to the HTTP consumer. I have not been able to figure out how to turn off the polling. I can cause my select statement to happen but it happens continuously. Is there a way to turn off polling or does this go against the grain of what the JPA component is intended for? Thanks, Scott Dawson -- View this message in context: http://camel.465427.n5.nabble.com/Camel-JPA-for-single-select-statements-tp5743045.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: endDoTry() problem
Hi I am having the same issue in camel version 2.10.2. The route below throws exception from(jpa:org.example.SystemProperty?consumeDelete=trueconsumer.namedQuery=ControlProductLoadTrigger) .routeId(getClass().getSimpleName()).doTry().process(new Processor() { @Override public void process(Exchange exchange) throws Exception { ListProduct products = fetchProducts(); exchange.getIn().setBody(products); } }).split(body()).to(jpa:org.example.Product).endDoTry().doCatch(Throwable.class) .transform().simple(${exception.message}).log(LoggingLevel.ERROR, ${body}).end(); This gives me: java.lang.ClassCastException: org.apache.camel.model.RouteDefinition cannot be cast to org.apache.camel.model.TryDefinition -- View this message in context: http://camel.465427.n5.nabble.com/endDoTry-problem-tp5543541p5743050.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: endDoTry() problem
endDoTry() is only needed in some cases if you use doTry .. doCatch. And you must have a doTry, which you do NOT have. On Mon, Nov 11, 2013 at 6:17 PM, kamranzafar xeus@gmail.com wrote: Hi I am having the same issue in camel version 2.10.2. The route below throws exception from(jpa:org.example.SystemProperty?consumeDelete=trueconsumer.namedQuery=ControlProductLoadTrigger) .routeId(getClass().getSimpleName()).doTry().process(new Processor() { @Override public void process(Exchange exchange) throws Exception { ListProduct products = fetchProducts(); exchange.getIn().setBody(products); } }).split(body()).to(jpa:org.example.Product).endDoTry().doCatch(Throwable.class) .transform().simple(${exception.message}).log(LoggingLevel.ERROR, ${body}).end(); This gives me: java.lang.ClassCastException: org.apache.camel.model.RouteDefinition cannot be cast to org.apache.camel.model.TryDefinition -- View this message in context: http://camel.465427.n5.nabble.com/endDoTry-problem-tp5543541p5743050.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: endDoTry() problem
Thanks for replying, doTry is there in the route. The only reason I used endDoTry is because I need to split the exchange body before persistence. It won't let me use split without endDoTry. from(jpa:org.example.SystemProperty?consumeDelete=trueconsumer.namedQuery=ControlProductLoadTrigger) .routeId(getClass().getSimpleName()).*doTry()*.process(new Processor() { @Override public void process(Exchange exchange) throws Exception { ListProduct products = fetchProducts(); exchange.getIn().setBody(products); } }).*split(body())*.to(jpa:org.example.Product).endDoTry().doCatch(Throwable.class) .transform().simple(${exception.message}).log(LoggingLevel.ERROR, ${body}).end(); -- View this message in context: http://camel.465427.n5.nabble.com/endDoTry-problem-tp5543541p5743054.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel-JPA for single select statements
Christian: Yes, we have experimented with camel-jdbc and camel-sql, however, we have a Hibernate layer that we would like to leverage which is why we are trying to use camel-jpa. Claus: It sounds like you are suggesting that maybe camel-jpa is not the right tool for the job. Thanks to both of you for your responses. Best regards, Scott -- View this message in context: http://camel.465427.n5.nabble.com/Camel-JPA-for-single-select-statements-tp5743045p5743055.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: endDoTry() problem
You need to end the split also. On Mon, Nov 11, 2013 at 6:56 PM, kamranzafar xeus@gmail.com wrote: Thanks for replying, doTry is there in the route. The only reason I used endDoTry is because I need to split the exchange body before persistence. It won't let me use split without endDoTry. from(jpa:org.example.SystemProperty?consumeDelete=trueconsumer.namedQuery=ControlProductLoadTrigger) .routeId(getClass().getSimpleName()).*doTry()*.process(new Processor() { @Override public void process(Exchange exchange) throws Exception { ListProduct products = fetchProducts(); exchange.getIn().setBody(products); } }).*split(body())*.to(jpa:org.example.Product).endDoTry().doCatch(Throwable.class) .transform().simple(${exception.message}).log(LoggingLevel.ERROR, ${body}).end(); -- View this message in context: http://camel.465427.n5.nabble.com/endDoTry-problem-tp5543541p5743054.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: testing camel : ClassNotFoundException - org.apache.camel.core.xml.AbstractCamelEndpointFactoryBean
It works if I run the test (after clean install) from the camel-bindy subproject, I does not if I test it from the root, is that expected? On Mon, Nov 11, 2013 at 2:05 AM, Willem jiang willem.ji...@gmail.comwrote: Hi, I’m not sure if you ran the test after you started the whole build. It looks like the bundle plugin wasn’t called. I suggest you to run “mvm clean install -Dtest=false” from the root and then run the test. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Monday, November 11, 2013 at 5:24 AM, lb wrote: Hi, I'm trying to execute a single test in camel main (github) and the test fails because of a ClassNotFoundException: org.apache.camel.core.xml.AbstractCamelEndpointFactoryBean. Here the command i use: [luca@juniper apache-camel]# mvn -Dtest=*BindyComplexCsvUnmarshallTest* test ... Tests in error: BindyComplexCsvUnmarshallTest.testUnMarshallMessage » IllegalState Failed to l... Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 ... [luca@juniper apache-camel]# mvn -version Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100) Maven home: /Users/luca/.../apache-maven-3.0 Java version: 1.7.0_45, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: mac os x, version: 10.9, arch: x86_64, family: mac What's wrong? Below the full stack trace: -- T E S T S --- Running org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallTest Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.982 sec FAILURE! - in org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallTest testUnMarshallMessage(org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallTest) Time elapsed: 0.655 sec ERROR! java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by:
Re: Propose add annotation @BeanInject
Hi Each framework has its own set of annotations to insert objects. 1) OSGI bluprint have annotation @Bean 2) Spring have annotation @Autowire 3) CDI Weld and Guice have annotation @Inject 4) EJB have annotations @EJB and @Resource This zoo annotations are not universal. I'm not looking Varant use annotations in project. As an example, take the JUnit test. Hard to raise test Java EE and WEB, to test the CDI (Weld). Hard to raise test OSGI Enterprise V4.2. It is easier to raise the Spring. A little harder to Guice. I offered a small revision. Instead of code Bean bean = CamelContextHelper.mandatoryLookup (getContext (), bean, Bean.class); we can write beautifully @BeanInjection (bean) Bean bean; As an example of similar implementation, I show the work of the annotation @PropertyInject. Instead of code String stringValue = CamelContextHelper.parseText (getContext (), {{property_a}}); int intValue = CamelContextHelper.parseInteger (getContext (), {{property_b}}); we can write beautifully @PropertyInject (property_a) String stringValue; @PropertyInject (property_b) int intValue; So the code looks beautiful. It is necessary to do so that your work is not only worked well, but also look nice. Aleksey -- View this message in context: http://camel.465427.n5.nabble.com/Propose-add-annotation-BeanInject-tp5742782p5743064.html Sent from the Camel - Users mailing list archive at Nabble.com.
how to assign the jmx objectname without host name
When I config the jmx on camel, the objectname is auto genenrated as org.apache.camel:context=*Happiness*/camelContext,type=components,name=activemqTCP and the Happiness is the my hostname, whether I can config it, e.g. make it as *localhost*/camelContext, I need access it by program and it may change when running on other machine. Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/how-to-assign-the-jmx-objectname-without-host-name-tp5743065.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: testing camel : ClassNotFoundException - org.apache.camel.core.xml.AbstractCamelEndpointFactoryBean
There some magic happens when you use the maven bundle plugin to build the bundle. The bundle plugin generates the OSGi bundle which is based on the packages import and export description and class path. If you just run the test from the root, the bundle plugin doesn’t have a chance to be called, so it makes sense that you got the ClassNotFoundException. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, November 12, 2013 at 3:25 AM, lb wrote: It works if I run the test (after clean install) from the camel-bindy subproject, I does not if I test it from the root, is that expected? On Mon, Nov 11, 2013 at 2:05 AM, Willem jiang willem.ji...@gmail.com (mailto:willem.ji...@gmail.com)wrote: Hi, I’m not sure if you ran the test after you started the whole build. It looks like the bundle plugin wasn’t called. I suggest you to run “mvm clean install -Dtest=false” from the root and then run the test. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Monday, November 11, 2013 at 5:24 AM, lb wrote: Hi, I'm trying to execute a single test in camel main (github) and the test fails because of a ClassNotFoundException: org.apache.camel.core.xml.AbstractCamelEndpointFactoryBean. Here the command i use: [luca@juniper apache-camel]# mvn -Dtest=*BindyComplexCsvUnmarshallTest* test ... Tests in error: BindyComplexCsvUnmarshallTest.testUnMarshallMessage » IllegalState Failed to l... Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 ... [luca@juniper apache-camel]# mvn -version Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100) Maven home: /Users/luca/.../apache-maven-3.0 Java version: 1.7.0_45, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: mac os x, version: 10.9, arch: x86_64, family: mac What's wrong? Below the full stack trace: -- T E S T S --- Running org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallTest Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.982 sec FAILURE! - in org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallTest testUnMarshallMessage(org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallTest) Time elapsed: 0.655 sec ERROR! java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at
MongoDB transaction Handling
Hi, I am trying to implement transaction handling to MongoDB in Camel Routes. What I am trying to achieve is get data from external system insert data in Mongodb. now route same data to other Route and do some processing and update state of inserted data to processing. Now if there any error occur I would like to rollback data from processing to new How i can achieve this? Thanks -- View this message in context: http://camel.465427.n5.nabble.com/MongoDB-transaction-Handling-tp5743060.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to retrieve only the last message from 10 messages passed to queue
I needs to be remained in activemq. But while passing to browser it should only the last message. Thanks Raji -- View this message in context: http://camel.465427.n5.nabble.com/How-to-retrieve-only-the-last-message-from-10-messages-passed-to-queue-tp5743024p5743067.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XML to JSON using XMLJSON - BufferDataException
As you are send Text message, I think you can use http instead of the TCP message to send the XML message and receive the JSON data. If you just want to test the XmlJsonDataFormat , you can just prepare String with XML message and check if the result is what you want. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Monday, November 11, 2013 at 5:19 PM, Malathi G wrote: Hi, I am trying to convert XML into JSON format using XMLJson in TCP client server program. I am having three files - TCPClient, TCPServer and CamelDemo class. In between client and server, i am using CamelDemo class for conversion. It shows BufferDataFormat Exception in CamelDemo class. This is my code *TCPClient Code:* public class TCPClient { public static void main(String[] args) throws IOException { Socket clientsoc = null; PrintWriter out = null; String inputMsg = null; try { clientsoc = new Socket(localhost, 6789); inputMsg=RootfirstNamexxx/firstNamelastNameyyy/lastName/Root; out = new PrintWriter(clientsoc.getOutputStream(), true); out.println(inputMsg); InputStream is = clientsoc.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String receivedMsg = br.readLine(); System.out.println(Message received from server is + receivedMsg); } catch (Exception e) { e.printStackTrace(); } finally { out.close(); clientsoc.close(); out = null; inputMsg = null; } } } *TCPServer Code:* public class TCPServer { public static void main(String[] args) { Socket socket =null; try { int port = 6123; ServerSocket serverSocket = new ServerSocket(port); System.out.println(Server Started and listening to the port 6123); while(true) { socket = serverSocket.accept(); InputStream is = socket.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String receivedMsg = br.readLine(); System.out.println(Message received from client is +receivedMsg); String returnMessage=receivedMsg; PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.println(returnMessage); System.out.println(Message sent to the client is +returnMessage); out.flush(); } } catch (Exception e) { e.printStackTrace(); } finally { try { socket.close(); } catch(Exception e){} } } } *CamelDemo Code:* public class CamelDemo { static CamelContext context = null; public static void main(String[] s) { try { context = new DefaultCamelContext(); final XmlJsonDataFormat xmlJsonFormat=new XmlJsonDataFormat(); xmlJsonFormat.setEncoding(UTF-8); xmlJsonFormat.setForceTopLevelObject(true); xmlJsonFormat.setTrimSpaces(true); xmlJsonFormat.setRootName(Root); xmlJsonFormat.setSkipNamespaces(true); xmlJsonFormat.setRemoveNamespacePrefixes(true); xmlJsonFormat.setExpandableProperties(Arrays.asList(d, e)); Component component = new org.apache.camel.component.mina.MinaComponent(); context.addComponent(tcp, component); context.addRoutes(new RouteBuilder() { public void configure() { from(mina:tcp://localhost:6789?textline=falsesync=true) .marshal(xmlJsonFormat) .process(new Processor() { // consumer public void process(Exchange e) { try { // Request message from client String inMsg = (String) e.getIn().getBody(); System.out.println(**+inMsg+**); // Configuring Destination Endpoint endpoint = context.getEndpoint(mina:tcp://127.0.0.1:6123?textline=falsesync=true); Exchange exchange = endpoint.createExchange(ExchangePattern.InOut); Message in = exchange.getIn(); in.setBody(inMsg); Producer producer = endpoint.createProducer(); producer.start(); producer.process(exchange); // Response message from destination Message out = exchange.getOut(); e.getOut().setBody(out); producer.stop(); } catch (Exception e1) { e1.printStackTrace(); } } });//.to(mina:tcp://127.0.0.1:6123?sync=true); } }); context.start(); Thread.sleep(1000); context.stop(); } catch (Throwable ex) { ex.printStackTrace(); } } } *Exception:* 14:04:16.350 [SocketAcceptorIoProcessor-0.0] DEBUG o.a.m.filter.executor.ExecutorFilter - Launching thread for /127.0.0.1:51299 14:04:16.350 [Camel (camel-1) thread #3 - MinaThreadPool] DEBUG o.a.m.filter.executor.ExecutorFilter - Exiting since queue is empty for /127.0.0.1:51299 14:04:16.350 [SocketAcceptorIoProcessor-0.0] DEBUG o.a.m.filter.executor.ExecutorFilter - Launching thread for /127.0.0.1:51299 14:04:16.350 [Camel (camel-1) thread #3 - MinaThreadPool] DEBUG o.a.c.component.mina.MinaConsumer - Closing session as an exception was thrown from MINA 14:04:16.366 [Camel (camel-1) thread #3 - MinaThreadPool] WARN
Re: how to assign the jmx objectname without host name
From Camel 2.13 onwards the hostname is no longer included by default. http://camel.apache.org/camel-2130-release.html Though in earlier releases you can configure the hostname using org.apache.camel.management.DefaultManagementNamingStrategy On Tue, Nov 12, 2013 at 2:47 AM, CamelTyro 328549...@qq.com wrote: When I config the jmx on camel, the objectname is auto genenrated as org.apache.camel:context=*Happiness*/camelContext,type=components,name=activemqTCP and the Happiness is the my hostname, whether I can config it, e.g. make it as *localhost*/camelContext, I need access it by program and it may change when running on other machine. Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/how-to-assign-the-jmx-objectname-without-host-name-tp5743065.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: MongoDB transaction Handling
Hi, MongoDB does not handle transactions http://docs.mongodb.org/manual/faq/developers/#how-do-i-do-transactions-and-locking-in-mongodb . For your need i would rather use a custom error managment that's update database after succes or error. Best regards P-Alban On Mon, Nov 11, 2013 at 8:01 PM, bipin.sutariya bipin.sutar...@gmail.comwrote: Hi, I am trying to implement transaction handling to MongoDB in Camel Routes. What I am trying to achieve is get data from external system insert data in Mongodb. now route same data to other Route and do some processing and update state of inserted data to processing. Now if there any error occur I would like to rollback data from processing to new How i can achieve this? Thanks -- View this message in context: http://camel.465427.n5.nabble.com/MongoDB-transaction-Handling-tp5743060.html Sent from the Camel - Users mailing list archive at Nabble.com.