public void DifferentEndpoint_DifferentChannel() { var pool = new ChannelPool(EmptyScopes); using (TestServiceFixture fixture1 = new TestServiceFixture(), fixture2 = new TestServiceFixture()) { var channel1 = pool.GetChannel(fixture1.Endpoint); var channel2 = pool.GetChannel(fixture2.Endpoint); Assert.NotSame(channel1, channel2); } }
public void SameEndpoint_SameChannel() { var pool = new ChannelPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(fixture.Endpoint); var channel2 = pool.GetChannel(fixture.Endpoint); Assert.Same(channel1, channel2); } }
public async Task ShutdownAsync_ShutsDownChannel() { var pool = new ChannelPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var channel = pool.GetChannel(fixture.Endpoint); Assert.NotEqual(ChannelState.Shutdown, channel.State); await pool.ShutdownChannelsAsync(); Assert.Equal(ChannelState.Shutdown, channel.State); } }
public void ShutdownAsync_EmptiesPool() { var pool = new ChannelPool(EmptyScopes); using (var fixture = new TestServiceFixture()) { var channel1 = pool.GetChannel(fixture.Endpoint); // Note: *not* waiting for this to complete. pool.ShutdownChannelsAsync(); var channel2 = pool.GetChannel(fixture.Endpoint); Assert.NotSame(channel1, channel2); } }
/// <summary> /// Shuts down any channels automatically created by <see cref="Create()"/> and /// <see cref="CreateAsync(st::CancellationToken)"/>. Channels which weren't automatically created are not /// affected. /// </summary> /// <remarks> /// After calling this method, further calls to <see cref="Create()"/> and /// <see cref="CreateAsync(st::CancellationToken)"/> will create new channels, which could in turn be shut down /// by another call to this method. /// </remarks> /// <returns>A task representing the asynchronous shutdown operation.</returns> public static stt::Task ShutdownDefaultChannelsAsync() => ChannelPool.ShutdownChannelsAsync();
public ProductPublisher(ChannelPool mqChannelPool /*ConnectionFactory factory*/, Settings settings) { this.mqChannelPool = mqChannelPool; //this.factory = factory; this.settings = settings; }