Table of Contents

Class BaseMessageQueue

Namespace
HeyBox.Net.Queue
Assembly
HeyBox.Net.Core.dll

表示一个通用的消息队列抽象类。

public abstract class BaseMessageQueue : IMessageQueue
Inheritance
BaseMessageQueue
Implements
Derived
Inherited Members

Constructors

BaseMessageQueue(Func<ulong, string, JsonElement, Task>)

初始化一个 BaseMessageQueue 类的新实例。

protected BaseMessageQueue(Func<ulong, string, JsonElement, Task> eventHandler)

Parameters

eventHandler Func<ulong, string, JsonElement, Task>

用于处理消息的事件处理程序。

Properties

EventHandler

获取消息队列的事件处理程序。

protected Func<ulong, string, JsonElement, Task> EventHandler { get; }

Property Value

Func<ulong, string, JsonElement, Task>

Methods

EnqueueAsync(ulong, string, JsonElement, DateTimeOffset, CancellationToken)

将网关消息添加到队列中。

public abstract Task EnqueueAsync(ulong sequence, string type, JsonElement payload, DateTimeOffset timestamp, CancellationToken cancellationToken = default)

Parameters

sequence ulong

网关消息的序号。

type string

网关消息的类型。

payload JsonElement

网关消息的有效负载。

timestamp DateTimeOffset

网关消息的时间戳。

cancellationToken CancellationToken

用于取消该操作的取消令牌。

Returns

Task

表示一个异步入队操作的任务。

StartAsync(CancellationToken)

启动消息队列的处理。

public abstract Task StartAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

用于取消该操作的取消令牌。

Returns

Task

表示一个异步启动操作的任务。

StopAsync(CancellationToken)

停止消息队列的处理。

public abstract Task StopAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

用于取消该操作的取消令牌。

Returns

Task

表示一个异步停止操作的任务。