use of org.apache.camel.model.dataformat.HL7DataFormat in project camel by apache.
the class DataFormatClause method hl7.
/**
* Uses the HL7 data format
*/
public T hl7(Object parser) {
HL7DataFormat hl7 = new HL7DataFormat();
hl7.setParser(parser);
return dataFormat(hl7);
}
use of org.apache.camel.model.dataformat.HL7DataFormat in project camel by apache.
the class DataFormatClause method hl7.
/**
* Uses the HL7 data format
*/
public T hl7(boolean validate) {
HL7DataFormat hl7 = new HL7DataFormat();
hl7.setValidate(validate);
return dataFormat(hl7);
}
use of org.apache.camel.model.dataformat.HL7DataFormat in project wildfly-camel by wildfly-extras.
the class HL7IntegrationTest method testMarshalUnmarshal.
@Test
@SuppressWarnings("resource")
public void testMarshalUnmarshal() throws Exception {
final String msg = "MSH|^~\\&|MYSENDER|MYRECEIVER|MYAPPLICATION||200612211200||QRY^A19|1234|P|2.4\r";
final HL7DataFormat format = new HL7DataFormat();
CamelContext camelctx = new DefaultCamelContext();
camelctx.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:start").marshal(format).unmarshal(format).to("mock:result");
}
});
camelctx.start();
try {
HapiContext context = new DefaultHapiContext();
Parser p = context.getGenericParser();
Message hapimsg = p.parse(msg);
ProducerTemplate producer = camelctx.createProducerTemplate();
Message result = (Message) producer.requestBody("direct:start", hapimsg);
Assert.assertEquals(hapimsg.toString(), result.toString());
} finally {
camelctx.stop();
}
}
Aggregations