Skip to content

Commit

Permalink
rm
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Jun 7, 2021
1 parent 558e9c6 commit 12aea25
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ However, the extension method allows you to write `Action<T>` directly.
public static IDisposable Subscribe<TMessage>(this ISubscriber<TMessage> subscriber, Action<TMessage> handler, params MessageHandlerFilter<TMessage>[] filters)
public static IDisposable Subscribe<TMessage>(this ISubscriber<TMessage> subscriber, Action<TMessage> handler, Func<TMessage, bool> predicate, params MessageHandlerFilter<TMessage>[] filters)
public static IObservable<TMessage> AsObservable<TMessage>(this ISubscriber<TMessage> subscriber, params MessageHandlerFilter<TMessage>[] filters)
public static IAsyncEnumerable<TMessage> AsAsyncEnumerable<TMessage>(this IAsyncSubscriber<TMessage> subscriber, params AsyncMessageHandlerFilter<TMessage>[] filters)
public static ValueTask<TMessage> FirstAsync<TMessage>(this ISubscriber<TMessage> subscriber, CancellationToken cancellationToken, params MessageHandlerFilter<TMessage>[] filters)
public static ValueTask<TMessage> FirstAsync<TMessage>(this ISubscriber<TMessage> subscriber, CancellationToken cancellationToken, Func<TMessage, bool> predicate, params MessageHandlerFilter<TMessage>[] filters)
```
Expand All @@ -462,6 +463,8 @@ Also, the `Func<TMessage, bool>` overload can filter messages by predicate (inte

`AsObservable` can convert message pipeline to `IObservable<T>`, it can handle by Reactive Extensions(in Unity, you can use `UniRx`). `AsObervable` exists in sync subscriber(keyless, keyed, buffered).

`AsAsyncEnumerable` can convert message pipeline to `IAsyncEnumerable<T>`, it can handle by async LINQ and async foreach. `AsAsyncEnumerable` exists in async subscriber(keyless, keyed, buffered).

`FirstAsync` gets the first value of message. It is similar as `AsObservable().FirstAsync()`, `AsObservable().Where().FirstAsync()`. If uses `CancellationTokenSource(TimeSpan)` then similar as `AsObservable().Timeout().FirstAsync()`. Argument of `CancellationToken` is required to avoid task leak.

```csharp
Expand Down Expand Up @@ -889,6 +892,7 @@ public sealed class MessagePipeOptions
AsyncPublishStrategy DefaultAsyncPublishStrategy; // default is Parallel
HandlingSubscribeDisposedPolicy HandlingSubscribeDisposedPolic; // default is Ignore
InstanceLifetime InstanceLifetime; // default is Singleton
InstanceLifetime RequestHandlerLifetime; // default is Scoped
bool EnableAutoRegistration; // default is true
bool EnableCaptureStackTrace; // default is false
Expand All @@ -904,7 +908,7 @@ public enum AsyncPublishStrategy

public enum InstanceLifetime
{
Singleton, Scoped
Singleton, Scoped, Transient
}

public enum HandlingSubscribeDisposedPolicy
Expand Down Expand Up @@ -954,6 +958,10 @@ When `ISubscriber.Subscribe` after MessageBroker(publisher/subscriber manager) i

Configure MessageBroker(publisher/subscriber manager)'s lifetime of DI cotainer. You can choose `Singleton` or `Scoped`. Default is `Singleton`. When choose `Scoped`, each messagebrokers manage different subscribers and when scope is disposed, unsubscribe all managing subscribers.

### RequestHandlerLifetime

Configure IRequestHandler/IAsyncRequestHandler's lifetime of DI cotainer. You can choose `Singleton` or `Scoped` or `Transient`. Default is `Scoped`.

### EnableAutoRegistration/SetAutoRegistrationSearchAssemblies/SetAutoRegistrationSearchTypes

Register `IRequestHandler`, `IAsyncHandler` and filters to DI container automatically on startup. Default is `true` and default search target is CurrentDomain's all assemblies and types. However, this sometimes fails to detect the assembly being stripped. In that case, you can enable the search by explicitly adding it to `SetAutoRegistrationSearchAssemblies` or `SetAutoRegistrationSearchTypes`.
Expand Down

0 comments on commit 12aea25

Please sign in to comment.