Fuse EAP 6.4 example using camel-hl7 and netty4 with Java DSL.

Solution Verified - Updated -

Environment

  • Red Hat Fuse
    • 6.3.0

Issue

Do you have a camel-hl7 example project for a java ee web application deployed to Fuse EAP? Ideally, we'd like to use Java DSL.

Resolution

  • There are several testcases available at upstream apache-camel code.

  • For this particular use-case following modifications were done which resolved the issues.

  • Problem is with:
public class BchDecoder extends HL7MLLPNettyEncoderFactory 

Modify it to

public class BchDecoder extends HL7MLLPNettyDecoderFactory 
 <dependency>
    <groupId>ca.uhn.hapi</groupId>
    <artifactId>hapi-structures-v231</artifactId>
    <version>2.2</version>
</dependency>
  • Handler annotation was required in process method of RespondACK
@Component
public class RespondACK {

    @Handler
    public Message process(Message in) throws Exception {
        System.out.println(in.toString());
        Message out =  in.generateACK();
        System.out.println(out.toString());
        return out;

    }
}
  • RespondACK class than can be invoked following way. Method process is added as @Handler annotation thus will be invoked.
 from("netty4:tcp://localhost:10009?sync=true&synchronous=true&encoder=#hl7encoder&decoder=#hl7decoder")
                .unmarshal()
                .hl7(false)
                .bean(RespondACK.class)
                .end();

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.