How to use @commercetools/sdk-middleware-queue - 3 common examples

To help you get started, we’ve selected a few @commercetools/sdk-middleware-queue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commercetools / nodejs / integration-tests / sdk / channels.it.js View on Github external
describe('Channels', () => {
  const ignoredResponseKeys = [
    'id',
    'createdAt',
    'createdBy',
    'lastModifiedAt',
    'lastModifiedBy',
  ]
  const service = createRequestBuilder({ projectKey }).channels
  const httpMiddleware = createHttpMiddleware({
    host: 'https://api.sphere.io',
    fetch,
  })
  const queueMiddleware = createQueueMiddleware({
    concurrency: 5,
  })
  const userAgentMiddleware = createUserAgentMiddleware({
    libraryName: pkg.name,
    libraryVersion: pkg.version,
    contactUrl: 'https://github.com/commercetools/nodejs',
    contactEmail: 'npmjs@commercetools.com',
  })
  const key = uniqueId('channel_')
  let channelResponse
  let client
  let apiConfig

  beforeAll(() =>
    getCredentials(projectKey)
      .then(credentials => {
github contentful / extensions / marketplace / commercetools-sku / src / index.js View on Github external
}
}) {
  const authMiddleware = createAuthMiddlewareForClientCredentialsFlow({
    host: authApiEndpoint,
    projectKey: projectKey,
    credentials: {
      clientId: clientId,
      clientSecret: clientSecret
    }
  });

  const httpMiddleware = createHttpMiddleware({
    host: apiEndpoint
  });

  const queueMiddleware = createQueueMiddleware({
    concurrency: 5
  });

  return createClient({
    middlewares: [authMiddleware, httpMiddleware, queueMiddleware]
  });
}
github commercetools / nodejs / packages / resource-deleter / src / main.js View on Github external
this.apiConfig = options.apiConfig
    this.client = createClient({
      middlewares: [
        createAuthMiddlewareWithExistingToken(
          options.accessToken ? `Bearer ${options.accessToken}` : ''
        ),
        createAuthMiddlewareForClientCredentialsFlow({
          ...this.apiConfig,
          fetch,
        }),
        createUserAgentMiddleware({
          libraryName: pkg.name,
          libraryVersion: pkg.version,
        }),
        createHttpMiddleware({ host: this.apiConfig.apiUrl, fetch }),
        createQueueMiddleware({
          concurrency: 20,
        }),
      ],
    })
    this.logger = {
      ...silentLogger,
      ...options.logger,
    }
    this.predicate = options.predicate
    this.resource = options.resource
  }

@commercetools/sdk-middleware-queue

Middleware for queueing requests, to use with @commercetools/sdk-client

MIT
Latest version published 2 years ago

Package Health Score

64 / 100
Full package analysis

Popular @commercetools/sdk-middleware-queue functions