diff --git a/services/activity-service/configs/config.docker.yaml b/services/activity-service/configs/config.docker.yaml index 926876ef..dd06506e 100644 --- a/services/activity-service/configs/config.docker.yaml +++ b/services/activity-service/configs/config.docker.yaml @@ -15,7 +15,7 @@ wallet_service_addr: "wallet-service:13004" room_service_addr: "room-service:13001" mysql_auto_migrate: true first_recharge_reward_worker: - enabled: false + enabled: true cumulative_recharge_reward_worker: enabled: true red_packet_broadcast_worker: diff --git a/services/activity-service/configs/config.tencent.example.yaml b/services/activity-service/configs/config.tencent.example.yaml index c39902e7..762118ea 100644 --- a/services/activity-service/configs/config.tencent.example.yaml +++ b/services/activity-service/configs/config.tencent.example.yaml @@ -39,6 +39,7 @@ tencent_im: admin_user_sig_ttl: "24h" endpoint: "adminapisgp.im.qcloud.com" group_type: "ChatRoom" + group_id_prefix: "" request_timeout: "5s" broadcast: enabled: true diff --git a/services/activity-service/configs/config.yaml b/services/activity-service/configs/config.yaml index 29049def..e4ed4067 100644 --- a/services/activity-service/configs/config.yaml +++ b/services/activity-service/configs/config.yaml @@ -15,11 +15,11 @@ wallet_service_addr: "127.0.0.1:13004" room_service_addr: "127.0.0.1:13001" mysql_auto_migrate: true first_recharge_reward_worker: - enabled: false + enabled: true cumulative_recharge_reward_worker: - enabled: false + enabled: true red_packet_broadcast_worker: - enabled: false + enabled: true lucky_gift_worker: enabled: true worker_poll_interval: "1s" @@ -39,6 +39,7 @@ tencent_im: admin_user_sig_ttl: "24h" endpoint: "adminapisgp.im.qcloud.com" group_type: "ChatRoom" + group_id_prefix: "" request_timeout: "5s" broadcast: enabled: true @@ -49,28 +50,28 @@ broadcast: worker_max_retry: 8 ensure_groups_on_startup: true rocketmq: - # 本地默认关闭,room-service 直接 gRPC 投递 activity;开启后消费 room_outbox MQ fanout。 - enabled: false - name_servers: [] + # 本地默认走 RocketMQ fanout,和 Docker/testbox/线上保持同一条 outbox 链路。 + enabled: true + name_servers: ["127.0.0.1:19876"] name_server_domain: "" access_key: "" secret_key: "" namespace: "" room_outbox: - enabled: false + enabled: true topic: "hyapp_room_outbox" consumer_group: "hyapp-activity-room-outbox" consumer_max_reconsume_times: 16 wallet_outbox: - enabled: false + enabled: true topic: "hyapp_wallet_outbox" - realtime_topic: "" + realtime_topic: "hyapp_wallet_realtime_outbox" first_recharge_consumer_group: "hyapp-activity-first-recharge-wallet-outbox" cumulative_recharge_consumer_group: "hyapp-activity-cumulative-recharge-wallet-outbox" red_packet_broadcast_consumer_group: "hyapp-activity-red-packet-wallet-outbox" consumer_max_reconsume_times: 16 user_outbox: - enabled: false + enabled: true topic: "hyapp_user_outbox" consumer_group: "hyapp-activity-user-region-broadcast" consumer_max_reconsume_times: 16 diff --git a/services/activity-service/internal/config/config_test.go b/services/activity-service/internal/config/config_test.go index ab30e4ce..6cfcab6e 100644 --- a/services/activity-service/internal/config/config_test.go +++ b/services/activity-service/internal/config/config_test.go @@ -2,13 +2,17 @@ package config import "testing" -func TestLoadLocalKeepsRocketMQDisabled(t *testing.T) { +func TestLoadLocalEnablesOutboxMQConsumers(t *testing.T) { cfg, err := Load("../../configs/config.yaml") if err != nil { t.Fatalf("Load local config failed: %v", err) } - if cfg.RocketMQ.Enabled || cfg.RocketMQ.RoomOutbox.Enabled || cfg.RocketMQ.UserOutbox.Enabled { - t.Fatalf("local config must not require RocketMQ: %+v", cfg.RocketMQ) + // activity 的充值、红包、礼物和区域播报都依赖 MQ fanout,本地默认必须和测试/线上一致。 + if !cfg.RocketMQ.Enabled || !cfg.RocketMQ.RoomOutbox.Enabled || !cfg.RocketMQ.WalletOutbox.Enabled || !cfg.RocketMQ.UserOutbox.Enabled { + t.Fatalf("local config must enable all activity outbox MQ consumers: %+v", cfg.RocketMQ) + } + if !cfg.FirstRechargeRewardWorker.Enabled || !cfg.CumulativeRechargeRewardWorker.Enabled || !cfg.RedPacketBroadcastWorker.Enabled { + t.Fatalf("local config must enable wallet outbox workers: first=%+v cumulative=%+v red_packet=%+v", cfg.FirstRechargeRewardWorker, cfg.CumulativeRechargeRewardWorker, cfg.RedPacketBroadcastWorker) } } diff --git a/services/game-service/configs/config.yaml b/services/game-service/configs/config.yaml index ef89384d..7cf66f6a 100644 --- a/services/game-service/configs/config.yaml +++ b/services/game-service/configs/config.yaml @@ -9,8 +9,8 @@ user_service_addr: "127.0.0.1:13005" activity_service_addr: "127.0.0.1:13006" launch_session_ttl: "15m" rocketmq: - enabled: false - name_servers: [] + enabled: true + name_servers: ["127.0.0.1:19876"] name_server_domain: "" access_key: "" secret_key: "" @@ -18,11 +18,11 @@ rocketmq: send_timeout: "3s" retry: 2 game_outbox: - enabled: false + enabled: true topic: "hyapp_game_outbox" producer_group: "hyapp-game-outbox-producer" outbox_worker: - enabled: false + enabled: true poll_interval: "1s" batch_size: 100 publish_timeout: "3s" diff --git a/services/notice-service/configs/config.yaml b/services/notice-service/configs/config.yaml index 0778af28..025da590 100644 --- a/services/notice-service/configs/config.yaml +++ b/services/notice-service/configs/config.yaml @@ -49,25 +49,25 @@ cp_notice_worker: max_backoff: 5m rocketmq: - # 本地默认关闭;开启后 notice 只消费 owner outbox MQ fanout,仍写 notice_delivery_events 做幂等。 - enabled: false - name_servers: [] + # notice 只消费 owner outbox MQ fanout,仍写 notice_delivery_events 做幂等。 + enabled: true + name_servers: ["127.0.0.1:19876"] name_server_domain: "" access_key: "" secret_key: "" namespace: "" wallet_outbox: - enabled: false + enabled: true topic: "hyapp_wallet_outbox" consumer_group: "hyapp-notice-wallet-outbox" consumer_max_reconsume_times: 16 room_outbox: - enabled: false + enabled: true topic: "hyapp_room_outbox" consumer_group: "hyapp-notice-room-outbox" consumer_max_reconsume_times: 16 user_outbox: - enabled: false + enabled: true topic: "hyapp_user_outbox" consumer_group: "hyapp-notice-cp-user-outbox" consumer_max_reconsume_times: 16 diff --git a/services/notice-service/internal/config/config_test.go b/services/notice-service/internal/config/config_test.go index 7b42fdab..60b30179 100644 --- a/services/notice-service/internal/config/config_test.go +++ b/services/notice-service/internal/config/config_test.go @@ -2,13 +2,18 @@ package config import "testing" -func TestLoadLocalKeepsRocketMQDisabled(t *testing.T) { +func TestLoadLocalEnablesOutboxMQConsumers(t *testing.T) { cfg, err := Load("../../configs/config.yaml") if err != nil { t.Fatalf("Load local config failed: %v", err) } - if cfg.RocketMQ.Enabled || cfg.RocketMQ.WalletOutbox.Enabled || cfg.RocketMQ.RoomOutbox.Enabled { - t.Fatalf("local config must not require RocketMQ: %+v", cfg.RocketMQ) + // 本地默认也走 MQ fanout,避免本地、testbox、线上三套 outbox 语义漂移。 + if !cfg.RocketMQ.Enabled || !cfg.RocketMQ.WalletOutbox.Enabled || !cfg.RocketMQ.RoomOutbox.Enabled || !cfg.RocketMQ.UserOutbox.Enabled { + t.Fatalf("local config must enable all notice outbox MQ consumers: %+v", cfg.RocketMQ) + } + // 直扫 owner DB 的老 worker 已被启动校验禁用,只保留配置参数给离线修复工具复用。 + if cfg.WalletNoticeWorker.Enabled || cfg.RoomNoticeWorker.Enabled || cfg.CPNoticeWorker.Enabled { + t.Fatalf("local config must keep legacy DB poll workers disabled: wallet=%+v room=%+v cp=%+v", cfg.WalletNoticeWorker, cfg.RoomNoticeWorker, cfg.CPNoticeWorker) } } @@ -17,8 +22,8 @@ func TestLoadTencentExampleEnablesOutboxMQConsumers(t *testing.T) { if err != nil { t.Fatalf("Load tencent example failed: %v", err) } - if cfg.WalletNoticeWorker.Enabled || cfg.RoomNoticeWorker.Enabled { - t.Fatalf("tencent example must keep legacy DB poll workers disabled: wallet=%+v room=%+v", cfg.WalletNoticeWorker, cfg.RoomNoticeWorker) + if cfg.WalletNoticeWorker.Enabled || cfg.RoomNoticeWorker.Enabled || cfg.CPNoticeWorker.Enabled { + t.Fatalf("tencent example must keep legacy DB poll workers disabled: wallet=%+v room=%+v cp=%+v", cfg.WalletNoticeWorker, cfg.RoomNoticeWorker, cfg.CPNoticeWorker) } if !cfg.RocketMQ.Enabled || !cfg.RocketMQ.WalletOutbox.Enabled || cfg.RocketMQ.WalletOutbox.Topic == "" || cfg.RocketMQ.WalletOutbox.ConsumerGroup == "" { t.Fatalf("tencent example must configure wallet outbox MQ consumer: %+v", cfg.RocketMQ) diff --git a/services/room-service/configs/config.yaml b/services/room-service/configs/config.yaml index a1e2984b..4c850139 100644 --- a/services/room-service/configs/config.yaml +++ b/services/room-service/configs/config.yaml @@ -54,9 +54,9 @@ mic_publish_timeout: "15s" mic_publish_scan_interval: "1s" room_rocket_launch_scan_interval: "1s" rocketmq: - # 本地默认关闭;开启后 room_outbox 可投 MQ,火箭倒计时用延迟消息到点唤醒。 - enabled: false - name_servers: [] + # 本地默认走 RocketMQ fanout,和 Docker/testbox/线上保持同一条 outbox 链路。 + enabled: true + name_servers: ["127.0.0.1:19876"] name_server_domain: "" access_key: "" secret_key: "" @@ -64,27 +64,27 @@ rocketmq: send_timeout: "3s" retry: 2 room_outbox: - enabled: false + enabled: true topic: "hyapp_room_outbox" producer_group: "hyapp-room-outbox-producer" - tencent_im_consumer_enabled: false + tencent_im_consumer_enabled: true tencent_im_consumer_group: "hyapp-room-im-bridge" consumer_max_reconsume_times: 16 rocket_launch: - enabled: false + enabled: true topic: "hyapp_room_rocket_launch" producer_group: "hyapp-room-rocket-launch-producer" consumer_group: "hyapp-room-rocket-launch" consumer_max_reconsume_times: 16 user_outbox: - enabled: false + enabled: true topic: "hyapp_user_outbox" consumer_group: "hyapp-room-user-region-sync" consumer_max_reconsume_times: 16 outbox_worker: - # room_outbox 是腾讯云 IM 和 activity-service 的异步投递通道;失败退避重试,超过上限转死信。 + # room_outbox 是腾讯云 IM 和 activity-service 的异步投递通道;本地也走 MQ,避免和测试/线上链路漂移。 enabled: true - publish_mode: "direct" + publish_mode: "mq" poll_interval: "1s" batch_size: 100 publish_timeout: "3s" diff --git a/services/room-service/internal/config/config_test.go b/services/room-service/internal/config/config_test.go index 72a806ec..c8d70bae 100644 --- a/services/room-service/internal/config/config_test.go +++ b/services/room-service/internal/config/config_test.go @@ -34,11 +34,12 @@ func TestLoad(t *testing.T) { if cfg.WalletServiceAddr != "127.0.0.1:13004" { t.Fatalf("unexpected wallet addr: %s", cfg.WalletServiceAddr) } - if !cfg.OutboxWorker.Enabled || cfg.OutboxWorker.PublishMode != OutboxPublishModeDirect || cfg.OutboxWorker.PollInterval != time.Second || cfg.OutboxWorker.BatchSize != 100 || cfg.OutboxWorker.PublishTimeout != 3*time.Second || cfg.OutboxWorker.RetryStrategy != "exponential_backoff" || cfg.OutboxWorker.MaxRetryCount != 10 || cfg.OutboxWorker.InitialBackoff != 5*time.Second || cfg.OutboxWorker.MaxBackoff != 5*time.Minute { + if !cfg.OutboxWorker.Enabled || cfg.OutboxWorker.PublishMode != OutboxPublishModeMQ || cfg.OutboxWorker.PollInterval != time.Second || cfg.OutboxWorker.BatchSize != 100 || cfg.OutboxWorker.PublishTimeout != 3*time.Second || cfg.OutboxWorker.RetryStrategy != "exponential_backoff" || cfg.OutboxWorker.MaxRetryCount != 10 || cfg.OutboxWorker.InitialBackoff != 5*time.Second || cfg.OutboxWorker.MaxBackoff != 5*time.Minute { t.Fatalf("unexpected outbox worker config: %+v", cfg.OutboxWorker) } - if cfg.RocketMQ.Enabled || cfg.RocketMQ.RoomOutbox.Enabled || cfg.RocketMQ.RocketLaunch.Enabled { - t.Fatalf("local config must not require RocketMQ: %+v", cfg.RocketMQ) + // 本地默认也走 room_outbox MQ、IM bridge 和火箭延迟唤醒,避免本地直投和线上 MQ 语义分叉。 + if !cfg.RocketMQ.Enabled || !cfg.RocketMQ.RoomOutbox.Enabled || !cfg.RocketMQ.RoomOutbox.TencentIMConsumerEnabled || !cfg.RocketMQ.RocketLaunch.Enabled || !cfg.RocketMQ.UserOutbox.Enabled { + t.Fatalf("local config must enable room MQ fanout and IM bridge: %+v", cfg.RocketMQ) } } diff --git a/services/statistics-service/configs/config.yaml b/services/statistics-service/configs/config.yaml index c313274f..aa4fd4e6 100644 --- a/services/statistics-service/configs/config.yaml +++ b/services/statistics-service/configs/config.yaml @@ -6,8 +6,8 @@ query_http_addr: ":13010" mysql_dsn: "hyapp:hyapp@tcp(127.0.0.1:23306)/hyapp_statistics?parseTime=true&charset=utf8mb4&loc=UTC&multiStatements=true" activity_mysql_dsn: "hyapp:hyapp@tcp(127.0.0.1:23306)/hyapp_activity?parseTime=true&charset=utf8mb4&loc=UTC" rocketmq: - enabled: false - name_servers: [] + enabled: true + name_servers: ["127.0.0.1:19876"] name_server_domain: "" access_key: "" secret_key: "" @@ -15,22 +15,22 @@ rocketmq: namespace: "" vip_channel: false wallet_outbox: - enabled: false + enabled: true topic: "hyapp_wallet_outbox" consumer_group: "hyapp-statistics-wallet-outbox" consumer_max_reconsume_times: 16 room_outbox: - enabled: false + enabled: true topic: "hyapp_room_outbox" consumer_group: "hyapp-statistics-room-outbox" consumer_max_reconsume_times: 16 user_outbox: - enabled: false + enabled: true topic: "hyapp_user_outbox" consumer_group: "hyapp-statistics-user-outbox" consumer_max_reconsume_times: 16 game_outbox: - enabled: false + enabled: true topic: "hyapp_game_outbox" consumer_group: "hyapp-statistics-game-outbox" consumer_max_reconsume_times: 16 diff --git a/services/user-service/configs/config.docker.yaml b/services/user-service/configs/config.docker.yaml index 0bb10ef0..76826927 100644 --- a/services/user-service/configs/config.docker.yaml +++ b/services/user-service/configs/config.docker.yaml @@ -24,9 +24,9 @@ third_party: allowed_sign_in_providers: - "google.com" invite_recharge_worker: - enabled: false + enabled: true mic_time_worker: - enabled: false + enabled: true cp_relationship_worker: enabled: true consumer_group: "hyapp-user-cp-room-outbox" @@ -44,7 +44,7 @@ rocketmq: secret_key: "" namespace: "" wallet_outbox: - enabled: false + enabled: true topic: "hyapp_wallet_outbox" consumer_group: "hyapp-user-invite-wallet-outbox" consumer_max_reconsume_times: 16 diff --git a/services/user-service/configs/config.yaml b/services/user-service/configs/config.yaml index 146456b1..e09796fd 100644 --- a/services/user-service/configs/config.yaml +++ b/services/user-service/configs/config.yaml @@ -24,37 +24,37 @@ third_party: allowed_sign_in_providers: - "google.com" invite_recharge_worker: - enabled: false + enabled: true mic_time_worker: - enabled: false + enabled: true cp_relationship_worker: - enabled: false + enabled: true consumer_group: "hyapp-user-cp-room-outbox" outbox_worker: - enabled: false + enabled: true poll_interval: "1s" batch_size: 100 publish_timeout: "3s" rocketmq: - # 本地默认关闭;线上由 wallet/room outbox 投 MQ,各 consumer group 独立幂等消费。 - enabled: false - name_servers: [] + # 本地默认走 RocketMQ fanout,和 Docker/testbox/线上保持同一条 outbox 链路。 + enabled: true + name_servers: ["127.0.0.1:19876"] name_server_domain: "" access_key: "" secret_key: "" namespace: "" wallet_outbox: - enabled: false + enabled: true topic: "hyapp_wallet_outbox" consumer_group: "hyapp-user-invite-wallet-outbox" consumer_max_reconsume_times: 16 room_outbox: - enabled: false + enabled: true topic: "hyapp_room_outbox" consumer_group: "hyapp-user-mictime-room-outbox" consumer_max_reconsume_times: 16 user_outbox: - enabled: false + enabled: true topic: "hyapp_user_outbox" producer_group: "hyapp-user-outbox-producer" login_risk: diff --git a/services/wallet-service/configs/config.yaml b/services/wallet-service/configs/config.yaml index 1d6580af..06e51aa7 100644 --- a/services/wallet-service/configs/config.yaml +++ b/services/wallet-service/configs/config.yaml @@ -18,16 +18,16 @@ red_packet_expiry_worker: poll_interval: "5s" batch_size: 50 projection_worker: - enabled: false + enabled: true poll_interval: "60s" batch_size: 10 lock_ttl: "30s" consumer_group: "hyapp-wallet-projection" consumer_max_reconsume_times: 16 rocketmq: - # 本地默认关闭;线上由 wallet-service outbox worker 投递账务事实到 MQ。 - enabled: false - name_servers: [] + # 本地默认走 RocketMQ fanout,和 Docker/testbox/线上保持同一条 outbox 链路。 + enabled: true + name_servers: ["127.0.0.1:19876"] name_server_domain: "" access_key: "" secret_key: "" @@ -35,11 +35,11 @@ rocketmq: send_timeout: "3s" retry: 2 wallet_outbox: - enabled: false + enabled: true topic: "hyapp_wallet_outbox" producer_group: "hyapp-wallet-outbox-producer" realtime_outbox: - enabled: false + enabled: true topic: "hyapp_wallet_realtime_outbox" producer_group: "hyapp-wallet-realtime-outbox-producer" google_play: @@ -52,7 +52,7 @@ google_play: http_timeout: "10s" consume_enabled: true outbox_worker: - enabled: false + enabled: true poll_interval: "1s" batch_size: 100 concurrency: 1 @@ -61,7 +61,7 @@ outbox_worker: initial_backoff: "5s" max_backoff: "5m" realtime_outbox_worker: - enabled: false + enabled: true poll_interval: "500ms" batch_size: 50 concurrency: 2 diff --git a/services/wallet-service/internal/config/config_test.go b/services/wallet-service/internal/config/config_test.go index 4b13530c..73516c24 100644 --- a/services/wallet-service/internal/config/config_test.go +++ b/services/wallet-service/internal/config/config_test.go @@ -2,13 +2,17 @@ package config import "testing" -func TestLoadLocalKeepsOutboxMQDisabled(t *testing.T) { +func TestLoadLocalEnablesOutboxMQ(t *testing.T) { cfg, err := Load("../../configs/config.yaml") if err != nil { t.Fatalf("Load local config failed: %v", err) } - if cfg.RocketMQ.Enabled || cfg.RocketMQ.WalletOutbox.Enabled || cfg.RocketMQ.RealtimeOutbox.Enabled { - t.Fatalf("local config must not require RocketMQ: %+v", cfg.RocketMQ) + // 本地默认发布普通钱包事实和实时红包事实,链路和 Docker/testbox/线上保持一致。 + if !cfg.RocketMQ.Enabled || !cfg.RocketMQ.WalletOutbox.Enabled || !cfg.RocketMQ.RealtimeOutbox.Enabled { + t.Fatalf("local config must enable wallet outbox MQ producers: %+v", cfg.RocketMQ) + } + if !cfg.OutboxWorker.Enabled || !cfg.RealtimeOutboxWorker.Enabled || !cfg.ProjectionWorker.Enabled { + t.Fatalf("local config must enable wallet outbox workers: outbox=%+v realtime=%+v projection=%+v", cfg.OutboxWorker, cfg.RealtimeOutboxWorker, cfg.ProjectionWorker) } if cfg.OutboxWorker.Concurrency != 1 || cfg.RealtimeOutboxWorker.Concurrency != 2 { t.Fatalf("local outbox worker defaults mismatch: outbox=%+v realtime=%+v", cfg.OutboxWorker, cfg.RealtimeOutboxWorker)