How to use the @azure/service-bus.ServiceBusClient function in @azure/service-bus

To help you get started, we’ve selected a few @azure/service-bus 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 DFEAGILEDEVOPS / MTC / admin / services / prepared-check-sync.service.js View on Github external
const azureQueueService = require('../services/azure-queue.service')
const pinGenerationDataService = require('../services/data-access/pin-generation.data.service')
const featureToggles = require('feature-toggles')
const sb = require('@azure/service-bus')
const config = require('../config')
let sbClient
let sbQueueClient
let sbQueueSender

const redisPreparedChecks = featureToggles.isFeatureEnabled('_2020Mode')

if (redisPreparedChecks) {
  sbClient = sb.ServiceBusClient.createFromConnectionString(config.ServiceBus.connectionString)
  sbQueueClient = sbClient.createQueueClient('check-sync')
  sbQueueSender = sbQueueClient.createSender()
}

const preparedCheckSyncService = {}

const redisEnabledBehaviour = async (pupilUrlSlug) => {
  await sbQueueSender.send({
    body: {
      pupilUUID: pupilUrlSlug,
      version: 1
    }
  })
}

const existingDefaultBehaviour = async (pupilUrlSlug) => {