|
Running the LLP Components in a Windows ServiceIt often makes good sense to implement an HL7 interface as a Windows service application. This is a non-graphical application that runs in the background. Normally most Windows service applications do not have a built-in message loop. As a consequence of using the Chameleon LLP components, it will be necessary to have a thread in your service running a message loop explicitly. In some frameworks such as the .NET framework, it may be necessary to explicitly spawn a separate thread that the LLP components are created and run on. A typical way to do this is:
This is demonstrated in the following diagram: ![]() Correct Method of Running LLP Components in a Windows Service The RunMessageLoop method is blocking. It will loop around internally, dispatching networking events until a POST_QUIT message is sent to the networking thread. Calling StopMessageLoop on LlpServer or LlpClient will send this message to the objects in the message loop. Typically, the service control manager (SCM) will send a stop request via another thread - this is a good place to invoke the StopMessageLoop method.
![]() Incorrect Method of Running LLP Components in a Windows Service |