public IProvidedMethodReference CreateProvidedMethodReference(IProvidedServiceReference providedService, string methodId) { var obj = ProvidedMethodReference.Rent(); obj.ProvidedService = providedService; obj.MethodId = methodId; return(obj); }
private static ProvidedMethodReference ConvertToProtoStrict(IProvidedMethodReference obj) { var proto = ProvidedMethodReference.Rent(); proto.ProvidedService = ConvertToProtoStrict(obj.ProvidedService); proto.MethodId = obj.MethodId.ConvertToProtoStrict(); return(proto); }
internal DiscoveredMethod( ProvidedMethodReference providedMethod, Maybe <string> title, string inputMessageId, string outputMessageId, MethodType type) : this(providedMethod, title, inputMessageId, outputMessageId, type, new MethodCallDescriptor(providedMethod)) { }
private void SubscribeToApplicationLaunchedEventStream(string applicationId, UniqueId connectionId) { var appLauncherServiceId = AppLauncherService.Id; var appLaunchedEventStreamMethodId = AppLauncherService.AppLaunchedEventStreamMethodId; var methodCallDescriptor = ProvidedMethodReference.CreateWithConnectionId(appLauncherServiceId, appLaunchedEventStreamMethodId, applicationId, connectionId); _lifecycleManagerClientRepo.GetClientObservable() .Subscribe(client => SubscribeToLaunchedEventStream(client, connectionId, applicationId, methodCallDescriptor)); }
internal DiscoveredOnlineMethod( ProvidedMethodReference providedMethod, Maybe <string> title, string inputMessageId, string outputMessageId, MethodType type) : base( providedMethod, title, inputMessageId, outputMessageId, type) { ProviderConnectionId = providedMethod.ProvidedService.ConnectionId.Value; }
internal DiscoveredMethod( ProvidedMethodReference providedMethod, Maybe <string> title, string inputMessageId, string outputMessageId, MethodType type, MethodCallDescriptor callDescriptor) { ProvidedMethod = providedMethod; Title = title; InputMessageId = inputMessageId; OutputMessageId = outputMessageId; Type = type; CallDescriptor = callDescriptor; }
private void SubscribeToApplicationLaunchedEventStream(string applicationId, UniqueId connectionId) { var appLauncherServiceId = AppLauncherService.Id; var appLaunchedEventStreamMethodId = AppLauncherService.AppLaunchedEventStreamMethodId; var methodCallDescriptor = ProvidedMethodReference.Create(appLauncherServiceId, appLaunchedEventStreamMethodId, applicationId, connectionId); Task.Factory.StartNew(async() => { Log.Info($"Subscribing to ApplicationLaunchedEventStream of {connectionId} application ({applicationId})"); await _client.Value.CallInvoker .CallServerStreaming <Empty, AppLaunchedEvent>(methodCallDescriptor.CallDescriptor, new Empty()) .ResponseStream.PipeAsync(_appLaunchedSubject).ConfigureAwait(false); Log.Info($"Subscription to ApplicationLaunchedEventStream of {connectionId} application ({applicationId}) have finished"); }, TaskCreationOptions.LongRunning); }
public async ValueTask <UniqueId> LaunchAsync(string appId) { Log.Info("Launching {0}", appId); if (string.Equals(appId, "interop.NativeAppLauncher")) { return((await _startNativeAppLauncherTask.Value.ConfigureAwait(false)).Id); } var appDto = _appsDto.Apps.FirstOrDefault(x => string.Equals(x.Id, appId)); if (appDto == null) { throw new InvalidOperationException($"The requested application {appId} is not defined in application registry"); } if (string.IsNullOrEmpty(appDto.LauncherId)) { throw new InvalidOperationException($"Launcher is not defined for application {appId}"); } var launchMethodReference = ProvidedMethodReference.Create("interop.AppLauncherService", "Launch", appDto.LauncherId); var response = await _client .CallUnary <AppLaunchRequest, AppLaunchResponse>( launchMethodReference.CallDescriptor, new AppLaunchRequest { AppId = appId, LaunchParamsJson = appDto.LauncherParams.ToString() }) .ConfigureAwait(false); var appInstanceId = UniqueId.FromHiLo(response.AppInstanceId.Hi, response.AppInstanceId.Lo); Log.Info("Launched app {0} instance {1}", appId, appInstanceId); return(appInstanceId); }
private IProvidedMethodReference ConvertFromProtoStrict(ProvidedMethodReference proto) { return(_messageFactory.CreateProvidedMethodReference( ConvertFromProtoStrict(proto.ProvidedService), proto.MethodId.ConvertFromProtoStrict())); }
public MethodCallDescriptor(ProvidedMethodReference method) : this(default, method) { }
private void SubscribeToLaunchedEventStream(AppLifecycleManagerClient client, UniqueId connectionId, string applicationId, ProvidedMethodReference methodCallDescriptor) { Task.Factory.StartNew(async() => { Log.Info($"Subscribing client '{client.ApplicationInstanceId}' to ApplicationLaunchedEventStream of {connectionId} application ({applicationId})"); await client.CallInvoker .CallServerStreaming <Empty, AppLaunchedEvent>(methodCallDescriptor.CallDescriptor, new Empty()) .ResponseStream.PipeAsync(_appLaunchedEventConsumer.AppLaunchedEventObserver).ConfigureAwait(false); Log.Info($"Subscription to ApplicationLaunchedEventStream of {connectionId} application ({applicationId}) have finished"); }, TaskCreationOptions.LongRunning); }