コード例 #1
0
        public void Connect()
        {
            if (_proxy == null || (_proxy != null && (_proxy.Channel.State == CommunicationState.Closed || _proxy.Channel.State == CommunicationState.Faulted)))
            {
                if (_proxy != null)
                {
                    _proxy.Dispose();
                }

                _proxy = _infoServiceType.CreateProxy(_server);
                _proxy.OperationTimeout = TimeSpan.FromMinutes(Settings.Default.OperationTimeout);
                _proxy.ChannelFactory.Endpoint.Behaviors.Add(new LogHeaderReaderBehavior());
                _proxy.Open();
            }

            Connection = new InformationServiceConnection((IInformationService)_proxy);
            Connection.Open();

            if (Settings.Default.UseActiveSubscriber && _infoServiceType.SupportsActiveSubscriber)
            {
                _notificationDeliveryServiceProxy = _infoServiceType.CreateNotificationDeliveryServiceProxy(_server, NotificationSubscriber);
                _notificationDeliveryServiceProxy.Open();
                _activeSubscriberAddress = string.Format("active://{0}/SolarWinds/SwqlStudio/{1}", Utility.GetFqdn(), Process.GetCurrentProcess().Id);
                _notificationDeliveryServiceProxy.ReceiveIndications(_activeSubscriberAddress);
                _activeSubscriberInfo = new SubscriberInfo()
                {
                    EndpointAddress    = _activeSubscriberAddress,
                    OpenedSuccessfully = true,
                    DataFormat         = "Xml"
                };
            }
        }
コード例 #2
0
ファイル: OrionInfoService.cs プロジェクト: willyd61/OrionSDK
        public override NotificationDeliveryServiceProxy CreateNotificationDeliveryServiceProxy(string server, INotificationSubscriber notificationSubscriber)
        {
            var endpointAddress = new EndpointAddress(string.Format("net.tcp://{0}:17777/SolarWinds/InformationService/v3/Orion/IndicationDelivery", server));
            var context         = new InstanceContext(notificationSubscriber);

            var proxy = new NotificationDeliveryServiceProxy(context, (NetTcpBinding)_binding, endpointAddress);

            _credentials.ApplyTo(proxy.ChannelFactory);

            return(proxy);
        }