Re: Issue with Transactions and Split
First let me thank you for replying...Here is what I have in my XML bean id=activemq class=org.apache.activemq.camel.component.ActiveMQComponent property name=transacted value=true/ property name=transactionManager ref=txManager/ /bean bean id=txManager class=org.springframework.jms.connection.JmsTransactionManager property name=connectionFactory ref=jmsConnectionFactory/ /bean bean id=jmsConnectionFactory class=org.apache.activemq.ActiveMQConnectionFactory property name=brokerURL value=tcp://localhost:61616/ /bean let me know if you need any additional information. -- View this message in context: http://camel.465427.n5.nabble.com/Issue-with-Transactions-and-Split-tp5738618p5740889.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Issue with Transactions and Split
Any ideas? Any advice? Do I need to add more information? Wrong place to post? Any feedback would be appreciated. -- View this message in context: http://camel.465427.n5.nabble.com/Issue-with-Transactions-and-Split-tp5738618p5740825.html Sent from the Camel - Users mailing list archive at Nabble.com.
Issue with Transactions and Split
Guys, I am having an issue with split and sending messages to the a queue. I am reading from a queue in this example and sending to another queue each of the split messages. The first message goes in the destination queue, but the I make the second message fail. I was expecting that it will cause the first message to go back to the original queue; however, since ActiveMQ is trying to redeliver 6 times, I end up with 7 in the destination queue and the original message in the DLQ. Those 7 are the first message from the split 7 times...the first one and then the 6 retries since I am using shareUnitOfWork the orignal message goes to DLQ and since it retries it 6 times, the first message ends up making it in the destination queue 1 + 6 times so I end up with 7. I get what is going on, but wondering if the first split message should not be rolled back. This example I got from the camel book and made my own modification to simulate what I am trying to accomplish. Here is the sample code. Here are the routes: from(activemq:queue:a) .transacted() .split(body().tokenize(,)).streaming().shareUnitOfWork().stopOnException() .to(direct:quote) .to(activemq:queue:b) .end() ; from(direct:quote) .choice() .when(body().contains(Camel)) .transform(constant(Camel rocks)) .when(body().contains(Donkey)) .throwException(new IllegalArgumentException(Donkeys not allowed)) .otherwise() .transform(body().prepend(Hello )) ; This is the test that I am using to run it...the test code is not very complete...I am not asserting anything just browsing the ActiveMQ queues after it has run. @Test public void testWithCamel() throws Exception { context.start(); template.sendBody(activemq:queue:a, Camel,Donkey); //Object reply = consumer.receiveBody(activemq:queue:b, 1); Thread.sleep(6); //assertEquals(Camel rocks, reply); } I was expecting here that Camel will be rolledback out of the queue once Donkey fails, but that does not seem to the be case even sharing the unit of work and stopping on Exception. I am wondering if this is possible to do or at the moment it hit the queue the transaction is gone...it seems to be one transaction per split message and not one transaction for the whole thing. Please let me know how I can accomplish this. I am using Camel 2.11.0 and ActiveMQ 5.8.0 Thank you!! -- View this message in context: http://camel.465427.n5.nabble.com/Issue-with-Transactions-and-Split-tp5738618.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Issue when using ZipSplitter and sending entries to a file endpoint
ok, after looking further at this, we discovered that we were under the wrong assumption on how the splitter in Camel works. We got that assumption after playing with the ZipSpliter. After running into this problem, we played with simple spliters, we figured that our assumption was wrong. I will explain...this is how the splitters usually work from(seda:decompressFiles).routeId(DecompressFiles) .split(body().tokenize(,)).streaming().shareUnitOfWork() .log(LET'S SEE WHERE THIS GOES!!!) .to(file:data/out?fileName=${header.zipFileName}) .to(log:?showExchangeId=trueshowHeaders=trueshowProperties=truemultiline=true) .end() .log(ORIGINAL FILE) .to(log:?showExchangeId=trueshowHeaders=trueshowProperties=truemultiline=true) feeding that route with this code: template.sendBodyAndHeaders(seda:decompressFiles, One,Two, headers); You would get: [ad #0 - seda://decompressFiles] DecompressFilesINFO LET'S SEE WHERE THIS GOES!!! [ad #0 - seda://decompressFiles] DecompressFilesINFO LET'S SEE WHERE THIS GOES!!! [ad #0 - seda://decompressFiles] DecompressFilesINFO ORIGINAL FILE I removed the exchange print out, but you get the idea. Now, when using the zip splitter, it will work fine when you are sending the entries to a file; however, when you send the entries to a SEDA or something that does not immediately read the data from the stream then it does not work properly and you get an extra entry with the CamelZipComplete = true with a null body. So this is an issue with the ZipSplitter Specifically. Now, I can change the JIRA accordingly to explain the issue better; however, wanted to ask first since I don't know if you want to keep the original description or something. I would like to basically edit the subject and the description to explain this correctly. Also, we are looking into improving the ZipSplitter to behave better since we ended up going deeper into this and have a better picture of what is going on. Please let me know your thoughts. -- View this message in context: http://camel.465427.n5.nabble.com/Issue-when-using-ZipSplitter-and-sending-entries-to-a-file-endpoint-tp5738179p5738242.html Sent from the Camel - Users mailing list archive at Nabble.com.
Issue when using ZipSplitter and sending entries to a file endpoint
Hello, I found this problems and I am still scratching my head, maybe you guys can help me...I have a route like this: //Compressed Files Route //This route decompresses the files and sends them back to be registered from(seda:decompressFiles).routeId(DecompressFiles) .split(new ZipSplitter()).streaming().shareUnitOfWork() .log(LET'S SEE WHERE THIS GOES!!!) .choice() .when(simple(${property.CamelSplitComplete} == false)) .log(ENTRIES) .to(file:{{fmsSys.ClientFileArchiveRoot}}?fileName=${header. + FMSHeaders.ARCHIVE_PARTIAL_PATH + }/${header.zipFileName}) //.to(activemq:queue:ZipChildFiles) .when(simple(${property.CamelSplitComplete} == true)) .log(ZIPFILE MULTIPLE ENTRIES CamelSplitComplete - True) .to(seda:CleanUp) //Todo: Make sure this is the right place. .otherwise() .log(OHTERWISE) .throwException(new FMSException(Unexpected Result in Un-Zipping!!, null)) .end() .log(AT THE END!!) ; The Zip File that I am using to test contains two entries and I am using Camel 2.11.0 When I run this I get: [ad #0 - seda://decompressFiles] DecompressFilesINFO LET'S SEE WHERE THIS GOES!!! [ad #0 - seda://decompressFiles] DecompressFilesINFO ENTRIES [ad #0 - seda://decompressFiles] DecompressFilesINFO AT THE END!! [ad #0 - seda://decompressFiles] DecompressFilesINFO LET'S SEE WHERE THIS GOES!!! [ad #0 - seda://decompressFiles] DecompressFilesINFO ENTRIES [ad #0 - seda://decompressFiles] DecompressFilesINFO AT THE END!! Those print outs are for the entries...the Actual Zip file never gets in there as I would expect. Now let's say comment out the to(file...) line and replace for the active MQ line or pretty much anything else then I get what I would expect: [ad #0 - seda://decompressFiles] DecompressFilesINFO LET'S SEE WHERE THIS GOES!!! [ad #0 - seda://decompressFiles] DecompressFilesINFO ENTRIES [ad #0 - seda://decompressFiles] DecompressFilesINFO AT THE END!! [ad #0 - seda://decompressFiles] DecompressFilesINFO LET'S SEE WHERE THIS GOES!!! [ad #0 - seda://decompressFiles] DecompressFilesINFO ENTRIES [ad #0 - seda://decompressFiles] DecompressFilesINFO AT THE END!! [ad #0 - seda://decompressFiles] DecompressFilesINFO LET'S SEE WHERE THIS GOES!!! [ad #0 - seda://decompressFiles] DecompressFilesINFO ZIPFILE MULTIPLE ENTRIES CamelSplitComplete - True [ad #0 - seda://decompressFiles] DecompressFilesINFO AT THE END!! Some how when I put a to(file:...) it does not work as expected...I even removed the choice and just left the splitting and still the does not work, it works like the first example. I tried looking here in the forum, in the book and all over the web and did not really stumble upon an answer. I thought maybe it had to do with the end or endChoice, but that does not seem to be it since I removed the choice, like I said and that did not do it. I wonder if there is an issue with the combination ZipSplitter and to(file:...). Please advice, Thank you, Abdiel -- View this message in context: http://camel.465427.n5.nabble.com/Issue-when-using-ZipSplitter-and-sending-entries-to-a-file-endpoint-tp5738179.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Issue when using ZipSplitter and sending entries to a file endpoint
ok, I can do that, but how? I can see JIRA, but I don't think I am able to add issues, is anybody able to? Also when you said submit a test case, do you want an attachment with the test and the route? -- View this message in context: http://camel.465427.n5.nabble.com/Issue-when-using-ZipSplitter-and-sending-entries-to-a-file-endpoint-tp5738179p5738183.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Issue when using ZipSplitter and sending entries to a file endpoint
Disregard my previous post. I figured out how to create the issue. Here is the link to the JIRA issue: https://issues.apache.org/jira/browse/CAMEL-6679 Let me know if you need additional information. -- View this message in context: http://camel.465427.n5.nabble.com/Issue-when-using-ZipSplitter-and-sending-entries-to-a-file-endpoint-tp5738179p5738184.html Sent from the Camel - Users mailing list archive at Nabble.com.
How to process a response and the original message after submitting to a component
When I post a message to a component which will give me a distinct out message (like http, jdbc, etc.), what is the best way to continue processing both the in and out messages in parallel? In other words, how can I send the response message (out) on a separate thread while I continue the initial route with the request message (in)? The scenario we are trying to handle is as follows. We receive a customer file, for which we generate several receipt reports which are sent back to the customer. Those reports are to be sent back as soon as they are generated while the original inbound file continues through the processing cycle. pseudo-route would look like this in theory: From(file:) .to(http:validateFileAndGenerateReceiptReport1) .to(file:report1.txt) .to(http:validateFileAndGenerateReceiptReport2) .to(file:report2.txt) .to(...further processing of inbound file) Of course this does not work for the original inbound file data iss overwritten with the first HTTP response which is not what we need. I know we could just backup the inbound data into a temporary header property before calling the HTTP components and then restore it into the body later in the route before calling the second HTTP component but I was wondering if there is a cleaner way to accomplish this. We are planning on doing something like this unless you have a better solution: From(file:) .setHeader(request, in.body) .to(http:validateFileAndGenerateReceiptReport1) .to(file:report1.txt) .setBody(header(request)) .to(http:validateFileAndGenerateReceiptReport2) .to(file:report2.txt) .setBody(header(request)) .to(...further processing of inbound file) -- View this message in context: http://camel.465427.n5.nabble.com/How-to-process-a-response-and-the-original-message-after-submitting-to-a-component-tp5737841.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to process a response and the original message after submitting to a component
Christian, Thank you for your reply; however, it is not that simple. The message that will continue is dependent on the answer from the component. So think about it this way, we send to some validation out of that we get a report with the results which needs to go to the client; however, some clients don't want to stop even if validation fails so the main message has to continue. I hope you see that multicast will not work since the multicast will only get the out message from the previous component and not the original in. In my case I want to go to a component and after that component executes, I want to do something else with the message that went into that component and the message that resulted from that component. Thank you, Abdiel -- View this message in context: http://camel.465427.n5.nabble.com/How-to-process-a-response-and-the-original-message-after-submitting-to-a-component-tp5737841p5737845.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Getting a Header property on a exception in the DSL
barthorre, First, thanks for replying and second, I do that all the time too!!! However, in this particular it does not work. Look at the code, I am passing it when throwing the exception, it is not in the regular DSL where simple will just work. You can try it and you will see. What comes in the Exception string is: Client Configuration not found for clientid: ${header.ClientID}. If you try to add simple around it, it does not work since simple returns a SimpleBuilder so I tried the other code that I showed on my post, but I am not sure how to get the exchange so I have not been able to get the value here. -- View this message in context: http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737592.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Getting a Header property on a exception in the DSL
Thanks Claus...I can find many ways around it, I was just wondering if there was something I was missing or doing wrong...What you are saying makes sense and I don't think we need to add that at this point. On Tue, Aug 20, 2013 at 10:59 AM, Claus Ibsen-2 [via Camel] ml-node+s465427n5737601...@n5.nabble.com wrote: This is not possible as you use the new constructor in Java that will instantiate the exception once. What you want is to create a new exception when it happens with data from the message. For that you can call a method and let it throw the exception. For throwException to work with your use case, it would require to not use the new constructor, and let Camel instantiate the exception and evaluate eg any simple expresisons prior etc. eg we could do something alike, throwException(ConfigurationNotFoundException.class, simple(Something got wrong due ${header.bar})) which then would create the exception using a 1 arg constructor, assuming that would be a String type etc. Though when you need 2+ args then it gets more complicated. Also we should also try to avoid keep expanding the DSL to avoid it growing to large. Though I can see your use-case is probably more common to create an exception with a cause String message that has details from the Camel message. If other feel we need something a like this, then we could raise a JIRA On Tue, Aug 20, 2013 at 2:25 PM, abdiels [hidden email]http://user/SendEmail.jtp?type=nodenode=5737601i=0 wrote: barthorre, First, thanks for replying and second, I do that all the time too!!! However, in this particular it does not work. Look at the code, I am passing it when throwing the exception, it is not in the regular DSL where simple will just work. You can try it and you will see. What comes in the Exception string is: Client Configuration not found for clientid: ${header.ClientID}. If you try to add simple around it, it does not work since simple returns a SimpleBuilder so I tried the other code that I showed on my post, but I am not sure how to get the exchange so I have not been able to get the value here. -- View this message in context: http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737592.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: [hidden email]http://user/SendEmail.jtp?type=nodenode=5737601i=1 Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- If you reply to this email, your message will be added to the discussion below: http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737601.html To unsubscribe from Getting a Header property on a exception in the DSL, click herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5737551code=YWJkaWVsc0BnbWFpbC5jb218NTczNzU1MXwtNjU1OTY1MDc= . NAMLhttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551p5737611.html Sent from the Camel - Users mailing list archive at Nabble.com.
Getting a Header property on a exception in the DSL
Hello, I am trying to print the client id on a exception message like this: from(seda:AddDataToCache).routeId(AddDataToCache) .threads() .choice() .when(header(CamelJdbcRowCount).isEqualTo(0)) .log(No database record) .throwException(new ConfigurationNotFoundException(Client Configuration not found for clientid: ${header. + FMSHeaders.CLIENT_ID + })) .otherwise() .log(FOUND database record) .end() ; Now that of course does not work since we are passing a string to a constructor and the simple language will not kick in...I tried this new ConfigurationNotFoundException((new SimpleBuilder( Client Configuration not found for clientid: ${header. + FMSHeaders.CLIENT_ID + })).evaluate(???,String.class)) but I don't know how to get the exchange...Is there a way to accomplish putting this client id here? I know I can get in the error handler itself for example and I could do other things, but I am wondering if there is a way to just grab data like this from the message sort of mixing simple with strings. Please let me know your thoughts. Thank you, Abdiel -- View this message in context: http://camel.465427.n5.nabble.com/Getting-a-Header-property-on-a-exception-in-the-DSL-tp5737551.html Sent from the Camel - Users mailing list archive at Nabble.com.