# Functions
NewEventBus 提供领域事件直接持久化到数据库,异步查询事件并推送的功能 需要在业务数据库提前创建符合 EventPO, ServicePO 描述的库表,并且使用兼容 gorm Model 的 executor 参数:serviceName 服务名,同一个服务之间只有一个消费,不同服务之间独立消费 用法:eventBus := NewEventBus("service", db); NewEngine(lock, eventBus.Options()...).
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
CustomRetry 自定义重试次数和间隔.
No description provided by the author
EventPO 事件存储模型
CREATE TABLE `ddd_domain_event` (
`id` int NOT NULL AUTO_INCREMENT,
`event_id` varchar(64) NOT NULL,
`event` text NOT NULL,
`trans_id` int,
`event_created_at` datetime(3) DEFAULT NULL,
`created_at` datetime(3) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_ddd_domain_event_event_id` (`event_id`),
KEY `idx_ddd_domain_event_trans_id` (`trans_id`),
KEY `idx_ddd_domain_event_created_at` (`created_at`),
KEY `idx_ddd_domain_event_event_created_at` (`event_created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
*/.
No description provided by the author
IntervalRetry 指定固定间隔和次数.
LimitRetry 设定最大重试次数,不指定间隔.
No description provided by the author
No description provided by the author
ServicePO 服务存储模型
CREATE TABLE `ddd_eventbus_service` (
`name` varchar(30) NOT NULL,
`failed` text,
`retry` text,
`offset` bigint(20) DEFAULT NULL,
`created_at` datetime(3) DEFAULT NULL,
`updated_at` datetime(3) DEFAULT NULL,
PRIMARY KEY (`name`),
KEY `idx_ddd_eventbus_service_created_at` (`created_at`),
KEY `idx_ddd_eventbus_service_updated_at` (`updated_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
*/.
CREATE TABLE `ddd_event_transaction` (
`id` int NOT NULL AUTO_INCREMENT,
`service` varchar(30) NOT NULL,
`events` text,
`due_time` datetime(3) DEFAULT NULL,
`created_at` datetime(3) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `idx_ddd_event_transaction_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
*/.
# Interfaces
No description provided by the author