Ejemplo n.º 1
0
 public NotificationsVo(NotificationsType notificationsType, object data)
     : this(data, notificationsType.ToString(), (int)notificationsType, "")
 {
 }
Ejemplo n.º 2
0
 public NotificationsVo(NotificationsType notificationsType)
     : this(notificationsType.ToString(), (int)notificationsType)
 {
 }
Ejemplo n.º 3
0
        //PROTOBUF

        public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command)
        {
            CommandInfo       cmdInfo;
            int               overload;
            string            exception = null;
            NotificationsType notif     = 0;

            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            try
            {
                overload = command.MethodOverload;
                stopWatch.Start();
                cmdInfo = ParseCommand(command, clientManager);
            }
            catch (Exception exc)
            {
                if (!base.immatureId.Equals("-2"))
                {
                    _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID));
                }
                return;
            }

            try
            {
                NCache nCache = clientManager.CmdExecuter as NCache;
                notif = (NotificationsType)cmdInfo.RegNotifs;
                // Will only register those which are == null i.e. not initialized
                nCache.RegisterNotification(notif);

                if ((notif & NotificationsType.RegAddNotif) != 0 || (notif & NotificationsType.RegUpdateNotif) != 0 || (notif & NotificationsType.RegRemoveNotif) != 0)
                {
                    nCache.MaxEventRequirement((Runtime.Events.EventDataFilter)cmdInfo.datafilter, notif, (short)cmdInfo.sequence);
                }
                stopWatch.Stop();

                //PROTOBUF:RESPONSE
                Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response();
                Alachisoft.NCache.Common.Protobuf.RegisterNotifResponse registerNotifResponse = new Alachisoft.NCache.Common.Protobuf.RegisterNotifResponse();
                response.requestId             = Convert.ToInt64(cmdInfo.RequestId);
                response.commandID             = command.commandID;
                response.responseType          = Alachisoft.NCache.Common.Protobuf.Response.Type.REGISTER_NOTIF;
                response.registerNotifResponse = registerNotifResponse;
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response));
            }
            catch (Exception exc)
            {
                _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID));
            }
            finally
            {
                TimeSpan executionTime = stopWatch.Elapsed;
                try
                {
                    if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging)
                    {
                        string methodNme = null;

                        if (notif == NotificationsType.UnregAddNotif || notif == NotificationsType.UnregAddNotif || notif == NotificationsType.UnregRemoveNotif)
                        {
                            methodNme = MethodsName.UnRegisterCacheNotification.ToLower();
                        }
                        else
                        {
                            methodNme = MethodsName.RegisterCacheNotification.ToLower();
                        }
                        APILogItemBuilder log = new APILogItemBuilder(methodNme);
                        log.GenerateRegisterCacheNotificationCallback(0, notif.ToString(), cmdInfo.datafilter.ToString(), overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString());
                    }
                }
                catch
                {
                }
            }
        }