Sql-stored: return clob
Hello, is it possible to return a java.sql.clob with the sql-stored component? I tested it adding a new parameter with a specific clob treatment: in components\camel-sql\src\main\java\org\apache\camel\component\sql\stored\TemplateStoredProcedure.java declareParameter(new SqlOutParameter(outParameter.getOutValueMapKey(), outParameter.getSqlType(), null, new ClobReturnType())); Is this feature available within other standard camel component? Many thanks in advance Cecilio -- View this message in context: http://camel.465427.n5.nabble.com/Sql-stored-return-clob-tp5791004.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: On exception notify first error.
Thanks for the help. I came with the following solution: public class ErrorHandlerNotifier implements Processor{ Logger logger = LoggerFactory.getLogger(ErrorHandlerNotifier.class); private String destination; private final String DEFAULT_DESTINATION = activemq:MAILING; private int numberOfRedeliveries; private final int DEFAULT_NUMBER_OF_REDELIVERIES = 100; public void setMonitoringDestination(String destination) { if(destination == null){ this.destination = DEFAULT_DESTINATION; logger.debug(Usign default destination {} for monitoring error handler.,DEFAULT_DESTINATION); }else{ this.destination = destination; logger.debug(Using destination {} for monitoring error handler.,destination); } } public void setMaximumNumberOfRedeliveries(int numberOfRedeliveries) { if(numberOfRedeliveries == 0){ this.numberOfRedeliveries = DEFAULT_NUMBER_OF_REDELIVERIES; logger.debug(Using default number of redeliveries : {},DEFAULT_NUMBER_OF_REDELIVERIES); }else{ this.numberOfRedeliveries = numberOfRedeliveries; logger.debug(Using number of redeliveries : {},numberOfRedeliveries); } } public void process(Exchange exchange) throws Exception { int redeliveryCounter = exchange.getIn().getHeader(CamelRedeliveryCounter, Integer.class); //Check if the retry needs to be notified. if(redeliveryCounter == numberOfRedeliveries){ numberOfRedeliveries = numberOfRedeliveries * 2; logger.info(Send a notification... ); exchange.getIn().setHeader(TooManyRedeliveries,true); exchange.getContext().createProducerTemplate().send(destination, exchange); } } } And Spring: errorHandler id=eh type=DefaultErrorHandler onRedeliveryRef=myRetryProcessor redeliveryPolicy maximumRedeliveries=20 redeliveryDelay=1000 retryAttemptedLogLevel=WARN/ /errorHandler bean id=myRetryProcessor class=com.test.ErrorHandlerNotifier property name=monitoringDestination value=activemq:MAILING/ property name=maximumNumberOfRedeliveries value=200/ /bean Thanks for the help! -- View this message in context: http://camel.465427.n5.nabble.com/On-exception-notify-first-error-tp5767385p5767494.html Sent from the Camel - Users mailing list archive at Nabble.com.
On exception notify first error.
Hello, is there a way on the on exception or in the error handler to send a message one time and keep retrying? Something like this but with error handler or on exception. route from uri=activemq:in/ doTry throw new=sql.Exception/ doCatch exceptionjava.sql.SQLException/exception choice when simple${header.Reported} == null/simple setHeader headerName=Reported simpletrue/simple /setHeader multicast to uri=activemq:NOTIFY/ to uri=activemq:in/ /multicast /when otherwise to uri=activemq:in/ /otherwise /choice /doCatch /doTry /route Any suggestion will be appreciated. Cecilio. -- View this message in context: http://camel.465427.n5.nabble.com/On-exception-notify-first-error-tp5767385.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel transacted route from JMS to JDBC
Hello I tried to create a transacted route, but after 7 retries the message is discarded and if the process is killed the message is lost. Setting the transacted parameter, the vm connector is repeatedly starting/stopping. Why happens this? route id=SQLInsert from uri=activemq:in.Q?transacted=true/ transacted/ to uri=sql:insert into table values(:#${body})?dataSource=testDB/ /route Beans bean id=transactionManager class=org.springframework.jdbc.datasource.DataSourceTransactionManager property name=dataSource ref=testDB/ /bean bean id=PROPAGATION_REQUIRED class=org.apache.camel.spring.spi.SpringTransactionPolicy property name=transactionManager ref=transactionManager/ property name=propagationBehaviorName value=PROPAGATION_REQUIRED/ /bean Is there a better way of doing this? Any help will be appreciated. Thanks! -- View this message in context: http://camel.465427.n5.nabble.com/Camel-transacted-route-from-JMS-to-JDBC-tp5764486.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Netty consumer fixed message size.
Thanks Claus for your answer. I'm sure I'm sending blocks of 100 bytes. You are right, sometimes is posting to the route two or more of this blocks together. Is there a way to ensure that each 100 bytes received, the netty component will post a new message? Or I have to create a custom decoder with a variable length as you suggested? Thanks you in advance. -- View this message in context: http://camel.465427.n5.nabble.com/Netty-consumer-fixed-message-size-tp5750868p5750895.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Netty consumer fixed message size.
Hi, thanks again claus. My idea was to send first a 100 length packet with the number of (100 length) packets, post them individually in the route and aggregate them. -- View this message in context: http://camel.465427.n5.nabble.com/Netty-consumer-fixed-message-size-tp5750868p5750923.html Sent from the Camel - Users mailing list archive at Nabble.com.
Netty consumer fixed message size.
Hi, I'm sending a 100 bytes array to a netty consumer. Is there a way to post a message in the route each 100 bytes received? I tried with a FixedLengthFrameDecoder of 100 bytes, but sometimes I receive more than 100 bytes. from uri=netty:tcp://ip:9001?decoders=#string-decoder,#length-decoderamp;receiveBufferSize=100/ bean id=string-decoder class=org.jboss.netty.handler.codec.string.StringDecoder/ bean id=length-decoder class=org.jboss.netty.handler.codec.frame.FixedLengthFrameDecoder constructor-arg value=100/ /bean Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/Netty-consumer-fixed-message-size-tp5750868.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Aggregator, beyond the simple string example
Hi, I did long time ago a test to add a child node to an xml root, you could modify it. public class XmlAggregator implements AggregationStrategy { public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { Document oldBody = oldExchange.getIn().getBody(org.w3c.dom.Document.class); Document newBody = newExchange.getIn().getBody(org.w3c.dom.Document.class); NodeList list = newBody.getElementsByTagName(tag); Element element = (Element) list.item(0); Node copiedNode = oldBody.importNode(element, true); oldBody.getDocumentElement().appendChild(copiedNode); oldExchange.getIn().setBody(oldBody); return oldExchange; } } Hope it help. -- View this message in context: http://camel.465427.n5.nabble.com/Aggregator-beyond-the-simple-string-example-tp5745012p5745055.html Sent from the Camel - Users mailing list archive at Nabble.com.
Sql component headers and body in query.
Hi, I have the following sql endpoint: to uri=sql:insert into table(id,payload) values(:#Name,xmlparse(document cast(# as clob) preserve whitespace))?dataSource=derby/ It throws java.sql.SQLException: Number of parameters mismatch. Expected 2, was: 1 If I send just headers It works, but I don't want to set the body in a header If I send a List containing the parameters as the documentation says it works. Thanks! -- View this message in context: http://camel.465427.n5.nabble.com/Sql-component-headers-and-body-in-query-tp5743260.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
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.
Camel 2.12.1 org.xml.sax.SAXParseException
Hi, in camel 2.12.1 when split a message this kind of xml tag doesn't work, meanwhile in camel 2.11.0 works fine: tag attribute=attribute/ org.xml.sax.SAXParseException; XML documents structures must start and end within the same entity. If I add: tag attribute=attribute/tag works fine. Is suppose to be the expected behaviour? Thanks in advance! -- View this message in context: http://camel.465427.n5.nabble.com/Camel-2-12-1-org-xml-sax-SAXParseException-tp5742659.html Sent from the Camel - Users mailing list archive at Nabble.com.
Keep the same message in a queue after consuming it.
Hi, is possible to consume a message from a queue in ActiveMQ and keep it in the queue for the next consumption of the same consumer? And is possible to override a message? I know that is not the goal of Camel and ActiveMQ. But I'm trying to use INOUT pattern and keep the message for future use. Something like: route from uri=file://c:/temp/in/ to uri=activemq:example.A/ /route route from uri=timer/ to uri=activemq:example.INOUT pattern=InOut/--here got the message from example.A to uri=../ /route route from uri=activemq:example.INOUT/ process ref=consume/-here consume from example.A /route This works, but consume the message. And I would like to keep it in the queue example.A -- View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Keep the same message in a queue after consuming it.
Thanks for the fast answer. I can't send the message back, because that means if I send a new message to the queue example.A from file, the sent back message will be consume before. I would like to have something like a LIFO in the queue example.A. And If there is no new message, keep consuming the old one. I tried resequencer to sort the queue but doesn't seem the way to do it. -- View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739219.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Keep the same message in a queue after consuming it.
Exactly that, keep procesing the same message again and again until there's a new one. I know sounds strange for camel, but I need to write the same message until there's a new version. I tried with file component with let me override it. But I need to get the message in a producer. Many thanks :) -- View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739230.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Keep the same message in a queue after consuming it.
Thanks for the tips, I will try it! -- View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739235.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Keep the same message in a queue after consuming it.
Finally I made it using content enricher, route from uri=file://c:/temp/in/ to uri=file://c:/temp/schedule/ -this override the file, so I always get the last one. /route route from uri=timer/ pollEnrich uri=file:c://temp/schedule?noop=trueamp;fileName=schedule.xml/--this don't consume the file, so I have always the message. to uri=../ /route Finally I use file component, because its easier for users to open a simple xml file to see the message. Many thanks! -- View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739245.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Keep the same message in a queue after consuming it.
The example above will not write the same file again and again, when you set noop=true camel set idempotent as well. So this line is now: pollEnrich uri=file:c://temp/schedule?noop=trueamp;idempotent=falseamp;fileName=schedule.xml/--this don't consume the file, so I have always the message. Hope this help. -- View this message in context: http://camel.465427.n5.nabble.com/Keep-the-same-message-in-a-queue-after-consuming-it-tp5739214p5739255.html Sent from the Camel - Users mailing list archive at Nabble.com.