| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using CoreWCF.Channels; |
| | | 6 | | using CoreWCF.Configuration; |
| | | 7 | | using System.Threading; |
| | | 8 | | using System.Threading.Tasks; |
| | | 9 | | using Microsoft.Extensions.DependencyInjection; |
| | | 10 | | |
| | | 11 | | namespace CoreWCF.Queue.Common |
| | | 12 | | { |
| | | 13 | | internal class QueueInputChannel : CommunicationObject, IInputChannel |
| | | 14 | | { |
| | | 15 | | private readonly IServiceProvider _serviceProvider; |
| | | 16 | | |
| | 1718 | 17 | | public QueueInputChannel(IServiceProvider provider) |
| | | 18 | | { |
| | 1718 | 19 | | IServiceScope serviceScope = provider.CreateScope(); |
| | 1718 | 20 | | _serviceProvider = serviceScope.ServiceProvider; |
| | 1718 | 21 | | } |
| | | 22 | | |
| | | 23 | | public IServiceChannelDispatcher ChannelDispatcher |
| | | 24 | | { |
| | 0 | 25 | | get => throw new NotImplementedException(); |
| | 0 | 26 | | set => throw new NotImplementedException(); |
| | | 27 | | } |
| | | 28 | | |
| | 1718 | 29 | | public EndpointAddress LocalAddress { get; set; } |
| | | 30 | | |
| | | 31 | | protected override TimeSpan DefaultCloseTimeout |
| | | 32 | | { |
| | 0 | 33 | | get { return TimeSpan.MaxValue; } |
| | | 34 | | } |
| | | 35 | | |
| | | 36 | | protected override TimeSpan DefaultOpenTimeout |
| | | 37 | | { |
| | 1718 | 38 | | get { return TimeSpan.MaxValue; } |
| | | 39 | | } |
| | | 40 | | |
| | | 41 | | public virtual T GetProperty<T>() where T : class |
| | | 42 | | { |
| | 5222 | 43 | | return _serviceProvider.GetService<T>(); |
| | | 44 | | } |
| | | 45 | | |
| | 0 | 46 | | public Task<Message> ReceiveAsync(CancellationToken token) => throw new NotImplementedException(); |
| | | 47 | | |
| | | 48 | | public Task<(Message message, bool success)> TryReceiveAsync(CancellationToken token) => |
| | 0 | 49 | | throw new NotImplementedException(); |
| | | 50 | | |
| | | 51 | | protected override void OnAbort() |
| | | 52 | | { |
| | 0 | 53 | | } |
| | | 54 | | |
| | | 55 | | protected override Task OnCloseAsync(CancellationToken token) |
| | | 56 | | { |
| | 0 | 57 | | return Task.CompletedTask; |
| | | 58 | | } |
| | | 59 | | |
| | | 60 | | protected override Task OnOpenAsync(CancellationToken token) |
| | | 61 | | { |
| | 1718 | 62 | | return Task.CompletedTask; |
| | | 63 | | } |
| | | 64 | | } |
| | | 65 | | } |