/// <inheritdoc/>
        public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
        {
            if (IsSessionPinnedToServer())
            {
                throw new InvalidOperationException($"This overload of {nameof(GetWriteChannelSource)} cannot be called when pinned to a server.");
            }

            var selector = new WritableServerSelector(mayUseSecondary);
            var server   = _cluster.SelectServer(selector, cancellationToken);

            return(CreateServerChannelSource(server));
        }
Beispiel #2
0
 /// <inheritdoc/>
 public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
 {
     ThrowIfDisposed();
     return(_reference.Instance.GetWriteChannelSource(mayUseSecondary, cancellationToken));
 }
 /// <inheritdoc/>
 public IChannelSourceHandle GetWriteChannelSource(IMayUseSecondaryCriteria mayUseSecondary, CancellationToken cancellationToken)
 {
     return(GetWriteChannelSource(cancellationToken)); // ignore mayUseSecondary
 }
Beispiel #4
0
 /// <summary>
 /// Initializes an instance of the WritableServerSelector class.
 /// </summary>
 /// <param name="mayUseSecondary">The may use secondary criteria.</param>
 public WritableServerSelector(IMayUseSecondaryCriteria mayUseSecondary)
 {
     _mayUseSecondary = mayUseSecondary; // can be null
 }