Beispiel #1
0
        private void Connect(string appName, int addpClientTimeout, int addpServerTimeout, string addpTrace)
        {
            configServerId          = CConfServerIdentifier + Guid.NewGuid();
            confServerConfiguration = new ConfServerConfiguration(configServerId)
            {
                Uri                 = new Uri(configServerPrimaryUri),
                ClientName          = appName,
                UserName            = "",
                UserPassword        = "",
                WarmStandbyUri      = new Uri(configServerBackupUri),
                WarmStandbyAttempts = 5,
                UseAddp             = true,
                AddpClientTimeout   = addpClientTimeout,
                AddpServerTimeout   = addpServerTimeout,
                AddpTrace           = addpTrace
            };


            protocolManagementService = new ProtocolManagementService();
            protocolManagementService.ProtocolOpened += OnProtocolOpened;
            protocolManagementService.ProtocolClosed += OnProtocolClosed;
            protocolManagementService.Register(confServerConfiguration);

            eventBrokerService  = BrokerServiceFactory.CreateEventBroker(protocolManagementService.Receiver);
            confServiceContract = ConfServiceFactory.CreateConfService(protocolManagementService[configServerId], eventBrokerService);
            confServiceContract.Register(OnConfEvent);

            protocolManagementService.BeginOpen();
        }
Beispiel #2
0
        private static void InitializePSDKApplicationBlocks()
        {
            // Setup Application Blocks:

            // Create Protocol Manager Service object
            protocolManagementService = new ProtocolManagementService();

            // Create and initialize connection configuration object for TServer.
            confServerConfiguration = new ConfServerConfiguration(CONFIGSERVER_IDENTIFIER);

            var ConfServerURI = WebConfigurationManager.AppSettings["CfgServer.URI"];
            var ClientName    = WebConfigurationManager.AppSettings["CfgServer.ClientName"];
            var UserName      = WebConfigurationManager.AppSettings["CfgServer.UserName"];
            var UserPassword  = WebConfigurationManager.AppSettings["CfgServer.UserPassword"];

            // Set required values
            try
            {
                confServerConfiguration.Uri = new Uri(ConfServerURI);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message, ex);
            }

            confServerConfiguration.ClientName   = ClientName;
            confServerConfiguration.UserName     = UserName;
            confServerConfiguration.UserPassword = UserPassword;


            if (System.Web.Configuration.WebConfigurationManager.AppSettings["CfgServer.HASupport"] == "1")
            {
                var uriBakup = System.Web.Configuration.WebConfigurationManager.AppSettings["CfgServer.URI_BAKUP"];
                confServerConfiguration.WarmStandbyAttempts = 3;
                confServerConfiguration.WarmStandbyTimeout  = 3000;
                confServerConfiguration.WarmStandbyUri      = new Uri(uriBakup);
                confServerConfiguration.FaultTolerance      = FaultToleranceMode.WarmStandby;
            }

            // Register this connection configuration with Protocol Manager
            protocolManagementService.Register(confServerConfiguration);

            protocolManagementService.ProtocolOpened += new EventHandler <ProtocolEventArgs>(OnProtocolOpened);
            protocolManagementService.ProtocolClosed += new EventHandler <ProtocolEventArgs>(OnProtocolClosed);

            // Create and Initialize Message Broker Application Block
            eventBrokerService = new EventBrokerService(protocolManagementService.Receiver);

            // Activate event broker service
            eventBrokerService.Activate();

            confService = ConfServiceFactory.CreateConfService(
                protocolManagementService[CONFIGSERVER_IDENTIFIER],
                eventBrokerService);

            eventBrokerService.Register(
                eventConfServerEventsHandler,
                new MessageFilter(protocolManagementService[CONFIGSERVER_IDENTIFIER].ProtocolId));
        }
