public object OnRequest(IRequest request) { if (request.Message is ManagementCommand) { ManagementCommand command = request.Message as ManagementCommand; if (command == null) { return(null); } ManagementResponse response = new ManagementResponse(); response.MethodName = command.MethodName; response.Version = command.CommandVersion; response.RequestId = command.RequestId; byte[] arguments = CompactBinaryFormatter.ToByteBuffer(command.Parameters, null); try { response.ResponseMessage = _rpcService.InvokeMethodOnTarget(command.MethodName, command.Overload, GetTargetMethodParameters(arguments)); } catch (System.Exception ex) { response.Exception = ex; } return(response); } else { return(null); } }
protected object ExecuteCommandOnMgtServer(object message, bool Response) { ManagementResponse managementResponse = null; if (_channel != null) { try { managementResponse = _channel.SendMessage(message, !Response) as ManagementResponse; } catch (System.Exception e) { throw new System.Exception(e.Message, e); } if (managementResponse != null && managementResponse.Exception != null) { throw new System.Exception(managementResponse.Exception.Message); } } if (managementResponse != null) { return(managementResponse.ResponseMessage); } return(null); }
protected object ExecuteCommandOnCacehServer(Alachisoft.NCache.Common.Protobuf.ManagementCommand command) { ManagementResponse response = null; if (_requestManager != null) { try { response = _requestManager.SendRequest(command) as ManagementResponse; } catch (System.Exception e) { throw new ManagementException(e.Message,e); } if (response != null && response.exception != null) { throw new ManagementException(response.exception.message); } } if (response != null) return response.ReturnValue; return null; }
protected object ExecuteCommandOnCacehServer(Alachisoft.NCache.Common.Protobuf.ManagementCommand command) { ManagementResponse response = null; if (_requestManager != null) { try { response = _requestManager.SendRequest(command) as ManagementResponse; } catch (System.Exception e) { throw new ManagementException(e.Message, e); } if (response != null && response.exception != null) { if (response.exception.type == Alachisoft.NCache.Common.Protobuf.Exception.Type.CONFIGURATON_EXCEPTION) { throw new VersionException(response.exception.message, response.exception.errorCode); } throw new ManagementException(response.exception.message); } } if (response != null) { return(response.ReturnValue); } return(null); }
protected object ExecuteCommandOnConfigurationServer(Alachisoft.NosDB.Common.Protobuf.ManagementCommands.ManagementCommand command, bool response) { ManagementResponse managementResponse = null; if (_channel != null) { try { managementResponse = _channel.SendMessage(command, response) as ManagementResponse; } catch (System.Exception e) { throw e; } if (managementResponse != null && managementResponse.Exception != null) { throw new System.Exception(managementResponse.Exception.Message); } } if (managementResponse != null) { return(managementResponse.ReturnVal); } return(null); }
public object GetErrorResponse(System.Exception e) { ManagementResponse response = new ManagementResponse(); response.exception = new Common.Protobuf.Exception(); response.exception.exception = e.Message; return(response); }
public async Task <int> insert(ManagementResponse managementResponse) //opis do TypOferty { TypOferty typ = new TypOferty() { Opis = managementResponse.Opis }; await _managementRep.InsertAsync(typ); return((int)typ.IdTypu); }
public static byte[] SerializeManagementExceptionResponse(Exception exc, long requestId) { Alachisoft.NCache.Common.Protobuf.Exception ex = GetExceptionResponse(exc); Alachisoft.NCache.Common.Protobuf.ManagementResponse response = new ManagementResponse(); response.requestId = requestId; response.exception = ex; return(SerializeResponse(response)); }
public async Task <ActionResult> CreateAsync([FromBody] ManagementResponse managementResponse) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var ret = await _magagementServ.insert(managementResponse); return(Ok(ret)); }
public async Task <int> UpdateType(int id, ManagementResponse types) { TypOferty typ = new TypOferty { Opis = types.Opis }; try { await _managementRep.UpdateType(id, typ); } catch (Exception e) { return(-1); } return(id); }
public object Deserialize(byte[] buffer) { ManagementResponse response = null; using (MemoryStream stream = new MemoryStream(buffer)) { response = ProtoBuf.Serializer.Deserialize <ManagementResponse>(stream); } if (response != null) { if (response.returnVal != null) { response.ReturnValue = CompactBinaryFormatter.FromByteBuffer(response.returnVal, null); } } return(response); }
public object OnRequest(IRequest request) { if (request.Message is ManagementCommand) { //ConfigurationProvider.Provider = service; ManagementCommand command = (ManagementCommand)request.Message; ManagementResponse response = new ManagementResponse(); response.MethodName = command.MethodName; response.Version = command.CommandVersion; response.RequestId = command.RequestId; response.ReturnVal = CompactBinaryFormatter.ToByteBuffer(this.ConfigurationProvider.ManagementRpcService.InvokeMethodOnTarget(command.MethodName, command.Overload, GetTargetMethodParameters(CompactBinaryFormatter.ToByteBuffer(command.Parameters, null))), null); return(response); } else { return(new object()); } }
public object OnRequest(IRequest request) { if (request.Message is ManagementCommand) { ManagementCommand command = request.Message as ManagementCommand; if (command == null) { return(null); } ManagementResponse response = new ManagementResponse(); response.MethodName = command.MethodName; response.Version = command.CommandVersion; response.RequestId = command.RequestId; // LoggerManager.Instance.SetThreadContext(new LoggerContext() { ShardName = "shard1", DatabaseName = "database" }); try { byte[] arguements = CompactBinaryFormatter.ToByteBuffer(command.Parameters, null); response.ResponseMessage = ManagementProvider.ManagementRpcService.InvokeMethodOnTarget(command.MethodName, command.Overload, GetTargetMethodParameters(arguements) ); _channel.GetType(); } catch (System.Exception ex) { response.Exception = ex; } return(response); } else { return(null); } }
public async Task <ActionResult> Put(int id, [FromBody] ManagementResponse types) { var ret = await _magagementServ.UpdateType(id, types); return(Ok(ret)); }