XML <header> element

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

XML <header> element

Aaron Mulder
So in the XML, you can do something like this:

<route>
  <from uri="..." />
  <choice>
    <when>
      <header>???</header>
      <to uri="..." />
    </when>
  </choice>
</route>

My question is, what setup do I need to get this to work and what goes
in the ??? -- basically, what is the correct setup and usage for the
<header> element.  When running in Java 6 with the camel-script JAR on
the class path, I'm getting this:

[ltMessageListenerContainer-106] DeadLetterChannel              ERROR
Failed delivery for exchangeId:
ID-hagrid.local/57149-1214611750742/0-1. On delivery attempt: 0
caught: java.lang.IllegalArgumentException: No script engine could be
created for: header
java.lang.IllegalArgumentException: No script engine could be created
for: header
        at org.apache.camel.builder.script.ScriptBuilder.getEngine(ScriptBuilder.java:381)
        at org.apache.camel.builder.script.ScriptBuilder.getScriptContext(ScriptBuilder.java:422)
        at org.apache.camel.builder.script.ScriptBuilder.evaluateScript(ScriptBuilder.java:484)
        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:82)
        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:49)
        at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:47)
        at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:143)
        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:87)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
        at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:44)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:68)
        at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:66)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:531)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:466)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435)
        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:316)
        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:235)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:887)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:822)
        at java.lang.Thread.run(Thread.java:637)

Is there some other JAR I need?  Something else?

Thanks,
       Aaron
Reply | Threaded
Open this post in threaded view
|

Re: XML <header> element

jstrachan
Hmm, not sure the <header> language is fully supported - particularly
as a predicate; its really only used to create an expression of a
header - not really for predicates. I'd recommend using EL, OGNL,
Groovy or just use a Java method call for the expression...

http://activemq.apache.org/camel/bean-language.html


2008/6/28 Aaron Mulder <[hidden email]>:

> So in the XML, you can do something like this:
>
> <route>
>  <from uri="..." />
>  <choice>
>    <when>
>      <header>???</header>
>      <to uri="..." />
>    </when>
>  </choice>
> </route>
>
> My question is, what setup do I need to get this to work and what goes
> in the ??? -- basically, what is the correct setup and usage for the
> <header> element.  When running in Java 6 with the camel-script JAR on
> the class path, I'm getting this:
>
> [ltMessageListenerContainer-106] DeadLetterChannel              ERROR
> Failed delivery for exchangeId:
> ID-hagrid.local/57149-1214611750742/0-1. On delivery attempt: 0
> caught: java.lang.IllegalArgumentException: No script engine could be
> created for: header
> java.lang.IllegalArgumentException: No script engine could be created
> for: header
>        at org.apache.camel.builder.script.ScriptBuilder.getEngine(ScriptBuilder.java:381)
>        at org.apache.camel.builder.script.ScriptBuilder.getScriptContext(ScriptBuilder.java:422)
>        at org.apache.camel.builder.script.ScriptBuilder.evaluateScript(ScriptBuilder.java:484)
>        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:82)
>        at org.apache.camel.builder.script.ScriptBuilder.matches(ScriptBuilder.java:49)
>        at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:47)
>        at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:143)
>        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:87)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>        at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
>        at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
>        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:44)
>        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:68)
>        at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:66)
>        at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:531)
>        at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:466)
>        at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435)
>        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:316)
>        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:235)
>        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:887)
>        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:822)
>        at java.lang.Thread.run(Thread.java:637)
>
> Is there some other JAR I need?  Something else?
>
> Thanks,
>       Aaron
>



--
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com