如何使用HAPI Server捕获传入的消息

时间:2013-11-07 13:51:40

标签: java hapi

我是Hapi HL7的新手,用过示例服务器类。

public static void main(String[] args) throws Exception {
    HapiContext context = new DefaultHapiContext();
    MinLowerLayerProtocol mllp = new MinLowerLayerProtocol();
    mllp.setCharset("UTF-8");
    context.setLowerLayerProtocol(mllp);


    int port = 2010; // The port to listen on
    boolean useTls = false; // Should we use TLS/SSL?

    HL7Service server = context.newServer(port, useTls);

    ReceivingApplication handler = new ExampleReceiverApplication();


    server.registerApplication("*", "*", handler);
    server.registerConnectionListener(new MyConnectionListener());

    server.setExceptionHandler(new MyExceptionHandler());

    server.startAndWait();

}

现在我想抓住接收消息以便进一步处理...... 我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

仔细查看HAPI提供的示例

ReceivingApplication handler = new ExampleReceiverApplication(); 

此类可以处理传入的消息