private void HandleInvokeCapability(byte[] requester, Guid requesterIdentity, CapabilityInfo info, string requestContentJson) { _registry.Get(info.Name) .Just(capability => { InvokeCapability(requester, requesterIdentity, capability, requestContentJson); }) .Nothing(() => { ErrorMessageSender.SendError(requester, _router, ErrorCode.RequestDenied); }); }
private void InvokeCapability(byte[] destination, Guid requesterIdentity, ICapability capability, string arguments) { try { var encryptor = _negotiator.GetEncryptorFor(requesterIdentity); var response = ResponseCreator.Create(encryptor, destination, MessageType.CapabilityInvocationResult, capability.Invoke(arguments)); _router.SendMultipartMessage(response); } catch (Exception) { ErrorMessageSender.SendError(destination, _router, ErrorCode.InvocationError); } }
private void HandleGetCapability(byte[] requester, Guid requesterIdentity, CapabilityInfo info) { _registry.Get(info.Name) .Just(capability => { GrantCapability(requesterIdentity, requester, info); }) .Nothing(() => { ErrorMessageSender.SendError(requester, _router, ErrorCode.RequestDenied); }); }