Search in sources :

Example 1 with HL7MLLPCodec

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();
}
Also used : CamelContext(org.apache.camel.CamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) ProducerTemplate(org.apache.camel.ProducerTemplate) HL7MLLPCodec(org.apache.camel.component.hl7.HL7MLLPCodec) SimpleRegistry(org.apache.camel.impl.SimpleRegistry) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Aggregations

CamelContext (org.apache.camel.CamelContext)1 ProducerTemplate (org.apache.camel.ProducerTemplate)1 HL7MLLPCodec (org.apache.camel.component.hl7.HL7MLLPCodec)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 SimpleRegistry (org.apache.camel.impl.SimpleRegistry)1