MessageAsyncEnumerableOptions<T> Class
Definition
- Assemblies
- Savvyio.Messaging.dll
Configuration options that is related to IAcknowledgeable messages.
public class MessageAsyncEnumerableOptions<T> : IValidatableParameterObject, IParameterObject where T : IRequest
Type Parameters
TThe type of the payload constraint to the IRequest interface.
- Inheritance
-
MessageAsyncEnumerableOptions<T>
- Implements
Examples
This example shows how to configure callbacks that observe each streamed message and the properties acknowledged at the end of the sequence.
using System.Collections.Generic;
using System.Threading.Tasks;
using Savvyio;
using Savvyio.Messaging;
namespace ExampleApp;
public sealed class MessageAsyncEnumerableOptionsExample
{
public MessageAsyncEnumerableOptions<CreateOrderCommand> Configure()
{
var options = new MessageAsyncEnumerableOptions<CreateOrderCommand>
{
MessageCallback = async message => await message.AcknowledgeAsync().ConfigureAwait(false),
AcknowledgedPropertiesCallback = async acknowledged => await Task.CompletedTask.ConfigureAwait(false)
};
options.ValidateOptions();
return options;
}
}
public sealed record CreateOrderCommand(string OrderId) : Request;
Constructors
| Name | Description |
|---|---|
| MessageAsyncEnumerableOptions() | Initializes a new instance of the MessageAsyncEnumerableOptions<T> class. |
Properties
| Name | Description |
|---|---|
| AcknowledgedProperties | Gets or sets the implementation of an IProducerConsumerCollection<T> that is used to store all acknowledged properties. Default is a new instance of ConcurrentBag<T>. |
| AcknowledgedPropertiesCallback | Gets or sets the delegate that is invoked at the end of a sequence with all acknowledged properties. |
| MessageCallback | Gets or sets the delegate that is invoked once for each message fetched from a source. |
Methods
| Name | Description |
|---|---|
| ValidateOptions() | Determines whether the public read-write properties of this instance are in a valid state. |