Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 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);                
     }
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 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();
Ejemplo n.º 6
0
 public ProductPublisher(ChannelPool mqChannelPool /*ConnectionFactory factory*/, Settings settings)
 {
     this.mqChannelPool = mqChannelPool;
     //this.factory = factory;
     this.settings = settings;
 }