Exemple #1
0
        public AmqpServiceClient(
            IotHubConnectionProperties connectionProperties,
            bool useWebSocketOnly,
            ServiceClientTransportSettings transportSettings,
            ServiceClientOptions options)
        {
            var iotHubConnection = new IotHubConnection(connectionProperties, useWebSocketOnly, transportSettings);

            Connection                = iotHubConnection;
            OpenTimeout               = IotHubConnection.DefaultOpenTimeout;
            OperationTimeout          = IotHubConnection.DefaultOperationTimeout;
            _faultTolerantSendingLink = new FaultTolerantAmqpObject <SendingAmqpLink>(CreateSendingLinkAsync, Connection.CloseLink);
            _feedbackReceiver         = new AmqpFeedbackReceiver(Connection);
            _fileNotificationReceiver = new AmqpFileNotificationReceiver(Connection);
            _iotHubName               = connectionProperties.IotHubName;
            _clientOptions            = options;
            _httpClientHelper         = new HttpClientHelper(
                connectionProperties.HttpsEndpoint,
                connectionProperties,
                ExceptionHandlingHelper.GetDefaultErrorMapping(),
                s_defaultOperationTimeout,
                transportSettings.HttpProxy,
                transportSettings.ConnectionLeaseTimeoutMilliseconds);

            // Set the trace provider for the AMQP library.
            AmqpTrace.Provider = new AmqpTransportLog();
        }
 internal HttpJobClient(IotHubConnectionProperties connectionProperties, HttpTransportSettings transportSettings)
 {
     _httpClientHelper = new HttpClientHelper(
         connectionProperties.HttpsEndpoint,
         connectionProperties,
         ExceptionHandlingHelper.GetDefaultErrorMapping(),
         s_defaultOperationTimeout,
         transportSettings.Proxy,
         transportSettings.ConnectionLeaseTimeoutMilliseconds);
 }
Exemple #3
0
        public IotHubConnection(IotHubConnectionProperties credential, bool useWebSocketOnly, ServiceClientTransportSettings transportSettings)
        {
#if !NET451
            _refreshTokenTimer = new IOThreadTimerSlim(s => ((IotHubConnection)s).OnRefreshTokenAsync(), this);
#else
            _refreshTokenTimer = new IOThreadTimer(s => ((IotHubConnection)s).OnRefreshTokenAsync(), this, false);
#endif

            Credential            = credential;
            _faultTolerantSession = new FaultTolerantAmqpObject <AmqpSession>(CreateSessionAsync, CloseConnection);
            _useWebSocketOnly     = useWebSocketOnly;
            _transportSettings    = transportSettings;
        }