use of org.apache.camel.component.hl7.HL7MLLPCodec in project quickstarts by jboss-switchyard.
the class HL7Client method testSendA19.
public void testSendA19() throws Exception {
SimpleRegistry registry = new SimpleRegistry();
HL7MLLPCodec codec = new HL7MLLPCodec();
codec.setCharset("iso-8859-1");
codec.setConvertLFtoCR(true);
registry.put("hl7codec", codec);
CamelContext camelContext = new DefaultCamelContext(registry);
camelContext.start();
ProducerTemplate template = camelContext.createProducerTemplate();
String line1 = "MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4";
String line2 = "QRD|200612211200|R|I|GetPatient|||1^RD|0101701234|DEM||";
StringBuilder in = new StringBuilder();
in.append(line1);
in.append("\r");
in.append(line2);
template.requestBody("mina2:tcp://127.0.0.1:" + MINA2_PORT + "?sync=true&codec=#hl7codec", in.toString());
template.stop();
camelContext.stop();
}
Aggregations