コード例 #1
0
        public void ClientSessionChannelOptionsDefaults()
        {
            var shortestTimespan = TimeSpan.FromMilliseconds(100);

            var options = new ClientSessionChannelOptions();

            TimeSpan.FromMilliseconds(options.SessionTimeout)
            .Should().BeGreaterOrEqualTo(shortestTimespan);
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientSessionChannel"/> class.
 /// </summary>
 /// <param name="localDescription">The <see cref="ApplicationDescription"/> of the local application.</param>
 /// <param name="certificateStore">The local certificate store.</param>
 /// <param name="userIdentity">The user identity. Provide an <see cref="AnonymousIdentity"/>, <see cref="UserNameIdentity"/>, <see cref="IssuedIdentity"/> or <see cref="X509Identity"/>.</param>
 /// <param name="remoteEndpoint">The <see cref="EndpointDescription"/> of the remote application. Obtained from a prior call to <see cref="DiscoveryService.GetEndpointsAsync(GetEndpointsRequest, ILoggerFactory?, UaApplicationOptions?, StackProfile?)"/>.</param>
 /// <param name="loggerFactory">The logger factory.</param>
 /// <param name="options">The session channel options.</param>
 public ClientSessionChannel(
     ApplicationDescription localDescription,
     ICertificateStore?certificateStore,
     IUserIdentity userIdentity,
     EndpointDescription remoteEndpoint,
     ILoggerFactory?loggerFactory        = null,
     ClientSessionChannelOptions?options = null,
     StackProfile?stackProfile           = null)
     : base(localDescription, certificateStore, remoteEndpoint, loggerFactory, options, stackProfile)
 {
     UserIdentity      = userIdentity;
     _options          = options ?? new ClientSessionChannelOptions();
     _loggerFactory    = loggerFactory;
     _logger           = loggerFactory?.CreateLogger <ClientSessionChannel>();
     _actionBlock      = new ActionBlock <PublishResponse>(pr => OnPublishResponse(pr));
     _stateMachineCts  = new CancellationTokenSource();
     _publishResponses = new BroadcastBlock <PublishResponse>(null, new DataflowBlockOptions {
         CancellationToken = _stateMachineCts.Token
     });
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClientSessionChannel"/> class.
 /// </summary>
 /// <param name="localDescription">The <see cref="ApplicationDescription"/> of the local application.</param>
 /// <param name="certificateStore">The local certificate store.</param>
 /// <param name="userIdentityProvider">An asynchronous function that provides the user identity. Provide an <see cref="AnonymousIdentity"/>, <see cref="UserNameIdentity"/>, <see cref="IssuedIdentity"/> or <see cref="X509Identity"/>.</param>
 /// <param name="endpointUrl">The url of the endpoint of the remote application</param>
 /// <param name="securityPolicyUri">Optionally, filter by SecurityPolicyUri.</param>
 /// <param name="loggerFactory">The logger factory.</param>
 /// <param name="options">The session channel options.</param>
 public ClientSessionChannel(
     ApplicationDescription localDescription,
     ICertificateStore certificateStore,
     Func <EndpointDescription, Task <IUserIdentity> > userIdentityProvider,
     string endpointUrl,
     string?securityPolicyUri            = null,
     ILoggerFactory?loggerFactory        = null,
     ClientSessionChannelOptions?options = null,
     StackProfile?stackProfile           = null)
     : base(localDescription, certificateStore, new EndpointDescription {
     EndpointUrl = endpointUrl, SecurityPolicyUri = securityPolicyUri
 }, loggerFactory, options, stackProfile)
 {
     UserIdentityProvider = userIdentityProvider;
     _options             = options ?? new ClientSessionChannelOptions();
     _loggerFactory       = loggerFactory;
     _logger           = loggerFactory?.CreateLogger <ClientSessionChannel>();
     _actionBlock      = new ActionBlock <PublishResponse>(pr => OnPublishResponse(pr));
     _stateMachineCts  = new CancellationTokenSource();
     _publishResponses = new BroadcastBlock <PublishResponse>(null, new DataflowBlockOptions {
         CancellationToken = _stateMachineCts.Token
     });
 }