コード例 #1
0
        private void LoadSnapshot(long recordingId)
        {
            using (AeronArchive archive = AeronArchive.Connect(archiveCtx))
            {
                RecordingExtent recordingExtent = new RecordingExtent();
                if (0 == archive.ListRecording(recordingId, recordingExtent))
                {
                    throw new System.InvalidOperationException("Could not find recordingId: " + recordingId);
                }

                string channel  = ctx.ReplayChannel();
                int    streamId = ctx.ReplayStreamId();

                long length    = recordingExtent.stopPosition - recordingExtent.startPosition;
                int  sessionId = (int)archive.StartReplay(recordingId, 0, length, channel, streamId);

                string replaySessionChannel = ChannelUri.AddSessionId(channel, sessionId);
                using (Subscription subscription = aeron.AddSubscription(replaySessionChannel, streamId))
                {
                    Image image = AwaitImage(sessionId, subscription);
                    LoadState(image);
                    service.OnLoadSnapshot(image);
                }
            }
        }
コード例 #2
0
        private void LoadSnapshot(long recordingId)
        {
            using (AeronArchive archive = AeronArchive.Connect(archiveCtx))
            {
                string channel   = ctx.ReplayChannel();
                int    streamId  = ctx.ReplayStreamId();
                int    sessionId = (int)archive.StartReplay(recordingId, 0, AeronArchive.NULL_LENGTH, channel, streamId);

                string replaySessionChannel = ChannelUri.AddSessionId(channel, sessionId);
                using (Subscription subscription = aeron.AddSubscription(replaySessionChannel, streamId))
                {
                    Image image = AwaitImage(sessionId, subscription);
                    LoadState(image);
                    service.OnLoadSnapshot(image);
                }
            }
        }