Re: Setting Cookie Header in Restlet Request
After doing some research work on the HTTP authentication and cookies, I found it could be better to choice camel-http component[1] to do the job. It provides you more easy way to set the cookies from the Http header. [1] http://camel.apache.org/http.html Willem Willem Jiang wrote: Hi, I just checked the Restlet Request Object , it supports to set the Cookies on the Request Object. It should be easy to support it in camel-restlet. Please feel free to create a JIRA[1] for it. You need to create a new JIRA account if you first use it. [1]http://issues.apache.org/activemq/browse/CAMEL Willem deckerego wrote: I'm attempting to send a REST message to an endpoint via the Restlet component. The service requires you to send the session ID that was set as a cookie for all subsequent requests - so I first authenticate, receive an ID in the Set-Cookie header on the HTTP response, then need to send the same ID back with the Cookie header on subsequent HTTP requests. Camel doesn't appear to support setting the Cookie header explicitly, and the Restlet API won't let me set it via org.restlet.http.headers as the Restlet API complains that Addition of the standard header 'Cookie' is not allowed. Please use the Restlet API instead. Is there any way to send a Cookie via a restlet: component?
Re: activemq component and selector
Sure will do, We just switched to use the component within JAMES a few days ago ;) Bye, Norman 2010/3/10 Willem Jiang willem.ji...@gmail.com: Cool, it's good to see it work. Please keep on exploring camel-jms component, and feel free to send us feed back. Willem Norman Maurer wrote: Hi Willem, I just updated to 2.3-SNAPSHOT and the selector now seems to work as aspected. Good work :) Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi Norman, I can reproduce you issue by use the ConsumerTemplate to get the message, and I filled a JIRA[1] for it. [1]https://issues.apache.org/activemq/browse/CAMEL-2529 Willem Norman Maurer wrote: Hi William, will try the test later today when I have the code around. At the moment I wonder if its possible something related to use the ConsumerTemplate. I created a Consumer which use the ConsumerTemplate to check for messages on a queue and checks for a header value against the current time. You can see the source here: http://svn.apache.org/viewvc/james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/ActiveMQPollingConsumer.java?view=markup Does this looks ok to you ? Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi Norman, It's my mistake, and I just committed a unit test[1] to verify the selector option, everything looks good, can you try the test on your environment? [1]http://svn.apache.org/viewvc?rev=920216view=rev Willem Norman Maurer wrote: Hi Willem, its listed in the jms component site (the one you linked)... Most commonly used options: selector null Sets the JMS Selector, which is an SQL 92 predicate that is used to filter messages within the broker. You may have to encode special characters such as = as %3D Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi, It's look like camel-activemq[1] or camel-jms[2] don't support to specify the selector option in the URI. [1]http://camel.apache.org/activemq.html [2]http://camel.apache.org/jms.html Willem Norman Maurer wrote: Hi all, today I tried to use the message selector with activemq camel component. But It seems to just return the message even if the message does not match the selector I used this as uri: consumerTemplate.receiveNoWait(activemq:queue:myqueue?selector=NEXT_RETRY + System.currentTimeMillis()); Any idea ? Bye, Norman
Re: activemq component and selector
On Wed, Mar 10, 2010 at 10:59 AM, Norman Maurer norman.mau...@googlemail.com wrote: Sure will do, We just switched to use the component within JAMES a few days ago ;) Remember to update that user stories page :) Bye, Norman 2010/3/10 Willem Jiang willem.ji...@gmail.com: Cool, it's good to see it work. Please keep on exploring camel-jms component, and feel free to send us feed back. Willem Norman Maurer wrote: Hi Willem, I just updated to 2.3-SNAPSHOT and the selector now seems to work as aspected. Good work :) Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi Norman, I can reproduce you issue by use the ConsumerTemplate to get the message, and I filled a JIRA[1] for it. [1]https://issues.apache.org/activemq/browse/CAMEL-2529 Willem Norman Maurer wrote: Hi William, will try the test later today when I have the code around. At the moment I wonder if its possible something related to use the ConsumerTemplate. I created a Consumer which use the ConsumerTemplate to check for messages on a queue and checks for a header value against the current time. You can see the source here: http://svn.apache.org/viewvc/james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/ActiveMQPollingConsumer.java?view=markup Does this looks ok to you ? Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi Norman, It's my mistake, and I just committed a unit test[1] to verify the selector option, everything looks good, can you try the test on your environment? [1]http://svn.apache.org/viewvc?rev=920216view=rev Willem Norman Maurer wrote: Hi Willem, its listed in the jms component site (the one you linked)... Most commonly used options: selector null Sets the JMS Selector, which is an SQL 92 predicate that is used to filter messages within the broker. You may have to encode special characters such as = as %3D Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi, It's look like camel-activemq[1] or camel-jms[2] don't support to specify the selector option in the URI. [1]http://camel.apache.org/activemq.html [2]http://camel.apache.org/jms.html Willem Norman Maurer wrote: Hi all, today I tried to use the message selector with activemq camel component. But It seems to just return the message even if the message does not match the selector I used this as uri: consumerTemplate.receiveNoWait(activemq:queue:myqueue?selector=NEXT_RETRY + System.currentTimeMillis()); Any idea ? Bye, Norman -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: activemq component and selector
Sure will do as soon as the code is in shape ;) Thx again, Norman 2010/3/10 Claus Ibsen claus.ib...@gmail.com: On Wed, Mar 10, 2010 at 10:59 AM, Norman Maurer norman.mau...@googlemail.com wrote: Sure will do, We just switched to use the component within JAMES a few days ago ;) Remember to update that user stories page :) Bye, Norman 2010/3/10 Willem Jiang willem.ji...@gmail.com: Cool, it's good to see it work. Please keep on exploring camel-jms component, and feel free to send us feed back. Willem Norman Maurer wrote: Hi Willem, I just updated to 2.3-SNAPSHOT and the selector now seems to work as aspected. Good work :) Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi Norman, I can reproduce you issue by use the ConsumerTemplate to get the message, and I filled a JIRA[1] for it. [1]https://issues.apache.org/activemq/browse/CAMEL-2529 Willem Norman Maurer wrote: Hi William, will try the test later today when I have the code around. At the moment I wonder if its possible something related to use the ConsumerTemplate. I created a Consumer which use the ConsumerTemplate to check for messages on a queue and checks for a header value against the current time. You can see the source here: http://svn.apache.org/viewvc/james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/ActiveMQPollingConsumer.java?view=markup Does this looks ok to you ? Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi Norman, It's my mistake, and I just committed a unit test[1] to verify the selector option, everything looks good, can you try the test on your environment? [1]http://svn.apache.org/viewvc?rev=920216view=rev Willem Norman Maurer wrote: Hi Willem, its listed in the jms component site (the one you linked)... Most commonly used options: selector null Sets the JMS Selector, which is an SQL 92 predicate that is used to filter messages within the broker. You may have to encode special characters such as = as %3D Bye, Norman 2010/3/8 Willem Jiang willem.ji...@gmail.com: Hi, It's look like camel-activemq[1] or camel-jms[2] don't support to specify the selector option in the URI. [1]http://camel.apache.org/activemq.html [2]http://camel.apache.org/jms.html Willem Norman Maurer wrote: Hi all, today I tried to use the message selector with activemq camel component. But It seems to just return the message even if the message does not match the selector I used this as uri: consumerTemplate.receiveNoWait(activemq:queue:myqueue?selector=NEXT_RETRY + System.currentTimeMillis()); Any idea ? Bye, Norman -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
How to propagate exception?
Hi All Based on the following routes: route from uri=direct:message/ onException exceptionmy.fragile.Exception/exception to uri=mock:isItPossibleToCatchHere/ /onException to uri=direct:methodInvocation/ /route route from uri=direct:methodInvocation/ to uri=bean:fragileBean?method=invokeWithPossibleException/ /route Is it possible to use the onException tag there? Thanks -- ~The best men are men who benefit to others http://michsan.web.id Yang berkualitas memang beda rasanya! http://rizqi-cookies.com
How to use JAXB and Java DSL
http://camel.apache.org/jaxb.html That example doesnt work, looking at the API it doesn't even take a String in the constructor? DataFormat jaxb = new JaxbDataFormat(com.acme.model); from(activemq:My.Queue).unmarshal(jaxb).to(mqseries:Another.Queue); I tried this: JaxbDataFormat jaxb = new JaxbDataFormat(); jaxb.setContextPath(package.with.annotated.java.classes); .to(xslt://file:dir/some.xsl) .unmarshal(jaxb) .marshal(jaxb) .to(file://dir); ...doesn't work: SEVERE: Failed delivery for exchangeId: 06fc3c4f-3f8a-4322-9c07-416e3e25b464. Exhausted after delivery attempt: 1 caught: java.io.IOException -- View this message in context: http://old.nabble.com/How-to-use-JAXB-and-Java-DSL-tp27848546p27848546.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Can loop work together with onException?
On Tue, Mar 9, 2010 at 10:19 PM, Muhammad Ichsan ich...@gmail.com wrote: Dear all I have a route which is called by loop like the following: route from uri=direct:repeatReversal / to uri=bean:messageUtil?method=markRepeatRequired / loop method bean=messageUtil method=readNumberOfRepeat / to uri=direct:invoke / /loop to uri=bean:messageUtil?method=printMsg / /route route from uri=direct:invoke / onException exceptionmy.Exception/exception handledconstanttrue/constant/handled to uri=bean:messageUtil?method=markRepeatRequired / /onException delay constant5000/constant /delay choice when simple${in.header.repeat} != null/simple to uri=bean:aBusinessBean?method=invokeWithPossibleMyException / to uri=bean:messageUtil?method=unmarkRepeatRequired/ /when /choice to uri=bean:messageUtil?method=printMsg / /route The problem is, once a MyException arise, the loop stop completely. How this happened? onException does *not* work like try .. catch as in regular Java. You can use doTry .. doCatch for this kind of behavior. However we have a ticket to consider adding an option to onExeption to let it keep running. https://issues.apache.org/activemq/browse/CAMEL-2253 Regards -- ~The best men are men who benefit to others http://michsan.web.id Yang berkualitas memang beda rasanya! http://rizqi-cookies.com -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: How to use JAXB and Java DSL
On Wed, Mar 10, 2010 at 12:46 PM, ankelee andreasasm...@gmail.com wrote: http://camel.apache.org/jaxb.html That example doesnt work, looking at the API it doesn't even take a String in the constructor? DataFormat jaxb = new JaxbDataFormat(com.acme.model); from(activemq:My.Queue).unmarshal(jaxb).to(mqseries:Another.Queue); I tried this: JaxbDataFormat jaxb = new JaxbDataFormat(); jaxb.setContextPath(package.with.annotated.java.classes); .to(xslt://file:dir/some.xsl) .unmarshal(jaxb) .marshal(jaxb) .to(file://dir); ...doesn't work: SEVERE: Failed delivery for exchangeId: 06fc3c4f-3f8a-4322-9c07-416e3e25b464. Exhausted after delivery attempt: 1 caught: java.io.IOException -- Look at the caught exception. Its an IOException which could be something like file not found etc. You have to dig into the stacktrace to see the real problem. And check in camel-jaxb in the src/test/java for unit tests to see how to use it. View this message in context: http://old.nabble.com/How-to-use-JAXB-and-Java-DSL-tp27848546p27848546.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: How to use JAXB and Java DSL
Yeah well, UnmarshalTest.java in the jaxb test does this: protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { public void configure() { DataFormat jaxb = new JaxbDataFormat(org.apache.camel.example); from(direct:start). unmarshal(jaxb). to(mock:result); } }; } And I'm not able to replicate it: Exception in thread main java.lang.Error: Unresolved compilation problems: The constructor JaxbDataFormat(String) is undefined Type mismatch: cannot convert from JaxbDataFormat to DataFormat -- View this message in context: http://old.nabble.com/How-to-use-JAXB-and-Java-DSL-tp27848546p27849420.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to use JAXB and Java DSL
Nevermind, I'm stupid. Was using the wrong JaxbDataFormat. -- View this message in context: http://old.nabble.com/How-to-use-JAXB-and-Java-DSL-tp27848546p27849539.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to propagate exception?
Camel in Action is a really great book. I purchased the MEAP version and it really worth the money! Bye, Norman 2010/3/10 Claus Ibsen claus.ib...@gmail.com: On Wed, Mar 10, 2010 at 12:28 PM, Muhammad Ichsan ich...@gmail.com wrote: Hi All Based on the following routes: route from uri=direct:message/ onException exceptionmy.fragile.Exception/exception to uri=mock:isItPossibleToCatchHere/ /onException to uri=direct:methodInvocation/ /route route from uri=direct:methodInvocation/ to uri=bean:fragileBean?method=invokeWithPossibleException/ /route Is it possible to use the onException tag there? Yes its a route scoped onException then. You can also set it as a CamelContext scoped instead (think global). Chapter 5 in the Camel in Action books covers really well about Camel error handling, which has many features. The wiki pages at Apache is IMHO full of details but I think it lacks a good picture and to guide you through the subject so you would understand it. http://www.manning.com/ibsen You can start here http://camel.apache.org/error-handling-in-camel.html Thanks -- ~The best men are men who benefit to others http://michsan.web.id Yang berkualitas memang beda rasanya! http://rizqi-cookies.com -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
single tcp connection with async requests and async responses
I can use only one thread for sending messages becuase I can have only single TCP connection to external server. I want to be able to send multiple requests one after the other without waiting for a response. responses need to be processed asynchronously. any solutions for this scenario?. I am unable to use camel 2.2 as I have package scanning problem in weblogic. here is one possible solution but I am not sure about the life cycle of the mina endpoint, is it possible to loose messages with this solution. from(file:///test/test/response) .convertBodyTo(String.class).threads(1) .to(mina:tcp://localhost:6202?sync=falsetextline=truefilters=#listFilters); from(vm:response) .to(log:+++ reply); public class MessageFilter extends IoFilterAdapter { @Produce(uri = vm:response) ProducerTemplate producer; @Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { if (message instanceof String) { producer.sendBody(message); } nextFilter.messageReceived(session, message); } } -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27850137.html Sent from the Camel - Users mailing list archive at Nabble.com.
Help with Error Handling
Hi everyone. I'm hoping you guys can help me understand camel error handling a bit more. The current documentation seems incredibly confusing to me with a lot of different ways to accomplish a goal. Here is my particular problem. I need to write a smart bridge between two JMS queues. I'm using camel 2.2 with the spring dsl. Here is the layout: everything is in the same context for simplicity. There is an inbound queue and an outbound queue and some EIP code in the middle. The EIP code in the middle stores the inbound message in a database and writes a copy to the outbound queue. Here are the rules: 1. If the database write fails, write the message to the dead-letter queue and stop further processing. 2. If the outbound queue write fails, rollback the transaction to the DB and write the message to the dead-letter queue and stop further processing. 3. If the dead-letter write fails, roll the original message back on the inbound queue. I think the code below achieves that, but I'm not sure if I need stuff like transacted/ in every route. I'm also not sure what happens if the dead-letter queue is down cause I haven't gotten around to testing that yet. When an exception is thrown in the body of processing, everything seems to work fine. In other words it rolls the transaction back, writes to the dead-letter and stops. It is case 2 and 3 above that I'm wondering about. bean id=deadLetterErrorHandler class=org.apache.camel.builder.DeadLetterChannelBuilder property name=deadLetterUri value=direct:dead-letter / property name=redeliveryPolicy ref=redeliveryPolicyConfig / /bean bean id=redeliveryPolicyConfig class=org.apache.camel.processor.RedeliveryPolicy property name=maximumRedeliveries value=0 / /bean camelContext id=some-bridge errorHandlerRef=deadLetterErrorHandler camel:onException camel:exceptionjava.lang.Throwable/camel:exception camel:bean ref=errorHandler / camel:to uri=direct:dead-letter / /camel:onException route id=from-some-jms-queue from uri=injms:queue:some-inbound-queue/ transacted/ to uri=direct:smart-bridge/ /route route id=some-smart-bridge-code from uri=direct:smart-bridge/ transacted/ !-- do some EIP stuff here including storing the message in a DB -- !-- recipient list to destination JMS -- /route route id=to-some-jms-queue from uri=direct:some-outbound-jms-queue/ transacted/ to uri=outjms:queue:some-outbound-jms/ /route route id=dead-letter from uri=direct:dead-letter/ to uri=dljms:queue:dead-letter/ /route /camelContext -- View this message in context: http://old.nabble.com/Help-with-Error-Handling-tp27851439p27851439.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Help with Error Handling
Thanks for the response Claus. I don't mind buying the book but since 2.2 has just been released and 2.3 is on the horizon, will the book be up-to-date with respect to error handling (and other stuff)? -- View this message in context: http://old.nabble.com/Help-with-Error-Handling-tp27851439p27852592.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Help with Error Handling
On Wed, Mar 10, 2010 at 5:54 PM, DanD ddenni...@up.com wrote: Thanks for the response Claus. I don't mind buying the book but since 2.2 has just been released and 2.3 is on the horizon, will the book be up-to-date with respect to error handling (and other stuff)? -- Yeah the book is up to date. In fact a few days ago I updated chapter 5 with new options added in 2.3. The current MEAP is based on 2.2 and is about 3-4 weeks old. Will be a new MEAP updated at end of this month/early next month. View this message in context: http://old.nabble.com/Help-with-Error-Handling-tp27851439p27852592.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Quickfix send/receive messages in both directions
I wanted to use camel and Quickfix combo in my project and I noticed this warning (on http://camel.apache.org/quickfix.html) : Warning: You cannot use a quickfix engine to send or receive messages in both direction as the FIX protocol handle logon/logout sessions with heartbeat messages which are send to verify if the server or client is still alive in only one direction. I'm not quite sure how to understand it as I managed to get camel to forward a message from one endpoint to another like this: from(quickfix-server:server.cfg).to(quickfix-client:client.cfg); (Listen for incoming fix messages and then forward them to a different system) Does the warning mean I would not be able to return an ACK type message to whoever sent a message to my 'server' unless I configured another endpoint to point back to them and an endpoint to target system I want to forward to? -- View this message in context: http://old.nabble.com/Quickfix-send-receive-messages-in-both-directions-tp27855316p27855316.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: File Consumer : Ignoring file
You could get that behaviour if the file doesn't exist. Also I've had issues on UNC paths when the file server is heavily loaded: file.list() may return null when normally is only returns null if the directory doesn't exist. Also if you have two threads accessing doing the following with a UNC path: if(!folder.exists()) { created = folder.mkdir() if(!created) throw new Exception(); } then you have a race condition an often one thread with see the folder does not exist, and will then fail to create it because the other thread created it first. So in summary: 1) is the file server under heavy load 2) do you have multiple file watchers working on the same folder? David On 9 Mar 2010, at 09:48, Claus Ibsen wrote: Well the JDK do not think the java.io.File is either a directory or a file :) Hence what is the file really? for (File file : files) { // creates a generic file GenericFileFile gf = asGenericFile(endpointPath, file); if (file.isDirectory()) { if (endpoint.isRecursive() isValidFile(gf, true)) { // recursive scan and add the sub files and folders String subDirectory = fileName + File.separator + file.getName(); pollDirectory(subDirectory, fileList); } } else if (file.isFile()) { if (isValidFile(gf, false)) { if (isInProgress(gf)) { if (log.isTraceEnabled()) { log.trace(Skipping as file is already in progress: + gf.getFileName()); } } else { // matched file so add fileList.add(gf); } } } else { log.debug(Ignoring unsupported file type for file: + file); } On Tue, Mar 9, 2010 at 10:43 AM, titexe tit...@yahoo.fr wrote: Hello, I have a problem with file component : I receive this message in the log for each file : Ignoring for unsupported file type file: \\Laptop\testing\OUT\bvbvb.xml below my route : route streamCache=true errorHandlerRef=myDeadLetterChannel from uri=file:///\\Laptop\testing\OUT?recursive=trueamp;readLock=changedamp;autoCreate=trueamp;move=\\Laptop\testing\OUT\Process\amp;moveFailed=\\Laptop\testing\OUT\Fail\amp;maxMessagesPerPoll=5amp;filter=#myAntFilter/ convertBodyTo type=java.lang.String/ process ref=RemoveBomProcessor/ to uri=activemq:queue:IN/ /route bean id=myAntFilter class=org.apache.camel.component.file.AntPathMatcherGenericFileFilter property name=includes value=**/ property name=excludes value=**/Process/**, **/Fail/**/ /bean someone has an idea for this problem ? Thanks in advance, Version of Camel : 2.1 Best regards, titexe -- View this message in context: http://old.nabble.com/File-Consumer-%3A-Ignoring-file-tp27833411p27833411.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
The timing of the timer component
Hi there, Could it be that when the timer component is used it starts firing before all of the routes have been configured? I had a race condition where on one machine Camel complained that route X (produced to by a timer consumer) wasn't established. On another machine though it was fine. Moving the code around so that route X was declared before the timer fixed the issue. Kind regards, Christopher -- View this message in context: http://old.nabble.com/The-timing-of-the-timer-component-tp27857160p27857160.html Sent from the Camel - Users mailing list archive at Nabble.com.
Websphere MQ setting targetClient=1
With camel 1.6.1 I'm trying to set the targetClient=1 for a queue connection. Here is the code im using to try to accomplish this but it doesnt work: MQQueueConnectionFactory cf = new MQQueueConnectionFactory(); JmsConfiguration jc = new JmsConfiguration(cf); cf.setHostName(server); cf.setPort( 1415); cf.setQueueManager( queueManager); cf.setChannel(channel); cf.setTransportType(1); JmsTransactionManager102 jtm = new JmsTransactionManager102(cf, false); JmsComponent ibmmq = new JmsComponent(jc); ibmmq.setAcknowledgementModeName(AUTO_ACKNOWLEDGE); ibmmq.setUseVersion102(true); ibmmq.setTransacted(true); ibmmq.setTransactionManager(jtm); CamelContext camel = new DefaultCamelContext(); Map props = new HashMap(); props.put(targetClient, 1); camel.setProperties(props); camel.addComponent(ibmmq, ibmmq); camel.addRoutes( new RouteBuilder() { public void configure() { from(file://C:/cameltest).to(ibmmq:TEST.QUEUE); } }); camel.start(); I assume this isn't the correct way to do this. Does anyone have an example of getting it to work with version 1.6.1? -- View this message in context: http://old.nabble.com/Websphere-MQ-setting-targetClient%3D1-tp27857263p27857263.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: single tcp connection with async requests and async responses
Firstly if you need to guarantee just one tcp connection as per a connection-oriented protocol then you'll need to follow this recipe: http://camel.apache.org/fine-grained-control-over-a-channel.html You can send multiple requests by reading from a queue (perhaps consider using a http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html ConcurrentLinkedQueue i.e. poll the queue until there's nothing left on it. Meanwhile you'll need another thread to obtain a polling consumer from the same endpoint and poll with a timeout. Of course your protocol will have to support some form of correlation id so that you can match your responses back to your requests. That should do the trick. -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27857286.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: single tcp connection with async requests and async responses
Thanks for the info. it's still little bit vague for me. can you please give me a sample route which would do it at high level.I can use camel 2.2 if needed. my Message header would have a correlation id so that should not be problem. here is the sample route for the scenario I am looking for. here I want all responses to be written to a file without requests waiting for replies. from(file:///test/test/request) .convertBodyTo(String.class).threads(1) .to(mina:tcp://localhost:6202?sync=falsetextline=true) .to(vm:response); from(vm:response) .to(file:///test/test/response?fileName=response_async.txt); huntc wrote: Firstly if you need to guarantee just one tcp connection as per a connection-oriented protocol then you'll need to follow this recipe: http://camel.apache.org/fine-grained-control-over-a-channel.html You can send multiple requests by reading from a queue (perhaps consider using a http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ConcurrentLinkedQueue.html ConcurrentLinkedQueue i.e. poll the queue until there's nothing left on it. Meanwhile you'll need another thread to obtain a polling consumer from the same endpoint and poll with a timeout. Of course your protocol will have to support some form of correlation id so that you can match your responses back to your requests. That should do the trick. -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27857688.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: single tcp connection with async requests and async responses
There's no high level method that I can think of. I find that quite often, when dealing with TCP endpoints as you've described, you probably need to think about wrapping everything up into your own component. -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27857707.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: single tcp connection with async requests and async responses
so, I have to extend the existing Mina component to achieve what I want, is there any example I can use for my scenario?. huntc wrote: There's no high level method that I can think of. I find that quite often, when dealing with TCP endpoints as you've described, you probably need to think about wrapping everything up into your own component. -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27857751.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: single tcp connection with async requests and async responses
I do not recommend extending the MINA component. My recommendation is for you to roll your own component from scratch. This component should obtain the MINA endpoint and invoke its consumers and producers. You could do this within a Processor but writing a component should structure your code more nicely. More on writing components here: http://camel.apache.org/writing-components.html In summary consider: * writing MINA encoders/decoders for your protocol (depending on the complexity of your protocol) * write a component that utilises a MINA component which in turn optionally utilises the encoders and decoders That way your route code becomes something like: from(file:///test/test/response) .convertBodyTo(String.class) .to(mycomponent://localhost:6202); from(mycomponent://localhost:6202) .to(log:+++ reply); -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27857847.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: single tcp connection with async requests and async responses
I will read the documentation on writing component, would it take longer to write new component from scratch using Mina api. would I be able to use load balancer component with this becuase I need to rotate Ip addresses in case of IO timeouts or failures. huntc wrote: I do not recommend extending the MINA component. My recommendation is for you to roll your own component from scratch. This component should obtain the MINA endpoint and invoke its consumers and producers. You could do this within a Processor but writing a component should structure your code more nicely. More on writing components here: http://camel.apache.org/writing-components.html In summary consider: * writing MINA encoders/decoders for your protocol (depending on the complexity of your protocol) * write a component that utilises a MINA component which in turn optionally utilises the encoders and decoders That way your route code becomes something like: from(file:///test/test/response) .convertBodyTo(String.class) .to(mycomponent://localhost:6202); from(mycomponent://localhost:6202) .to(log:+++ reply); -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27857892.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: single tcp connection with async requests and async responses
In terms of development time, this would depend on your familiarity with MINA I guess. My personal take is to utilise the existing Camel component. I think your custom component would end up looking quite simple and skinny. You can load balance custom components as you can any other type of component of course. -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27857929.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: single tcp connection with async requests and async responses
I am little bit familiar with Mina but not comfortable with managing threads my self becuase of synchronization and thread safety issues as I can have only one tcp connection to the external tcp server, I need to use spring to initialize(establish connection) and to make sure I use the same connection object. huntc wrote: In terms of development time, this would depend on your familiarity with MINA I guess. My personal take is to utilise the existing Camel component. I think your custom component would end up looking quite simple and skinny. You can load balance custom components as you can any other type of component of course. -- View this message in context: http://old.nabble.com/single-tcp-connection-with-async-requests-and-async-responses-tp27850137p27858033.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Setting Cookie Header in Restlet Request
I just tried out the http component for REST calls - you were absolutely right. The straight HTTP component is _TONS_ easier to work with. No more templates either... just set the relative path as a header. So much better! It seems so obvious now; I was making things much harder than they needed to be. Thanks! deckerego wrote: I think I see what you mean. In my head I'm trying to think of the benefits of using CXFRS or Restlet instead of straight HTTP... but in truth I'm not coming up with many. I'm ultimately just going to take the resulting XML and unmarshal it via JAXB, then throw non-HTTP 200 response codes as an exception. Am I grossly oversimplifying things? Or are the benefits of Restlet/CXFRS just limited to helper methods and URI templates? willem.jiang wrote: After doing some research work on the HTTP authentication and cookies, I found it could be better to choice camel-http component[1] to do the job. It provides you more easy way to set the cookies from the Http header. -- View this message in context: http://old.nabble.com/Setting-Cookie-Header-in-Restlet-Request-tp27839785p27859364.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: The timing of the timer component
On Thu, Mar 11, 2010 at 12:07 AM, huntc hu...@mac.com wrote: Hi there, Could it be that when the timer component is used it starts firing before all of the routes have been configured? Yes see this page how to control startup order of routes http://camel.apache.org/configuring-route-startup-ordering-and-autostartup.html And the upcoming chapter 13 in the Camel in Action book, also covers this as well. I had a race condition where on one machine Camel complained that route X (produced to by a timer consumer) wasn't established. On another machine though it was fine. Moving the code around so that route X was declared before the timer fixed the issue. Kind regards, Christopher -- View this message in context: http://old.nabble.com/The-timing-of-the-timer-component-tp27857160p27857160.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Websphere MQ setting targetClient=1
Hi Search this forum as I think IBM MQ have been debated before, and how to get it working. On Thu, Mar 11, 2010 at 12:17 AM, Jason Queen jason.qu...@colinx.com wrote: With camel 1.6.1 I'm trying to set the targetClient=1 for a queue connection. Here is the code im using to try to accomplish this but it doesnt work: MQQueueConnectionFactory cf = new MQQueueConnectionFactory(); JmsConfiguration jc = new JmsConfiguration(cf); cf.setHostName(server); cf.setPort( 1415); cf.setQueueManager( queueManager); cf.setChannel(channel); cf.setTransportType(1); JmsTransactionManager102 jtm = new JmsTransactionManager102(cf, false); JmsComponent ibmmq = new JmsComponent(jc); ibmmq.setAcknowledgementModeName(AUTO_ACKNOWLEDGE); ibmmq.setUseVersion102(true); ibmmq.setTransacted(true); ibmmq.setTransactionManager(jtm); CamelContext camel = new DefaultCamelContext(); Map props = new HashMap(); props.put(targetClient, 1); camel.setProperties(props); camel.addComponent(ibmmq, ibmmq); camel.addRoutes( new RouteBuilder() { public void configure() { from(file://C:/cameltest).to(ibmmq:TEST.QUEUE); } }); camel.start(); I assume this isn't the correct way to do this. Does anyone have an example of getting it to work with version 1.6.1? -- View this message in context: http://old.nabble.com/Websphere-MQ-setting-targetClient%3D1-tp27857263p27857263.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: The timing of the timer component
Hi Claus, I understand that route order can be configured explicitly. However should a route start up and start firing during configuration of the routes? Intuitively, I wouldn't have thought so. Kind regards, Christopher -- View this message in context: http://old.nabble.com/The-timing-of-the-timer-component-tp27857160p27859605.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: The timing of the timer component
On Thu, Mar 11, 2010 at 6:51 AM, huntc hu...@mac.com wrote: Hi Claus, I understand that route order can be configured explicitly. However should a route start up and start firing during configuration of the routes? Intuitively, I wouldn't have thought so. Its all explained in chapter 13 in details. All routes are warmed up. And then started at the very last minute. And this happens in the order defined. And therefore the timer could be started before the next route, but still enough time for it to trigger and fire. Depending on your system and how the JVM execute tasks etc. So you can increase the initial delay of the timer to let it fire later the first time. Kind regards, Christopher -- View this message in context: http://old.nabble.com/The-timing-of-the-timer-component-tp27857160p27859605.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
is NMR a multithreaded endpoints
I was just wondering if the NMR endpointis multithreaded. And when I say multithreaded, here is what I mean. osgi:camelContext id=somewhere xmlns=http://camel.apache.org/schema/spring; trace=true route from ref=somewhereRef/ to uri=nmr:myDynamicRouter /route /osgi:camelContext osgi:camelContext id=anotherSomewhere xmlns=http://camel.apache.org/schema/spring; trace=true route from ref=anotherSomewhereRef/ to uri=nmr:myDynamicRouter /route /osgi:camelContext My question is if camelcontext 'somewhere' has sent a request to nmr:myDynamicRouter and it is waiting for a response, then camelcontext 'anotherSomewhere' sends its request to nmr:myDynamicRouter (note that the dynamicRouter is still processing initial request from camelContext 'somewhere'); will this make nmr:myDynamicRouter block (on anotherSomewhere's camelContext)? How can I guaranty that nmr:myDynamicRouter will be able to handle multiple request from different endpoints simultaneously without blocking? kr. -- View this message in context: http://old.nabble.com/is-NMR-a-multithreaded-endpoints-tp27860344p27860344.html Sent from the Camel - Users mailing list archive at Nabble.com.