コード例 #1
0
 public static void Subscribe <T>(this ICaraBus caraBus, Action <T> handler, SubscribeOptions options = null) where T : class
 {
     caraBus.SubscribeAsync(typeof(T), (message, token) =>
     {
         handler((T)message);
         return(Task.CompletedTask);
     }, options).ConfigureAwait(false).GetAwaiter().GetResult();
 }
コード例 #2
0
 public static void Subscribe(this ICaraBus caraBus, Type messageType, Action <object> handler, SubscribeOptions options = null)
 {
     caraBus.SubscribeAsync(messageType, (message, token) =>
     {
         handler(message);
         return(Task.CompletedTask);
     }, options).ConfigureAwait(false).GetAwaiter().GetResult();
 }
コード例 #3
0
 public static Task SubscribeAsync <T>(this ICaraBus caraBus, Func <T, CancellationToken, Task> handler, SubscribeOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class
 {
     return(caraBus.SubscribeAsync(typeof(T), (message, token) => handler((T)message, token), options, cancellationToken));
 }
コード例 #4
0
 public static void Subscribe <T>(this ICaraBus caraBus, Func <T, Task> handler, SubscribeOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class
 {
     caraBus.SubscribeAsync(typeof(T), (message, token) => handler((T)message), options, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult();
 }
コード例 #5
0
 public static void Subscribe(this ICaraBus caraBus, Type messageType, Func <object, Task> handler, SubscribeOptions options = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     caraBus.SubscribeAsync(messageType, (message, token) => handler(message), options, cancellationToken).ConfigureAwait(false).GetAwaiter().GetResult();
 }