private static object InvokeWithStreamEnumerable( IMessageStreamProvider messageStreamProvider, SubscribedMethod subscribedMethod, object?[] arguments, IStreamEnumerableMessageArgumentResolver streamEnumerableResolver, IServiceProvider serviceProvider) { var target = subscribedMethod.ResolveTargetType(serviceProvider); var lazyStream = streamEnumerableResolver.GetValue( messageStreamProvider, subscribedMethod.MessageType, subscribedMethod.Filters); return(Task.Run( async() => { try { await lazyStream.WaitUntilCreatedAsync().ConfigureAwait(false); arguments[0] = lazyStream.Value; } catch (OperationCanceledException) { return; } await subscribedMethod.MethodInfo.InvokeWithActivityWithoutBlockingAsync( target, arguments) .ConfigureAwait(false); })); }
/// <inheritdoc cref="IStreamEnumerableMessageArgumentResolver.GetValue" /> public ILazyArgumentValue GetValue( IMessageStreamProvider streamProvider, Type targetMessageType, IReadOnlyCollection <IMessageFilter>?filters = null) { Check.NotNull(streamProvider, nameof(streamProvider)); return((ILazyArgumentValue)streamProvider.CreateLazyStream(targetMessageType, filters)); }
/// <inheritdoc cref="IStreamEnumerableMessageArgumentResolver.GetValue" /> public ILazyArgumentValue GetValue(IMessageStreamProvider streamProvider, Type targetMessageType) { Check.NotNull(streamProvider, nameof(streamProvider)); _createObservableMethodInfo ??= GetType().GetMethod( "CreateObservable", BindingFlags.Static | BindingFlags.NonPublic); return((ILazyArgumentValue)_createObservableMethodInfo ! .MakeGenericMethod(targetMessageType) .Invoke(this, new object[] { streamProvider.CreateLazyStream(targetMessageType) })); }
/// <inheritdoc cref="IStreamEnumerableMessageArgumentResolver.GetValue" /> public ILazyArgumentValue GetValue(IMessageStreamProvider streamProvider, Type targetMessageType) { Check.NotNull(streamProvider, nameof(streamProvider)); return((ILazyArgumentValue)streamProvider.CreateLazyStream(targetMessageType)); }
public async Task <IReadOnlyCollection <Task> > PublishAsync(IMessageStreamProvider streamProvider) => await _publisher.PublishAsync <Task>(streamProvider).ConfigureAwait(false);
public IReadOnlyCollection <Task> Publish(IMessageStreamProvider streamProvider) => _publisher.Publish <Task>(streamProvider);