protected override byte[] Serialize(RabbitMqBatchContainer container) { using (var ms = new MemoryStream()) { Serializer.Serialize(ms, container.GetEvents <Message>().Single().Item1); return(ms.ToArray()); } }
public void Dispose() { lock (_syncRoot) { _purgeItem(_current); _current = null; } }
public bool MoveNext() { lock (_syncRoot) { _purgeItem(_current); _current = _moveNext(); } return(_current != null); }
/// <summary> /// Here we ignore the token since this is not rewindable stream anyway /// </summary> public IQueueCacheCursor GetCacheCursor(IStreamIdentity streamIdentity, StreamSequenceToken token) { return(new ConcurrentQueueCacheCursor( moveNext: () => { RabbitMqBatchContainer item = null; _cache.TryGetValue(new Tuple <Guid, string>(streamIdentity.Guid, streamIdentity.Namespace), out var queue); queue?.TryDequeue(out item); return item; }, purgeItem: item => { if (item != null) { _itemsToPurge.Enqueue(item); } })); }