def __init__(self, aggregateClass, **kwargs): #pylint: disable=W0613
super(DefaultCoreProvider, self).__init__(aggregateClass)
self.aggregateName = self.aggregateClass.__name__
postgresUser, postgresPassword, postgresDatabase, postgresHost, postgresPort = GetPostgresConnectionDetails(self.infrastructureProvider)
redisHost, redisPort, redisConfig = GetRedisConnectionDetails(self.infrastructureProvider)
try:
self.redisConnection = StrictRedis(host=redisHost, port=redisPort, **redisConfig)
except Exception:
EventLogger.LogExceptionAuto(self, 'Failed to initialize Notifier')
raise
self._notifier = self.infrastructureProvider.GetConfigurablePlugin(ConfigurablePlugin.Notifier, aggregateClass=self.aggregateClass, #pylint: disable=C0103
redisConnection=self.redisConnection)
self.logicConnection = PostgresLogicConnection(postgresUser, postgresPassword, postgresDatabase, postgresHost, postgresPort)
self._logicStore = self.infrastructureProvider.GetConfigurablePlugin(ConfigurablePlugin.LogicStore, postgresConnection=self.logicConnection) #pylint: disable=C0103
self.eventPersisterConnection = PostgresEventWriteConnection(self.aggregateName, postgresUser, postgresPassword, postgresDatabase, postgresHost, postgresPort)
self._eventPersister = self.infrastructureProvider.GetConfigurablePlugin(ConfigurablePlugin.EventPersister, aggregateClass=self.aggregateClass, #pylint: disable=C0103
notifier=self._notifier, postgresConnection=self.eventPersisterConnection)
self.eventReaderConnection = PostgresEventReadConnection(self.aggregateName, postgresUser, postgresPassword, postgresDatabase, postgresHost, postgresPort)
self._eventReader = self.infrastructureProvider.GetConfigurablePlugin(ConfigurablePlugin.EventReader, aggregateClass=self.aggregateClass, #pylint: disable=C0103
postgresConnection=self.eventReaderConnection)
评论列表
文章目录