// Copyright (c) Microsoft. All rights reserved.
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Agents.AI.Workflows.Reflection;
///
/// A message handler interface for handling messages of type .
///
///
public interface IMessageHandler
{
///
/// Handles the incoming message asynchronously.
///
/// The message to handle.
/// The execution context.
/// The to monitor for cancellation requests.
/// The default is .
/// A task that represents the asynchronous operation.
ValueTask HandleAsync(TMessage message, IWorkflowContext context, CancellationToken cancellationToken = default);
}
///
/// A message handler interface for handling messages of type and
/// returning a result.
///
/// The type of message to handle.
/// The type of result returned after handling the message.
public interface IMessageHandler
{
///
/// Handles the incoming message asynchronously.
///
/// The message to handle.
/// The execution context.
/// The to monitor for cancellation requests.
/// The default is .
/// A task that represents the asynchronous operation.
ValueTask HandleAsync(TMessage message, IWorkflowContext context, CancellationToken cancellationToken = default);
}