public CommandBridge(AgentCore ghost_provider, GhostRequest ghost_request) { RequestQueue = this; ResponseQueue = this; _AgentCore = ghost_provider; _GhostRequest = ghost_request; }
public SoulProvider(IRequestQueue peer, IResponseQueue queue, IProtocol protocol) { _Queue = queue; _Protocol = protocol; _Serialize = protocol.GetSerialize(); _Peer = peer; _Peer.OnInvokeMethodEvent += _InvokeMethod; }
public SoulProvider(IRequestQueue peer, IResponseQueue queue, IProtocol protocol) { _IdLandlord = new IdLandlord(); _Queue = queue; _Protocol = protocol; _EventProvider = protocol.GetEventProvider(); _Serializer = protocol.GetSerialize(); _Peer = peer; _Peer.InvokeMethodEvent += _InvokeMethod; }
public SoulProvider(IRequestQueue peer, IResponseQueue queue, IProtocol protocol) { _WaitValues = new Dictionary <long, IValue>(); _Souls = new System.Collections.Concurrent.ConcurrentDictionary <long, SoulProxy>(); _EventFilter = new Queue <byte[]>(); _IdLandlord = new IdLandlord(); _Queue = queue; _Protocol = protocol; _EventProvider = protocol.GetEventProvider(); _Serializer = protocol.GetSerialize(); _Peer = peer; _Peer.InvokeMethodEvent += _InvokeMethod; }
/// <summary> /// Initializes a new instance of the <see cref="ProcedureScheduler"/> class. /// </summary> /// <param name="responseQueue">Response queue used for sending RPC results back to client</param> /// <param name="typeResolver">Resolver used for converting deserialized JSON object into specific type instances</param> public ProcedureScheduler(IResponseQueue responseQueue, ITypeResolver typeResolver) { Response = responseQueue; TypeResolver = typeResolver; Tasks = new ConcurrentDictionary<string, Task>(); }
/// <summary> /// Initializes a new instance of the <see cref="ProcedureScheduler"/> class. /// </summary> /// <param name="responseQueue">Response queue used for sending RPC results back to client</param> /// <param name="typeResolver">Resolver used for converting deserialized JSON object into specific type instances</param> public ProcedureScheduler(IResponseQueue responseQueue, ITypeResolver typeResolver) { Response = responseQueue; TypeResolver = typeResolver; Tasks = new ConcurrentDictionary <string, Task>(); }
public static void PostOkResponse <T>(this IResponseQueue queue, Guid correlationId, T response) { queue.PostResponse(QueueResponse <T> .Ok(correlationId, response)); }
private async Task ProcessRequestAsynchronously(ActionExecutingContext context, IResponseQueue queue, IServiceScope serviceScope) { try { var controller = serviceScope.ServiceProvider.GetService(context.Controller.GetType()); if (controller == null) { throw new Exception(); } var actionDescriptor = context.ActionDescriptor as ControllerActionDescriptor; if (actionDescriptor == null) { throw new Exception(); } var action = actionDescriptor.MethodInfo; if (action == null) { throw new Exception(); } if (typeof(Task).IsAssignableFrom(action.ReturnType)) { var response = action.Invoke(controller, context.ActionArguments.Values.ToArray()); var responseTask = (Task)response; var result = await GetResult(responseTask); queue.PostOkResponse(Guid.NewGuid(), result); } else { var response = action.Invoke(controller, context.ActionArguments.Values.ToArray()); queue.PostOkResponse(Guid.NewGuid(), response); } } catch (Exception) { } }