Beispiel #1
0
        public IngestionClient(BingCommerceIngestion client, string tenantid, string indexid, uint maxAttempts, RequestLogger logger)
        {
            Require.Instance.IsNotNull(client, nameof(client))
            .IsNotNull(logger, nameof(logger))
            .IsNotNull(tenantid, nameof(tenantid))
            .IsNotNull(indexid, nameof(indexid))
            .IsTrue(maxAttempts > 0, "max attempts cannot be zero or less.");

            this.clientWithRetry = new BingCommerceIngestionWithRetry(client, maxAttempts, 500);

            this.client     = client;
            this.Tenantid   = tenantid;
            this.Indexid    = indexid;
            this.retryCount = maxAttempts;
            this.logger     = logger;
        }
Beispiel #2
0
        public StatusTracker(IngestionClient client, TimeSpan?trackingInterval, RequestLogger logger)
        {
            Require.Instance.IsNotNull(logger, nameof(logger));
            this.trackingInterval = trackingInterval;
            if (this.trackingInterval != null && !logger.IsDeadletterLogEnabled())
            {
                log.Warn($"tracking cadence is set while deadletter log is disabled. Turning off status tracking.");
                this.trackingInterval = null;
            }

            if (this.IsValid())
            {
                Require.Instance.IsNotNull(client, nameof(client));
                this.client             = client;
                this.logger             = logger;
                this.productIdFieldName = this.FindProductIdFieldName();
                this.timer           = new Timer(this.trackingInterval.Value.TotalMilliseconds);
                this.timer.AutoReset = true;
                this.timer.Elapsed  += this.TimerTriggered;
            }
        }