Пример #1
0
        private static async void StartReplicationAsync()
        {
            var replication = new SynapseReplication();

            replication.ClientName  = "EmojiTracker_FilterProc";
            replication.ServerName += Replication_ServerName;

            var synapseConfig = _config.GetSection("Synapse");

            await replication.ConnectRedis(synapseConfig.GetValue <string>("replicationRedisHost"),
                                           synapseConfig.GetValue <int>("replicationRedisPort"), synapseConfig.GetValue <string>("replicationServerName"));

            _eventStream                 = replication.BindStream <EventStreamRow>();
            _eventStream.DataRow        += Stream_DataRow;
            _eventStream.PositionUpdate += Stream_PositionUpdate;
        }
Пример #2
0
        private static async void StartReplicationAsync(string replicationHost, int replicationPort, bool useRedis, string serverHostname)
        {
            var replication = new SynapseReplication();

            replication.ClientName  = "SynapseReplInterop_Debug";
            replication.ServerName += Replication_ServerName;
            replication.Error      += Replication_Error;

            _stream                 = replication.BindStream <EventStreamRow>();
            _stream.DataRow        += Stream_DataRow;
            _stream.PositionUpdate += Stream_PositionUpdate;

            if (!useRedis)
            {
                await replication.ConnectTcp(replicationHost, replicationPort);
            }
            else
            {
                await replication.ConnectRedis(replicationHost, replicationPort, serverHostname);
            }
        }
        public async Task Start()
        {
            log.Information("Starting FederationWorker");
            _synapseReplication             = new SynapseReplication();
            _synapseReplication.ClientName  = "NetCoreFederationWorker";
            _synapseReplication.ServerName += Replication_ServerName;

            var synapseConfig = _config.GetSection("Synapse");

            key = SigningKey.ReadFromFile(synapseConfig.GetValue <string>("signingKeyPath"));
            connectionString = _config.GetConnectionString("synapse");
            _presenceEnabled = synapseConfig.GetValue("presenceEnabled", true);

            await _synapseReplication.Connect(synapseConfig.GetValue <string>("replicationHost"),
                                              synapseConfig.GetValue <int>("replicationPort"));

            _fedStream          = _synapseReplication.BindStream <FederationStreamRow>();
            _fedStream.DataRow += OnFederationRow;
            _eventStream        = _synapseReplication.BindStream <EventStreamRow>();
            _eventStream.PositionUpdate /**/ += OnEventPositionUpdate;
            _stream_position = await GetFederationPos("federation");
        }