public RemoveTopicCommand(string topicName, bool forcefully) { name = "RemoveTopicCommand"; _removeTopicCommand = new Common.Protobuf.RemoveTopicCommand(); _removeTopicCommand.topicName = topicName; _removeTopicCommand.forcefully = forcefully; }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); int overload = 1; string exceptionMessage = null; bool result = false; try { NCache nCache = clientManager.CmdExecuter as NCache; var operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); if (command.commandVersion < 1) { operationContext.Add(OperationContextFieldName.ClientLastViewId, forcedViewId); } else { operationContext.Add(OperationContextFieldName.ClientLastViewId, command.clientLastViewId.ToString(CultureInfo.InvariantCulture)); } if (nCache != null) { _command = command.removeTopicCommand; TopicOperation topicOperation = new TopicOperation(_command.topicName, TopicOperationType.Remove); result = nCache.Cache.TopicOpertion(topicOperation, operationContext); Common.Protobuf.Response response = new Common.Protobuf.Response(); Common.Protobuf.RemoveTopicResponse removeTopicResponse = new Common.Protobuf.RemoveTopicResponse(); response.requestId = _command.requestId; response.commandID = command.commandID; removeTopicResponse.success = result; response.responseType = Common.Protobuf.Response.Type.REMOVE_TOPIC; response.removeTopicResponse = removeTopicResponse; _serializedResponsePackets.Add(ResponseHelper.SerializeResponse(response)); } } catch (Exception exc) { exceptionMessage = exc.ToString(); _serializedResponsePackets.Add(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) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.DeleteTopic); log.GenerateGetCreateOrDeleteTopicAPILogItem(_command.topicName, executionTime, clientManager.ClientID, clientManager.ClientIP, overload, result, exceptionMessage); } } catch { } } }
public override void ExecuteCommand(ClientManager clientManager, Common.Protobuf.Command command) { System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); int overload = 1; string exceptionMessage = null; bool result = false; try { NCache nCache = clientManager.CmdExecuter as NCache; var operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); if (command.commandVersion < 1) { operationContext.Add(OperationContextFieldName.ClientLastViewId, forcedViewId); } else { operationContext.Add(OperationContextFieldName.ClientLastViewId, command.clientLastViewId.ToString(CultureInfo.InvariantCulture)); } CommandsUtil.PopulateClientIdInContext(ref operationContext, clientManager.ClientAddress); if (nCache != null) { _command = command.removeTopicCommand; TopicOperation topicOperation = new TopicOperation(_command.topicName, TopicOperationType.Remove); result = nCache.Cache.TopicOpertion(topicOperation, operationContext); stopWatch.Stop(); Common.Protobuf.RemoveTopicResponse removeTopicResponse = new Common.Protobuf.RemoveTopicResponse(); if (clientManager.ClientVersion >= 5000) { Common.Util.ResponseHelper.SetResponse(removeTopicResponse, command.requestID, command.commandID); _serializedResponsePackets.Add(Common.Util.ResponseHelper.SerializeResponse(removeTopicResponse, Common.Protobuf.Response.Type.REMOVE_TOPIC)); } else { //PROTOBUF:RESPONSE Common.Protobuf.Response response = new Common.Protobuf.Response(); response.removeTopicResponse = removeTopicResponse; Common.Util.ResponseHelper.SetResponse(response, command.requestID, command.commandID, Common.Protobuf.Response.Type.REMOVE_TOPIC); _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } } } catch (Exception exc) { exceptionMessage = exc.ToString(); _serializedResponsePackets.Add(ResponseHelper.SerializeExceptionResponseWithType(exc, command.requestID, command.commandID, clientManager.ClientVersion)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { APILogItemBuilder log = new APILogItemBuilder(MethodsName.DeleteTopic); log.GenerateGetCreateOrDeleteTopicAPILogItem(_command.topicName, executionTime, clientManager.ClientID, clientManager.ClientIP, overload, result, exceptionMessage); // Hashtable expirationHint = log.GetDependencyExpirationAndQueryInfo(cmdInfo.ExpirationHint, cmdInfo.queryInfo); } } catch { } } }