You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gnsandeep <gn...@gmail.com> on 2014/09/03 00:55:17 UTC
Camel route with mina2 and HL7codec not working
Hi,
I have created below camel-context.xml file .Camel context and route is
started without any errors. when I send Hl7 message from java client nothing
happens- i dont see any logs, exception nor mesaage in java code which is
listening on 9020. Can someone please help on how to debug this
java client code :
private static final char END_OF_BLOCK= '\u001c';
private static final char START_OF_BLOCK= '\u000b';
private static final char CARRIAGE_RETURN= 13;
public static void main(String[] args) throws IOException{
Socket socket = new Socket("localhost", 8020);
System.out.println("Conneted to Server");
StringBuffer testHL7ADTMessage = new StringBuffer();
testHL7ADTMessage
.append(START_OF_BLOCK)
.append("MSH|^~\\&||||namespace ID^universal
ID^|20110607^||ADT^A04|#ControlNumber#|D^|2.3.1||AL|AL|||8859/1||\"\"|Conformanc")
.append(CARRIAGE_RETURN)
.append("EVN||20110607^|20110607^|01|||namespace ID^universal ID^")
.append(CARRIAGE_RETURN)
.append(END_OF_BLOCK);
OutputStream out = socket.getOutputStream();
out.write(testHL7ADTMessage.toString().getBytes());
logs:
Bound to server address: localhost/127.0.0.1:8020 using acceptor: (nio
socket acceptor: localAddress(es): [/127.0.0.1:8020], managedSessionCount:
0)
Route: route1 started and consuming from:
Endpoint[mina2://tcp://localhost:8020?codec=%23hl7codec&sync=false]
Total 1 routes, of which 1 is started.
Apache Camel 2.13.2 (CamelContext: camel-1) started in 0.945 seconds
camel-context.xml file:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" >
<property name="charset" value="iso-8859-1"/>
</bean>
<camel:camelContext xmlns="http://camel.apache.org/schema/spring">
<camel:route>
<camel:from
uri="mina2:tcp://localhost:8020?sync=false&codec=#hl7codec"/>
<camel:log message="message received"/>
<camel:to
uri="mina2:tcp://localhost:9020?sync=false&codec=#hl7codec"/>
</camel:route>
</camel:camelContext>
</beans>
Thanks
Sandeep
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-route-with-mina2-and-HL7codec-not-working-tp5755981.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel route with mina2 and HL7codec not working
Posted by gnsandeep <gn...@gmail.com>.
Hi,
Thanks for your reply.After adding the second end byte it works fine. I
thought I should be getting some error in logs when i don't send the second
end byte.
Can you please help with below questions
Can I avoid second end byte by setting some property in mina2 codec bean? Is
the second end byte mandatory?
How do I change the start and end bye default values?
I tried to change the start byte and first end byte by updating codec
property but got error:TypeMismatchException: Failed to convert property
value of type 'java.lang.String' to required type 'char' for property
'startByte';
<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" >
<property name="charset" value="UTF-8"/>
<property name="startByte" value="0x0b"/>
<property name="endByte1" value="0x1c"/>
</bean>
Thanks
Sandeep
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-route-with-mina2-and-HL7codec-not-working-tp5755981p5756015.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel route with mina2 and HL7codec not working
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
I dont see that your hl7 test data matches the expected end
bytes - there are 2 end bytes, which you must provide, see:
http://camel.apache.org/hl7
On Wed, Sep 3, 2014 at 12:55 AM, gnsandeep <gn...@gmail.com> wrote:
>
> Hi,
>
> I have created below camel-context.xml file .Camel context and route is
> started without any errors. when I send Hl7 message from java client nothing
> happens- i dont see any logs, exception nor mesaage in java code which is
> listening on 9020. Can someone please help on how to debug this
>
> java client code :
>
> private static final char END_OF_BLOCK= '\u001c';
> private static final char START_OF_BLOCK= '\u000b';
> private static final char CARRIAGE_RETURN= 13;
>
> public static void main(String[] args) throws IOException{
>
> Socket socket = new Socket("localhost", 8020);
> System.out.println("Conneted to Server");
>
> StringBuffer testHL7ADTMessage = new StringBuffer();
>
> testHL7ADTMessage
> .append(START_OF_BLOCK)
> .append("MSH|^~\\&||||namespace ID^universal
> ID^|20110607^||ADT^A04|#ControlNumber#|D^|2.3.1||AL|AL|||8859/1||\"\"|Conformanc")
> .append(CARRIAGE_RETURN)
> .append("EVN||20110607^|20110607^|01|||namespace ID^universal ID^")
> .append(CARRIAGE_RETURN)
> .append(END_OF_BLOCK);
> OutputStream out = socket.getOutputStream();
> out.write(testHL7ADTMessage.toString().getBytes());
>
>
>
> logs:
> Bound to server address: localhost/127.0.0.1:8020 using acceptor: (nio
> socket acceptor: localAddress(es): [/127.0.0.1:8020], managedSessionCount:
> 0)
> Route: route1 started and consuming from:
> Endpoint[mina2://tcp://localhost:8020?codec=%23hl7codec&sync=false]
> Total 1 routes, of which 1 is started.
> Apache Camel 2.13.2 (CamelContext: camel-1) started in 0.945 seconds
>
>
>
>
> camel-context.xml file:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:camel="http://camel.apache.org/schema/spring"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
> <bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec" >
> <property name="charset" value="iso-8859-1"/>
> </bean>
> <camel:camelContext xmlns="http://camel.apache.org/schema/spring">
> <camel:route>
> <camel:from
> uri="mina2:tcp://localhost:8020?sync=false&codec=#hl7codec"/>
> <camel:log message="message received"/>
> <camel:to
> uri="mina2:tcp://localhost:9020?sync=false&codec=#hl7codec"/>
> </camel:route>
> </camel:camelContext>
> </beans>
>
> Thanks
> Sandeep
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-route-with-mina2-and-HL7codec-not-working-tp5755981.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/