Add message bus for #677
This commit is contained in:
parent
9ee650461f
commit
d16cfb7328
9 changed files with 207 additions and 5 deletions
|
|
@ -22,6 +22,10 @@ class PartitionConfig {
|
|||
getAnnouncementChannel() {
|
||||
return this.config.redis.announcementChannel || 'serverAnnouncements';
|
||||
}
|
||||
|
||||
getGlobalMessageBusChannel() {
|
||||
return this.config.redis.globalMessageBusChannel || 'globalMessages';
|
||||
}
|
||||
}
|
||||
|
||||
export { PartitionConfig };
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import LegacyConfig from '../config';
|
|||
import path from 'path';
|
||||
import { AnnouncementRefresher } from './announcementrefresher';
|
||||
import { RedisPartitionMapReloader } from './redispartitionmapreloader';
|
||||
import { RedisMessageBus } from '../pubsub/redis';
|
||||
|
||||
const PARTITION_CONFIG_PATH = path.resolve(__dirname, '..', '..', 'conf',
|
||||
'partitions.toml');
|
||||
|
|
@ -104,6 +105,19 @@ class PartitionModule {
|
|||
|
||||
return this.announcementRefresher;
|
||||
}
|
||||
|
||||
getGlobalMessageBus() {
|
||||
if (!this.globalMessageBus) {
|
||||
const provider = this.getRedisClientProvider();
|
||||
this.globalMessageBus = new RedisMessageBus(
|
||||
provider.get(),
|
||||
provider.get(),
|
||||
this.partitionConfig.getGlobalMessageBusChannel()
|
||||
);
|
||||
}
|
||||
|
||||
return this.globalMessageBus;
|
||||
}
|
||||
}
|
||||
|
||||
export { PartitionModule };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue