Table of Contents

Class MessageContext

Namespace
Microsoft.AutoGen.Contracts
Assembly
Microsoft.AutoGen.Contracts.dll

Represents the context of a message being sent within the agent runtime. This includes metadata such as the sender, topic, RPC status, and cancellation handling.

public class MessageContext
Inheritance
MessageContext
Inherited Members

Constructors

MessageContext(string, CancellationToken)

Represents the context of a message being sent within the agent runtime. This includes metadata such as the sender, topic, RPC status, and cancellation handling.

public MessageContext(string messageId, CancellationToken cancellationToken)

Parameters

messageId string
cancellationToken CancellationToken

MessageContext(CancellationToken)

public MessageContext(CancellationToken cancellation)

Parameters

cancellation CancellationToken

Properties

CancellationToken

Gets or sets the cancellation token associated with this message. This can be used to cancel the operation if necessary.

public CancellationToken CancellationToken { get; set; }

Property Value

CancellationToken

IsRpc

Gets or sets a value indicating whether this message is part of an RPC (Remote Procedure Call).

public bool IsRpc { get; set; }

Property Value

bool

MessageId

Gets or sets the unique identifier for this message.

public string MessageId { get; set; }

Property Value

string

Sender

Gets or sets the sender of the message. If null, the sender is unspecified.

public AgentId? Sender { get; set; }

Property Value

AgentId?

Topic

Gets or sets the topic associated with the message. If null, the message is not tied to a specific topic.

public TopicId? Topic { get; set; }

Property Value

TopicId?