/// <summary> /// Claim the next batch of sequence numbers for publishing. /// </summary> /// <param name="batchDescriptor">batchDescriptor to be updated for the batch range.</param> /// <returns>the updated batchDescriptor.</returns> public BatchDescriptor Next(BatchDescriptor batchDescriptor) { if (_gatingSequences == null) { throw new NullReferenceException("gatingSequences must be set before claiming sequences"); } long sequence = _claimStrategy.IncrementAndGet(batchDescriptor.Size, _gatingSequences); batchDescriptor.End = sequence; return(batchDescriptor); }
/// <summary> /// Publish the batch of events in sequence. /// </summary> /// <param name="batchDescriptor">batchDescriptor to be published.</param> public void Publish(BatchDescriptor batchDescriptor) { Publish(batchDescriptor.End, batchDescriptor.Size); }
/// <summary> /// Claim the next batch of sequence numbers for publishing with a timeout. /// If the timeout occurs the sequence will not be claimed and a <see cref="TimeoutException"/> will be thrown. /// /// </summary> /// <param name="batchDescriptor">batchDescriptor to be updated for the batch range.</param> /// <param name="timeout">timeout period to wait</param> /// <returns>the updated batchDescriptor.</returns> public BatchDescriptor Next(BatchDescriptor batchDescriptor, TimeSpan timeout) { WaitForCapacity(batchDescriptor.Size, timeout); return(Next(batchDescriptor)); }
/// <summary> /// Claim the next batch of sequence numbers for publishing with a timeout. /// If the timeout occurs the sequence will not be claimed and a <see cref="TimeoutException"/> will be thrown. /// /// </summary> /// <param name="batchDescriptor">batchDescriptor to be updated for the batch range.</param> /// <param name="timeout">timeout period to wait</param> /// <returns>the updated batchDescriptor.</returns> public BatchDescriptor Next(BatchDescriptor batchDescriptor, TimeSpan timeout) { WaitForCapacity(batchDescriptor.Size, timeout); return Next(batchDescriptor); }
/// <summary> /// Claim the next batch of sequence numbers for publishing. /// </summary> /// <param name="batchDescriptor">batchDescriptor to be updated for the batch range.</param> /// <returns>the updated batchDescriptor.</returns> public BatchDescriptor Next(BatchDescriptor batchDescriptor) { if (_gatingSequences == null) { throw new NullReferenceException("gatingSequences must be set before claiming sequences"); } long sequence = _claimStrategy.IncrementAndGet(batchDescriptor.Size, _gatingSequences); batchDescriptor.End = sequence; return batchDescriptor; }