When starting the framework you simply use the MLLPListenerManager class to configure the instance. From here you can add listeners to the framework then start them.
  • Configuring the framework:

MLLPListenerManager.Instance.Configure();

  • Adding listeners:

var applicationName = row["Application Name"];
                var portName = row["Port Name"];
                var messageProcessor = row["Message Processor"];

                var applicationSettings = HL7TestConfiguration.Current.ApplicationsToStub.Get(applicationName, portName);
                if(applicationSettings == null)
                {
                    throw new ApplicationException(string.Format("There is no application configuration for: Application Name = {0}, Port Name = {1}", applicationName, portName));
                }
                

                var processorType = Type.GetType(messageProcessor);
                var processor = Activator.CreateInstance(processorType);
                var myProcessor = processor as AppFx.HL7.Testing.Utilities.IMessageProcessor;
                if (myProcessor == null)
                    throw new ApplicationException("The processor is not the right type");

                var listenerName = string.Format("{0}-{1}", applicationName, portName);
                MLLPListenerManager.Instance.AddStandardLocalListener(listenerName, applicationSettings.Port, myProcessor);

  • Starting the listeners:
MLLPListenerManager.Instance.Start();


Last edited Apr 21, 2014 at 12:45 AM by michaelstephenson, version 2