Beispiel #3
0
 /// <summary>
 /// Creates the specified server protocol configuration.
 /// Use this method for FaultTolerance : None & HotStandby
 /// </summary>
 /// <param name="uri">Server uri.</param>
 /// <param name="appType">Type of the application.</param>
 /// <param name="userName">Name of the application user.</param>
 /// <param name="password">user's password.</param>
 /// <param name="faultTolerance">The fault tolerance mode.</param>
 public void Create(Uri serverUri, CfgAppType appType, string clientName, string userName, string password, FaultToleranceMode faultTolerance)
 {
     Protocolconfiguration     = null;
     Protocolconfiguration     = new ConfServerConfiguration(ServerType.Configserver.ToString());
     Protocolconfiguration.Uri = serverUri;
     Protocolconfiguration.ClientApplicationType = appType;
     Protocolconfiguration.ClientName            = clientName;
     Protocolconfiguration.UserName       = userName;
     Protocolconfiguration.UserPassword   = password;
     Protocolconfiguration.FaultTolerance = faultTolerance;
 }
Beispiel #4
0
 /// <summary>
 /// Creates the specified server protocol configuration.
 /// Use this method for FaultTolerance : WarmStandby
 /// Warm standby switch over is set to unlimited time.
 /// </summary>
 /// <param name="uri">Server uri.</param>
 /// <param name="appType">Type of the application.</param>
 /// <param name="userName">Name of the application user.</param>
 /// <param name="password">user's password.</param>
 /// <param name="warmStandbyUri">Warm standby URI.</param>
 /// <param name="warmStandByTimeOut">Warm stand by time out.</param>
 /// <param name="warmStandByAttempts">Warm stand by attempts.</param>
 public void Create(Uri serverUri, CfgAppType appType, string clientName, string userName, string password, Uri warmStandbyUri, Int32 warmStandByTimeOut, Int16 warmStandByAttempts)
 {
     Protocolconfiguration     = null;
     Protocolconfiguration     = new ConfServerConfiguration(ServerType.Configserver.ToString());
     Protocolconfiguration.Uri = serverUri;
     Protocolconfiguration.ClientApplicationType = appType;
     Protocolconfiguration.ClientName            = clientName;
     Protocolconfiguration.UserName            = userName;
     Protocolconfiguration.UserPassword        = password;
     Protocolconfiguration.FaultTolerance      = FaultToleranceMode.WarmStandby;
     Protocolconfiguration.WarmStandbyUri      = warmStandbyUri;
     Protocolconfiguration.WarmStandbyTimeout  = warmStandByTimeOut;
     Protocolconfiguration.WarmStandbyAttempts = warmStandByAttempts;
 }
Beispiel #5
0
 /// <summary>
 /// Creates the specified server protocol configuration.
 /// Use this method for FaultTolerance : None & HotStandby
 /// </summary>
 /// <param name="serverUri">The server URI.</param>
 /// <param name="appType">Type of the application.</param>
 /// <param name="userName">Name of the user.</param>
 /// <param name="password">user's password.</param>
 /// <param name="faultTolerance">The fault tolerance.</param>
 /// <param name="addpServerTimeOut">Addp server time out.</param>
 /// <param name="addpClientTimeOut">Addp client time out.</param>
 /// <param name="addpTrace">Addp trace mode.</param>
 public void Create(Uri serverUri, CfgAppType appType, string clientName, string userName, string password, FaultToleranceMode faultTolerance, Int32 addpServerTimeOut, Int32 addpClientTimeOut,
                    AddpTraceMode addpTrace)
 {
     Protocolconfiguration     = null;
     Protocolconfiguration     = new ConfServerConfiguration(ServerType.Configserver.ToString());
     Protocolconfiguration.Uri = serverUri;
     Protocolconfiguration.ClientApplicationType = appType;
     Protocolconfiguration.ClientName            = clientName;
     Protocolconfiguration.UserName          = userName;
     Protocolconfiguration.UserPassword      = password;
     Protocolconfiguration.FaultTolerance    = faultTolerance;
     Protocolconfiguration.UseAddp           = true;
     Protocolconfiguration.AddpServerTimeout = addpServerTimeOut;
     Protocolconfiguration.AddpClientTimeout = addpClientTimeOut;
     Protocolconfiguration.AddpTrace         = addpTrace.ToString();
 }
Beispiel #6
0
 /// <summary>
 /// Creates the specified server types.
 /// </summary>
 public void Create()
 {
     Protocolconfiguration = null;
     Protocolconfiguration = new ConfServerConfiguration(ServerType.Configserver.ToString());
 }