[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[Camel route help] HL7 listener, to parse body, to base64 decode, pdf to file on filesystem
I appologize.. Newbie here to the open source/project world. Long time programmer in other realms.
I have a base64 encoded pdf that will be sent to me via HL7 in the OBX-5-5 field of this message body that I need to decode and create an actual pdf file on a filesystem. I have tried various themes of attempting to access the unmarshalled structure, but that's where the trail gets cold.
I haven't attached any "code" since it is more representative of thrashing to get some sort of result rather than intelligent design. I created two maven archetypes (Camel java DSL and Camel spring) and attempted to re-engineer the sample file read-decision-log-write route and take this one step at a time. Currently I can receive HL7, ACK, unmarshal, log the message body, marshal, and write to entire HL7 message to a file. I wish to receive the HL7, ACK, unmarshal, isolate OBX-5-5, decode it's contents back to binary, and write this to a new file on the file system with a filename and .pdf extension, and dispose of the HL7 message (end the route here).
I've owned :"Camel in Action" for years now, but have not been able yet to apply it's wisdom to my situations. Perhaps a little hand-holding will help me see the landscape of this technology. I am missing something, as to what exactly, I've been struggling to figure out.
So I've been parallel developing two maven projects, one Java DSL and one Spring. Here's the latest skeleton I have for the Spring version:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Configures the Camel Context-->
<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.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="hl7decoder" class="org.apache.camel.component.hl7.HL7MLLPNettyDecoderFactory"/>
<bean id="hl7encoder" class="org.apache.camel.component.hl7.HL7MLLPNettyEncoderFactory"/>
<!--<bean id="hl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec"/> -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<endpoint id="hl7listener" uri="mllp://10.105.13.206:8888" />
<route>
<from uri="hl7listener"/>
<convertBodyTo type="java.lang.String" />
<unmarshal>
<hl7 validate = "false" />
</unmarshal>
<log message="${body}" />
<marshal><hl7 /> </marshal>
<log message="Other message"/>
<!-- <convertBodyTo type="java.lang.String"/> -->
<to uri="file:target/messages/others"/>
</route>
</camelContext>
</beans>
Ideas? Thanks!