Table of Contents

Class AcknowledgedEventArgs

Namespace
Savvyio.Messaging
Assembly
Savvyio.Core.dll

Provides data for message related operations.

public class AcknowledgedEventArgs : EventArgs
Inheritance
AcknowledgedEventArgs

Examples

This example shows how to capture the AcknowledgedEventArgs payload that a message publishes after successful processing. The handler promotes transport properties into the event args so later pipeline steps can inspect the acknowledgement state.

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Savvyio;
using Savvyio.Messaging;

namespace ExampleApp;

public sealed class AcknowledgedEventArgsExample
{
    public async Task<IDictionary<string, object>> CaptureAsync()
    {
        var message = new Message<CreateOrderCommand>("msg-42", new Uri("urn:orders"), "orders.created", new CreateOrderCommand("ORD-42"));
        message.Properties["tenant"] = "eu-west";
        AcknowledgedEventArgs? observed = null;
        message.Acknowledged += (_, args) =>
        {
            observed = args;
            return Task.CompletedTask;
        };
        await message.AcknowledgeAsync().ConfigureAwait(false);
        return observed?.Properties ?? new Dictionary<string, object>();
    }
}

public sealed record CreateOrderCommand(string OrderId) : Request;

Constructors

AcknowledgedEventArgs(IDictionary<string, object>)

Initializes a new instance of the AcknowledgedEventArgs class.

public AcknowledgedEventArgs(IDictionary<string, object> properties)

Parameters

properties IDictionary<string, object>

The IDictionary<TKey, TValue>> to associate with the event.

Fields

Empty

Represents an event with no event data.

public static readonly AcknowledgedEventArgs Empty

Field Value

AcknowledgedEventArgs

Properties

Properties

Share state between components during message processing.

public IDictionary<string, object> Properties { get; }

Property Value

IDictionary<string, object>

The state between components during message processing.

See Also