Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="ackAsync">The ack.</param>
 /// <param name="cancelAsync">The cancel.</param>
 /// <param name="behavior">The behavior.</param>
 /// <param name="logger">The logger.</param>
 public AckOnce(
     Func <ValueTask> ackAsync,
     AckBehavior behavior,
     ILogger logger,
     Func <ValueTask>?cancelAsync = null)
 {
     _ackAsync    = ackAsync;
     _cancelAsync = cancelAsync ?? NON_FN;
     _behavior    = behavior;
     _logger      = logger;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance.
 /// </summary>
 /// <param name="ackBehavior">The acknowledge behavior.</param>
 /// <param name="batchSize">Gets the max batch size of reading messages per shard.
 /// The framework won't proceed to the next batch until all messages
 /// in the batch complete (or timeout when it set to acknowledge on timeout).</param>
 /// <param name="serializer">The serializer.</param>
 /// <param name="maxMessages">
 /// Maximum messages to consume before detaching the subscription.
 /// any number > 0 will activate this mechanism.
 /// </param>
 /// <param name="keepAlive">Gets a value indicating whether to prevent the consumer
 /// from being collect by the GC.
 /// True by default, when you hold the subscription disposable
 /// you can set it to false. as long as you keeping the disposable in
 /// object that isn't candidate for being collected the consumer will stay alive.</param>
 public ConsumerOptions(
     AckBehavior ackBehavior    = AckBehavior.Manual,
     int batchSize              = 100,
     IDataSerializer?serializer = null,
     uint maxMessages           = 0,
     bool keepAlive             = true)
     : base(serializer)
 {
     BatchSize   = batchSize;
     KeepAlive   = keepAlive;
     AckBehavior = ackBehavior;
     MaxMessages = maxMessages;
 }