0
votes

I am new to Apache Camel and I am in a situation where my application needs a codec (HL7) to be registered with camel context. I know there is a solution where you can create a default camel context with an instance of your own registry but is there any way I could configure my own registry in the camel context?

I am using JavaDSL to develop my application and the configuration in context goes like this.

<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
    <property name="charset" value="iso-8859-1"/>
</bean>


<camelcontext id = "context">
     <ref bean = "MyRouteBuilder"/>
<camelcontext/>

I build the routes in MyRouteBuilder Class by overriding the configure method. My route goes like this.

from("mina2:tcp://localhost:8888?sync=true&codec=#hl7codec").to("jms:queue")

However, the codec doesn't seem to work. When I remove the codec, My application runs just fine and accepts HL7 messages but with the codec, I am not able to receive any messages. I feel this occurs because the codec bean is defined but the context isnt able to pick it up. I do not want to create a defaultcamelcontext with the required registry settings. Rather, I am looking for a way to register the codec within camelcontext configuration xml, and so far, I have failed.

Am I missing anything with my configuration? Any help would be greatly appreciated.

1

1 Answers

0
votes

You normally should not need to use &amp; in Java DSL, so replace &amp;codec= with &codec=