Exemplo n.º 1
0
        private void Dispatch(BootstrapInfo info, IRingBuffer <JournalItem> journalRing, JournaledMessage message)
        {
            if (message.Sequence <= info.DispatchSequence)
            {
                return;                 // already dispatched
            }
            if (message.ForeignId != Guid.Empty)
            {
                return;                 // only re-dispatch messages which originated here
            }
            if (this.internalTypes.Contains(message.SerializedType))
            {
                return;
            }

            var next    = journalRing.Next();
            var claimed = journalRing[next];

            claimed.AsBootstrappedDispatchMessage(message.Sequence,
                                                  message.SerializedBody,
                                                  message.SerializedType,
                                                  message.SerializedHeaders);
            journalRing.Publish(next);
        }
Exemplo n.º 2
0
        private static bool Replay(BootstrapInfo info, IRingBuffer <TransformationItem> transformRing, JournaledMessage message)
        {
            if (message.Sequence <= info.SnapshotSequence)
            {
                return(false);
            }

            var next    = transformRing.Next();
            var claimed = transformRing[next];

            claimed.AsJournaledMessage(message.Sequence,
                                       message.SerializedBody,
                                       message.SerializedType,
                                       message.SerializedHeaders);
            transformRing.Publish(next);
            return(true);
        }