/// <summary> /// This is the key call where you will define parameters for the Master host startup, and call /// the base 'startService' method. /// </summary> public void startUp() { ConfigUtility.setAzureRuntime(true); //First we will create a list to hold our runtime-created endpoint behavior. Note we could also simply //use config to define, and select via ConfigWeb on the endpoint (HostedService) definition, this is an //alternate mechanism to provide via code as an example. List<object> endpointBehaviors = new List<object>(); //Now we will construct (and add to our list) an endpoint behavior, in this case a TransactedBatchingBehavior. This behavior //will be applied to the MSMQ endpoint, and allows .NET to process multiple entries from the queue as part of //a single distributed transaction---a performance benefit that must be balanced against potential database concurrency issues //if set too high. endpointBehaviors.Add(new TransactedBatchingBehavior(5)); endpointBehaviorList = new EndPointBehaviors(endpointBehaviors, null); //Now the key call to create our list of runtime hosts to be initialized. startupList = new List<ServiceHostInfo>(new ServiceHostInfo[] { new ServiceHostInfo(false, null, new object[] { new Trade.OrderProcessorImplementation.ErrorBehaviorAttribute() }, new OrderProcessor()) }); //Stock call to startup the Master Host. base.startNTService(new Settings(), new ConfigurationService(), new NodeCommunication(), null, new ConfigurationActions(), startupList, endpointBehaviorList, new object[] { typeof(IOrderProcessor) }); }
/// <summary> /// This constructor calls the base constructor, and starts up all services and initializes the Windows Form. /// </summary> /// <param name="theSettingsInstance">An instance of the Settings class for the app.</param> /// <param name="theConfigurationService">An instance of the configuration service implementation class for the app/service.</param> /// <param name="theNodeService">An instance of the Node Service/implementation class</param> /// <param name="theNodeDcService">An instance of the Node DC Service/implementation class.</param> /// <param name="theConfigurationActions">An instance of ConfigurationActions class for the app</param> /// <param name="startupList">List of hosts to startup.</param> /// <param name="endpointBehaviors">Any endpoint behaviors specified in code.</param> /// <param name="connectedServiceContracts">List of contracts for services this host will consume.</param> /// <param name="bannerImageResourceName">You can provide a custom banner, which should be defined as an embedded resource within visual studio</param> public OrderProcessorServiceConsole(object theSettingsInstance, object theConfigurationService, object theNodeService, object theNodeDcService, object theConfigurationActions, List<ServiceHostInfo> startupList, EndPointBehaviors endpointBehaviors, object[] connectedServiceContracts, string bannerImageResourceName) : base(theSettingsInstance, theConfigurationService, theNodeService, theNodeDcService, theConfigurationActions, startupList, endpointBehaviors, connectedServiceContracts, bannerImageResourceName) { }