camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karuna Arshakota <karsh...@progress.com>
Subject Re: configure routing slip
Date Thu, 08 Jan 2009 11:28:41 GMT

Hi
  I tried like as you said but still am not able to route the message to
particular destination.I tried with file target and jms endpoints also.

see the camel xml and class

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
	<import
resource="file:///D:\Eclipse3.4.1\runtime-New_configuration1\ABC\src\main\java\org\apache\camel\processor\routingslip\Callthis.xml"
/> "import bean xml here"
	<camelContext id="camelroute"
		xmlns="http://activemq.apache.org/camel/schema/spring">
		<route xmlns="http://activemq.apache.org/camel/schema/spring">
			<from
			
uri="file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/pick/Header.xml?autoCreate=false&amp;lock=false"
				id="Camel_File_2" />
			<process ref="mySetHeaderProcessor"></process>
			<convertBodyTo type="java.lang.String"></convertBodyTo>
			<routingSlip uriDelimiter="#" headerName="routingSlipHeader"
				id="Camel_RoutingSlip_4" />
		</route>
	</camelContext>
</beans>

class:
public class MySetHeaderProcessor implements Processor {

	public void process(Exchange exchange) throws Exception {
		// TODO Auto-generated method stub
        System.out.println("***Before Setting********");
		exchange.getIn().setHeader("routingSlipHeader",
"file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/drop"); 
        System.out.println("******After setting*****");
	  	 
	}
}

When i ran this i got output saying
***Before Setting********
******After setting*****
But no message was coming to
"file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/drop" location.
If I set something like below in the class

exchange.getIn().setHeader("routingSlipHeader", "jms:queue:myqueue"); 

"cant convert org.apache.camel.DefaultMessage to
org.apache.camel.JMSMessage"

Could you plz help me.....



