private Int64 JournalPacket(IPacket packet) { // Journal all messages var seq = _storage.Save(packet.CloneEnvelopes()); return(seq); }
private void PublishMessages(Socket routerPubSocket, IPacket packet, Int64 seq) { var clonedEnvelopes = packet.CloneEnvelopes(); for (int i = 0; i < clonedEnvelopes.Count; i++) { var envelope = clonedEnvelopes[i]; var metadata = envelope.Metadata; // Set sequence for each message metadata.JournalSequence = seq - clonedEnvelopes.Count + i + 1; var newPacket = _context.CreatePacket(b => b .AddMessage(envelope.MessageBinary, metadata) ); routerPubSocket.SendPacket(newPacket); } }