Woopsa.WoopsaSubscriptionServiceImplementation.UnregisterSubscription C# (CSharp) Method

UnregisterSubscription() public method

public UnregisterSubscription ( int subscriptionChannel, int subscriptionId ) : bool
subscriptionChannel int
subscriptionId int
return bool
        public bool UnregisterSubscription(int subscriptionChannel, int subscriptionId)
        {
            int channelId = subscriptionChannel;
            lock (_channels)
                if (_channels.ContainsKey(channelId))
                    return _channels[channelId].UnregisterSubscription(subscriptionId);
                else
                    // if the channel does not exist anymore, unregistration is considered successful
                    return true;
        }

Usage Example

コード例 #1
0
        public WoopsaSubscriptionService(WoopsaServer server, WoopsaContainer container)
            : base(container, WoopsaSubscriptionServiceConst.WoopsaServiceSubscriptionName)
        {
            _server = server;
            _subscriptionServiceImplementation = new WoopsaSubscriptionServiceImplementation(container, true);
            _subscriptionServiceImplementation.BeforeWoopsaModelAccess +=
                (sender, e) => { server.ExecuteBeforeWoopsaModelAccess(); };
            _subscriptionServiceImplementation.AfterWoopsaModelAccess +=
                (sender, e) => { server.ExecuteAfterWoopsaModelAccess(); };
            MethodCreateSubscriptionChannel = new WoopsaMethod(
                this,
                WoopsaSubscriptionServiceConst.WoopsaCreateSubscriptionChannel,
                WoopsaValueType.Integer,
                new WoopsaMethodArgumentInfo[] { new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaNotificationQueueSize, WoopsaValueType.Integer) },
                arguments => _subscriptionServiceImplementation.CreateSubscriptionChannel(arguments[0].ToInt32())
            );

            MethodRegisterSubscription = new WoopsaMethod(
                this,
                WoopsaSubscriptionServiceConst.WoopsaRegisterSubscription,
                WoopsaValueType.Integer,
                new WoopsaMethodArgumentInfo[] {
                    new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaSubscriptionChannel, WoopsaValueType.Integer),
                    new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaPropertyLink, WoopsaValueType.WoopsaLink),
                    new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaMonitorInterval, WoopsaValueType.TimeSpan),
                    new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaPublishInterval, WoopsaValueType.TimeSpan)
                },
                arguments =>
                {
                    return _subscriptionServiceImplementation.RegisterSubscription(
                        arguments[0].ToInt32(), arguments[1].DecodeWoopsaLocalLink(),
                        arguments[2].ToTimeSpan(), arguments[3].ToTimeSpan());
                });

            MethodUnregisterSubscription = new WoopsaMethod(
                this,
                WoopsaSubscriptionServiceConst.WoopsaUnregisterSubscription,
                WoopsaValueType.Logical,
                new WoopsaMethodArgumentInfo[] {
                    new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaSubscriptionChannel, WoopsaValueType.Integer),
                    new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaSubscriptionId, WoopsaValueType.Integer)
                },
                arguments =>
                {
                    return _subscriptionServiceImplementation.UnregisterSubscription(
                        arguments[0].ToInt32(), arguments[1].ToInt32());
                });

            MethodWaitNotification = new WoopsaMethod(
                this,
                WoopsaSubscriptionServiceConst.WoopsaWaitNotification,
                WoopsaValueType.JsonData,
                new WoopsaMethodArgumentInfo[] {
                    new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaSubscriptionChannel, WoopsaValueType.Integer),
                    new WoopsaMethodArgumentInfo(WoopsaSubscriptionServiceConst.WoopsaLastNotificationId, WoopsaValueType.Integer)
                },
                arguments =>
                {
                    using (var accessFreeSection = _server.EnterModelAccessFreeSection())
                        return new WoopsaValue(_subscriptionServiceImplementation.WaitNotification(
                            arguments[0].ToInt32(), arguments[1].ToInt32()));
                });
        }
All Usage Examples Of Woopsa.WoopsaSubscriptionServiceImplementation::UnregisterSubscription