Claus Ibsen-2 wrote:
> 
> Hi
> 
> Ah <constant> was added in Camel 1.5.0 I think, so if you are running
> on an older release its not there.
> 
> You can add the header from Java code. You can use a <process
> ref="mySetHeaderProcessor"/>
> And then add a spring bean with this id
> 
> <bean id="mySetHeaderProcessor"
> class="com.mycompany.MySetHeaderProcessor"/>
> 
> And then create a class with this name
> com.mycompany.MySetHeaderProcessor that implements the
> org.apache.camel.Processor interface.
> 
> In there you can do:
> 
> exchange.getIn().setHeader("routingSlipHeader", "and here the file
> target"/>
> 
> 
> On Thu, Jan 8, 2009 at 6:58 AM, Karuna Arshakota <karshako@progress.com>
> wrote:
>>
>> hi
>> I have set as u have mentioned but when i ran camel xml it it throwing
>> exception saying
>>  "cvc-complex-type.2.4.a: Invalid content was found starting with element
>> 'constant"
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> You should use <constant> for constant expressions.
>>>
>>>                         <setHeader headerName="routingSlipHeader">
>>>
>>> <constant>file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/target</constant>
>>>                         </setHeader>
>>>
>>>
>>> On Thu, Jan 8, 2009 at 6:40 AM, Karuna Arshakota <karshako@progress.com>
>>> wrote:
>>>>
>>>> hi
>>>>  I am sure that camel is running on my machine.I tried some thing like
>>>> this.I am trying to send input file to which am setting some header to
>>>> it
>>>> from camel xml.But the problem is while running the camel it throwing
>>>> exception as mentioned below and also find camel xml.
>>>>
>>>> .............
>>>> <route xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>                        <from
>>>>
>>>> uri="file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/pick?autoCreate=false&amp;lock=false"
>>>>                                id="Camel_File_2" />
>>>>                        <setHeader headerName="routingSlipHeader">
>>>>
>>>> <simple>file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/target</simple>
>>>>                        </setHeader>
>>>>                        <routingSlip uriDelimiter="#"
>>>> headerName="routingSlipHeader"
>>>>                                id="Camel_RoutingSlip_4" />
>>>>                </route>
>>>> ...............
>>>>
>>>> Exception:
>>>>
>>>> org.apache.camel.language.IllegalSyntaxException: Illegal syntax for
>>>> language: org.apache.camel.language.simple.SimpleLanguage@1f6f27b.
>>>> Expression:
>>>> file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/target
>>>>        at
>>>> org.apache.camel.language.simple.SimpleLanguage.createSimpleExpression(SimpleLanguage.java:139)
>>>>        at
>>>> org.apache.camel.language.simple.SimpleLanguage.createExpression(SimpleLanguage.java:61)
>>>>        at
>>>> org.apache.camel.model.language.ExpressionType.createExpression(ExpressionType.java:141)
>>>>        at
>>>> org.apache.camel.model.SetHeaderType.createProcessor(SetHeaderType.java:75)
>>>>        at
>>>> org.apache.camel.model.ProcessorType.createOutputsProcessor(ProcessorType.java:1635)
>>>>        at
>>>> org.apache.camel.model.ProcessorType.createOutputsProcessor(ProcessorType.java:95)
>>>>        at
>>>> org.apache.camel.model.InterceptorRef.createProcessor(InterceptorRef.java:66)
>>>>        at
>>>> org.apache.camel.model.ProcessorType.makeProcessor(ProcessorType.java:1519)
>>>>        at
>>>> org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java:99)
>>>>        at
>>>> org.apache.camel.model.RouteType.addRoutes(RouteType.java:221)
>>>>        at org.apache.camel.model.RouteType.addRoutes(RouteType.java:90)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:520)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:512)
>>>>        at
>>>> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:149)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
>>>>        at
>>>> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
>>>>        at
>>>> org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
>>>>        at
>>>> org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
>>>>        at
>>>> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
>>>>        at
>>>> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:275)
>>>>        at
>>>> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:737)
>>>>        at
>>>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:384)
>>>>        at
>>>> org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
>>>>        at
>>>> org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:106)
>>>>        at
>>>> com.iona.eitools.grinder.debugger.camel.scaffolded.CamelStandinRuntime.doLaunchDebuggedContext(CamelStandinRuntime.java:177)
>>>>        at
>>>> com.iona.eitools.grinder.debugger.camel.scaffolded.CamelStandinRuntime.init(CamelStandinRuntime.java:131)
>>>>        at
>>>> com.iona.eitools.grinder.debugger.camel.scaffolded.CamelStandinRuntime.main(CamelStandinRuntime.java:104)
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> We have to step back a bit on the routing slip to see that you can run
>>>>> camel and it can do something.
>>>>> So try the simple file mover without routingslip to see the file is
>>>>> moved. Then we now Camel is running and it can do something. Then we
>>>>> can address the routing slip issues afterwards
>>>>>
>>>>> When you copy a file in that folder, is it picked up by Camel, such as
>>>>> it will delete it after processing?
>>>>>
>>>>> In you case you are missing to parse the input file and set the header
>>>>> for the routing slip.
>>>>>
>>>>>
>>>>>
>>>>> Does the On Wed, Jan 7, 2009 at 12:18 PM, Karuna Arshakota
>>>>> <karshako@progress.com> wrote:
>>>>>>
>>>>>> hi
>>>>>> I tried with file endpoints but it doesnt work.i am trying resolve
>>>>>> the
>>>>>> problem but I am not able to do
>>>>>>
>>>>>>
>>>>>> this is camel xml
>>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>> xsi:schemaLocation="
>>>>>> http://www.springframework.org/schema/beans
>>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>>>>> http://activemq.apache.org/camel/schema/spring
>>>>>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd"><camelContext
>>>>>> id="camelroute"
>>>>>> xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>>> <route xmlns="http://activemq.apache.org/camel/schema/spring">
>>>>>>    <from
>>>>>> uri="file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/pick?autoCreate=false&amp;lock=false"
>>>>>> id="Camel_File_2"/>
>>>>>>    <routingSlip uriDelimiter="#" headerName="routingSlipHeader"
>>>>>> id="Camel_RoutingSlip_4"/>
>>>>>> </route>
>>>>>> </camelContext></beans>
>>>>>>
>>>>>> and input file
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>>>>> <content>
>>>>>>    <entry type="1">
>>>>>>        <textMessage JMSCorrelationID=""
>>>>>> routingSlipHeader="file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/src/drop#file:///D:/Eclipse3.4.1/runtime-New_configuration1/ABC/target"
>>>>>> JMSDeliveryMode="2" JMSExpiration="0"
>>>>>> JMSMessageID="ID:nbkarshkoxp-1878-1230290090906-0:0:1:1:1"
>>>>>> JMSPriority="1"
>>>>>> JMSRedelivered="true" JMSTimestamp="1230290093827" JMSType="">
>>>>>>            <text>1</text>
>>>>>>        </textMessage>
>>>>>>    </entry>
>>>>>> </content>
>>>>>>
>>>>>>
>>>>>> Could you please check this and let me know any wrong in configuring.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Claus Ibsen-2 wrote:
>>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>> That is a bit odd. I added a JMS sample:
>>>>>>> http://svn.apache.org/viewvc?view=rev&revision=731874
>>>>>>>
>>>>>>> Can you try with other kind of endpoints/transport to see if
you for
>>>>>>> instance can get a file mover working?
>>>>>>>
>>>>>>> <from uri="file://inbox"/>
>>>>>>> <to uri="file://outbox"/>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Jan 7, 2009 at 6:26 AM, Karuna Arshakota
>>>>>>> <karshako@progress.com>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> thanks for ur quick response.Ya I have read the link mentioned
in
>>>>>>>> wiki.Still
>>>>>>>> I am getting same problem that i have mentioned earlier.
>>>>>>>>
>>>>>>>>
>>>>>>>> Karuna Arshakota wrote:
>>>>>>>>>
>>>>>>>>> hi,
>>>>>>>>>   I am new to Camel and found very interesting to work
with
>>>>>>>>> patterns.I
>>>>>>>>> am
>>>>>>>>> trying different patterns but struck at routing slip
pattern.I am
>>>>>>>>> using
>>>>>>>>> camel 1.4.
>>>>>>>>>
>>>>>>>>> Please find that attached camel xml and input xml which
am sending
>>>>>>>>> this
>>>>>>>>> through an endpoint('somequeue')
>>>>>>>>>  http://www.nabble.com/file/p21305734/Header.xml Header.xml
>>>>>>>>> http://www.nabble.com/file/p21305734/camel-debugger-tmp6214.xml
>>>>>>>>> camel-debugger-tmp6214.xml
>>>>>>>>>
>>>>>>>>> First time i got a message to the 'output' endpoint(URI)
but when
>>>>>>>>> I
>>>>>>>>> ran
>>>>>>>>> after that many times but no message were coming to the
mentioned
>>>>>>>>> URIs.I
>>>>>>>>> am expecting the message should come to all URIs that
i mentioned
>>>>>>>>> in
>>>>>>>>> the
>>>>>>>>> input xml (myqueue and output).Am I correct? Could you
please
>>>>>>>>> explain
>>>>>>>>> the
>>>>>>>>> functionality of routing slip and explain me how can
i really use
>>>>>>>>> it.
>>>>>>>>> Thanks for all ur help in Advance
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/configure-routing-slip-tp21305734s22882p21325171.html
>>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> /Claus Ibsen
>>>>>>> Apache Camel Committer
>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/configure-routing-slip-tp21305734s22882p21329355.html
>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> /Claus Ibsen
>>>>> Apache Camel Committer
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>
>>>>>
>>>> http://www.nabble.com/file/p21346200/RoutingSlipfile.xml
>>>> RoutingSlipfile.xml
>>>> http://www.nabble.com/file/p21346200/RoutingSlipfile.xml
>>>> RoutingSlipfile.xml
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/configure-routing-slip-tp21305734s22882p21346200.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> /Claus Ibsen
>>> Apache Camel Committer
>>> Blog: http://davsclaus.blogspot.com/
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/configure-routing-slip-tp21305734s22882p21346350.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> 
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/configure-routing-slip-tp21305734s22882p21350224.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message