Esempio n. 1
0
 public QueueSuffixMiddleware(QueueSuffixOptions options = null)
 {
     ActivatedFlagFunc     = options?.ActiveFunc ?? (context => context.GetCustomQueueSuffixActivated());
     CustomSuffixFunc      = options?.CustomSuffixFunc ?? (context => context.GetCustomQueueSuffix());
     QueueDeclareFunc      = options?.QueueDeclareFunc ?? (context => context.GetQueueDeclaration());
     AppendSuffixAction    = options?.AppendSuffixAction ?? ((queue, suffix) => queue.Name = $"{queue.Name}_{suffix}");
     ConsumeCfgFunc        = options?.ConsumeConfigFunc ?? (context => context.GetConsumeConfiguration());
     SkipSuffixFunc        = options?.SkipSuffixFunc ?? (string.IsNullOrWhiteSpace);
     ContextSuffixOverride = options?.ContextSuffixOverrideFunc ?? (context => null);
 }
Esempio n. 2
0
 public static IClientBuilder UseQueueSuffix(this IClientBuilder builder, QueueSuffixOptions options = null)
 {
     if (options == null)
     {
         builder.Register(pipe => pipe.Use <QueueSuffixMiddleware>());
     }
     else
     {
         builder.Register(pipe => pipe.Use <QueueSuffixMiddleware>(options));
     }
     return(builder);
 }