Пример #1
0
        /// <summary>
        /// Constructor <see cref="StreamingClient"/> creates instance of the class.
        /// </summary>
        /// <param name="logger"></param>
        /// <param name="authenticationClient"></param>
        /// <param name="options"></param>
        public StreamingClient(ILogger <StreamingClient> logger,
                               IAuthenticationClientProxy authenticationClient,
                               SalesforceConfiguration options)
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));

            _logger = logger ?? throw new ArgumentNullException(nameof(logger));
            _authenticationClient =
                authenticationClient ?? throw new ArgumentNullException(nameof(authenticationClient));

            InitBayeuxClient();
        }
Пример #2
0
        /// <summary>
        ///  Constructor for <see cref="AuthenticationClientProxy"/>
        ///  that create an instance of <see cref="NetCoreForce.Client.ForceClient"/>.
        /// </summary>
        /// <param name="authenticationClient">Instance of <see cref="AuthenticationClientProxy"/> that creates instance of <see cref="AuthenticationClient"/>.</param>
        /// <param name="logger">Instance of the <see cref="ILogger{IForceClientProxy}"/>.</param>
        /// <param name="options">Options based on <see cref="SalesforceConfiguration"/></param>
        public ForceClientProxy(
            IAuthenticationClientProxy authenticationClient,
            ILogger <ForceClientProxy> logger,
            SalesforceConfiguration options)
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));

            _authenticationClient = authenticationClient ?? throw new ArgumentNullException(nameof(authenticationClient));

            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            // creates an instance of the forceclient register as singleton
            _forceClient = new NetCoreForce.Client.ForceClient(
                _authenticationClient.AuthenticationClient.AccessInfo.InstanceUrl,
                _authenticationClient.AuthenticationClient.ApiVersion,
                _authenticationClient.AuthenticationClient.AccessInfo.AccessToken
                );

            // create retry authentication policy
            _policy = CreateAuthenticationWaitAndRetry(_options.Retry,
                                                       nameof(ForceClientProxy), OnWaitAndRetry);
        }