29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
// Package integration 定义 room-service 到外部服务的接口边界。
|
||
package integration
|
||
|
||
import (
|
||
"context"
|
||
|
||
roomeventsv1 "hyapp/api/proto/events/room/v1"
|
||
imv1 "hyapp/api/proto/im/v1"
|
||
walletv1 "hyapp/api/proto/wallet/v1"
|
||
)
|
||
|
||
// WalletClient 抽象 room-service 对 wallet-service 的同步扣费依赖。
|
||
type WalletClient interface {
|
||
// DebitGift 执行送礼扣费;失败时 room-service 不进入 Room Cell 状态提交。
|
||
DebitGift(ctx context.Context, req *walletv1.DebitGiftRequest) (*walletv1.DebitGiftResponse, error)
|
||
}
|
||
|
||
// RoomEventPublisher 抽象 room-service 对 im-service 的同步广播桥接。
|
||
type RoomEventPublisher interface {
|
||
// PublishRoomEvent 把房间系统事件同步推给 im-service,用于低时延广播。
|
||
PublishRoomEvent(ctx context.Context, event *imv1.RoomEvent) error
|
||
}
|
||
|
||
// OutboxPublisher 抽象 outbox worker 对外部消费者的异步投递。
|
||
type OutboxPublisher interface {
|
||
// PublishOutboxEvent 投递 protobuf outbox 信封,失败由 room_outbox 保留 pending 状态重试。
|
||
PublishOutboxEvent(ctx context.Context, envelope *roomeventsv1.EventEnvelope) error
|
||
}
|