I have a method in my code that takes a string and parses it using HAPI and
returns the message. I timed the method and it takes almost 2.5 seconds. I
am using HAPI version 2.1. Any idea how to speed up the parsing or what is
causing it to be so slow? I don't think it was this slow in version 1.0. I
updated to 2.1 recently.

    public Message toMessage(String request) {

        try {
            StopWatch watch = new StopWatch();
            watch.start();
            // Parse the message. This is just for debugging/development
            Parser parser = new PipeParser(new
CanonicalModelClassFactory(MPV_DEFAULT_HAPI_VERSION));
            parser.setValidationContext(new NoValidation());
            Message message = parser.parse(request);
            watch.stop();
            logger.info("Parsing time: " + watch.getTime() + " ms");
            return message;
        }
        catch (EncodingNotSupportedException e) {
            logger.error(e);
        }
        catch (HL7Exception e) {
            logger.error(e);
        }

        return null;
    }

JR
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to