2026-05-12 19:34:47 +08:00

31 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Package integration 定义 room-service 到外部服务的接口边界。
package integration
import (
"context"
roomeventsv1 "hyapp.local/api/proto/events/room/v1"
walletv1 "hyapp.local/api/proto/wallet/v1"
"hyapp/pkg/tencentim"
)
// WalletClient 抽象 room-service 对 wallet-service 的同步扣费依赖。
type WalletClient interface {
// DebitGift 执行送礼扣费;失败时 room-service 不进入 Room Cell 状态提交。
DebitGift(ctx context.Context, req *walletv1.DebitGiftRequest) (*walletv1.DebitGiftResponse, error)
}
// RoomEventPublisher 保留腾讯云 IM 直接桥接能力;房间命令主链路不再调用它。
type RoomEventPublisher interface {
// EnsureRoomGroup 确保房间在腾讯云 IM 中有对应群组。
EnsureRoomGroup(ctx context.Context, roomID string, ownerUserID int64) error
// PublishRoomEvent 把房间系统事件推给腾讯云 IM当前只供异步边界复用。
PublishRoomEvent(ctx context.Context, event tencentim.RoomEvent) error
}
// OutboxPublisher 抽象 outbox worker 对外部消费者的异步投递。
type OutboxPublisher interface {
// PublishOutboxEvent 投递 protobuf outbox 信封,失败由 room_outbox 转为 retryable 状态重试。
PublishOutboxEvent(ctx context.Context, envelope *roomeventsv1.EventEnvelope) error
}