public Boolean ConnectToLca() { Boolean result = false; try { if (!IsConnectedToLca()) { TpsLogManager <MessageServer> .Info("Connecting to Local Control Agent..."); _localControlAgentProtocol = new LocalControlAgentProtocol(lCAPort) { ClientName = applicationName, ExecutionMode = ApplicationExecutionMode.Backup, ControlStatus = (int)ApplicationStatus.Initializing, Timeout = new TimeSpan(0, 0, _lcaTimeout) }; //TpsLogManager<MessageServer>.Info("Initialising Local Control Agent parameters"); _mEventBroker = BrokerServiceFactory.CreateEventBroker(_localControlAgentProtocol); _mEventBroker.Register(OnEventChangeExecutionMode, new MessageIdFilter(EventChangeExecutionMode.MessageId)); _localControlAgentProtocol.Open(); TpsLogManager <MessageServer> .Info("Connected to Local Control Agent."); } result = true; } catch (Exception e) { TpsLogManager <MessageServer> .Error(e.Message); } return(result); }
public void InitializePSDKApplicationBlocks() { protocolManagementService = new ProtocolManagementService(); isConfiguration = new InteractionServerConfiguration(ISERVER_IDENTIFIER); try { isConfiguration.Uri = new Uri(ISERVER_URI); } catch (Exception ex) { LogException(ex); } isConfiguration.ClientName = CLIENT_NAME; isConfiguration.ClientType = InteractionClient.AgentApplication; protocolManagementService.Register(isConfiguration); protocolManagementService.ProtocolOpened += new EventHandler <ProtocolEventArgs>(this.OnProtocolOpened); protocolManagementService.ProtocolClosed += new EventHandler <ProtocolEventArgs>(this.OnProtocolClosed); eventBrokerService = new EventBrokerService(protocolManagementService.Receiver); eventBrokerService.Register( IServerEventsHandler, new MessageFilter(protocolManagementService[ISERVER_IDENTIFIER].ProtocolId)); // Activate event broker service eventBrokerService.Activate(); protocolManagementService[ISERVER_IDENTIFIER].Opened += MediaCall_Opened; protocolManagementService[ISERVER_IDENTIFIER].Closed += MediaCall_Closed; }
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)); }
private void InitializePSDKApplicationBlocks() { // Setup Application Blocks: // Create Protocol Manager Service object protocolManagementService = new ProtocolManagementService(); // Create and initialize connection configuration object for TServer. outboundServerConfiguration = new OutboundServerConfiguration(OCS_IDENTIFIER); // Set required values try { outboundServerConfiguration.Uri = new Uri(OCS_URI); } catch (Exception ex) { Console.Write(ex.Message + "\n" + ex.StackTrace + "\n"); } outboundServerConfiguration.ClientName = CLIENT_NAME; // Register this connection configuration with Protocol Manager protocolManagementService.Register(outboundServerConfiguration); protocolManagementService.ProtocolOpened += new EventHandler <ProtocolEventArgs>(this.OnProtocolOpened); protocolManagementService.ProtocolClosed += new EventHandler <ProtocolEventArgs>(this.OnProtocolClosed); // Create and Initialize Message Broker Application Block eventBrokerService = new EventBrokerService(protocolManagementService.Receiver); eventBrokerService.Register( OutboundServerEventsHandler, new MessageFilter(protocolManagementService[OCS_IDENTIFIER].ProtocolId)); // Activate event broker service eventBrokerService.Activate(); }