title: Implementing a Hl7 parser listener to java
body: <h2>Background</h2>
  
  <p>I'm writing a medical record app for a friend who is a Doctor. I was told to write a listener in the app that awaits HL7 messages. That way a hospital can send out HL7 messages and my listener will catch them. So I came to the HAPI site and viewed <a href="http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/SendAndReceiveAMessage.html" rel="nofollow">this example</a>. What I understand from it is that it's creating a server to listen for a message.</p>
  
  <p>I'm developing this in Eclipse using JSF 2.0 on Tomcat 7.0. Where does one normally put this kind of listener in a project with JSF? I've tried searching online for this answer and found nothing!</p>
  
  <h2>My question</h2>
  
  <p>I know this code goes inside a class. When the class gets called the socket will be "turned on" and it's going to wait for a response. So I want to call this class as soon as the project is deployed. How is that done? How do I call that class only once (when the app is starting) in order to turn on the listener?</p>
  
  <p>Any and all help is greatly appreciated! And if I'm not being clear on something let me know!</p>