Sorry but i am not sure i understand your message clearly. If you are
talking about creating a listener and ingesting messages, this is the
kind of code i have. When your application starts, you have to create a
listener on a port.
int PORT= 12345; // Generally through some configuration file or
command line
LowerLayerProtocol llp = LowerLayerProtocol.makeLLP(); // The
transport protocol
PipeParser parser = new PipeParser(); // The message parser
HL7Listener = new SimpleServer(PORT, llp, parser);
Application handler = new HL7ListenerApp();
HL7Listener.registerApplication("*", "*", handler);
HL7Listener.start();
System.out.println("HL7 daemon has been started on port "+PORT);
Then the Listener class is fairly simple:
public class HL7ListenerApp implements Application
{
public HL7ListenerApp()
{
// Do your initialization
}
@Override
public boolean canProcess(Message arg0)
{
return true;
}
@Override
public Message processMessage(Message Msg)
throws ApplicationException, HL7Exception
{
Message ACK = null;
try
{
// parse the Msg
if (no error)
{
ACK = DefaultApplication.makeACK((MSH) Msg.get("MSH"));
// persist the message if you need to
// Handle message info (write to file, db, or update
UI or whatever you need to do
}
else
{
// handle error
}
}
catch (Throwable T)
{
if (ACK == null)
throw new HL7Exception(T);
}
return ACK;
}
}
I have implemented this in a number of places and prefer to handle the
error in the application than bubble it up back to the interface, unless
something really bad happened (HL7Exception). I hope this helps although
i am not sure this is exactly what you asked for.
------------------------------------------------------------------------
*Laurent (Harry) Hasson*
Co-Founder, 360Fresh.com <https://360Fresh.com>
On 3/5/2012 10:58, Ram wrote:
Hi All,
I did created a MyApplication which implements Application interface.
Then i had a situation to get the port of the connection which received
the message. So I implemented the ConnectionListener interface. When
trying to implement the connectionReceived() method, i could able to
find the method
Thanks
Ram
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel