How to use the @azure/service-bus.QueueClient.getDeadLetterQueuePath 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 Azure / azure-sdk-for-js / sdk / servicebus / service-bus / samples / javascript / advancedFeatures / processMessageFromDLQ.js View on Github external
This sample demonstrates retrieving a message from a dead letter queue, editing it and
  sending it back to the main queue.

  Prior to running this sample, run the sample in movingMessagesToDLQ.js file to move a message
  to the Dead Letter Queue
*/

const { ServiceBusClient, ReceiveMode, QueueClient } = require("@azure/service-bus");

// Define connection string and related Service Bus entity names here
const connectionString = "";
const queueName = "";

// If deadlettered messages are from Subscription, use `TopicClient.getDeadLetterTopicPath` instead
const deadLetterQueueName = QueueClient.getDeadLetterQueuePath(queueName);
const sbClient = ServiceBusClient.createFromConnectionString(connectionString);

async function main() {
  try {
    await processDeadletterMessageQueue();
  } finally {
    await sbClient.close();
  }
}

async function processDeadletterMessageQueue() {
  const queueClient = sbClient.createQueueClient(deadLetterQueueName);
  const receiver = queueClient.createReceiver(ReceiveMode.peekLock);

  const messages = await receiver.receiveMessages(1);
github Azure / azure-sdk-for-js / sdk / servicebus / service-bus / samples / typescript / advancedFeatures / processMessageFromDLQ.ts View on Github external
This sample demonstrates retrieving a message from a dead letter queue, editing it and
  sending it back to the main queue.

  Prior to running this sample, run the sample in movingMessagesToDLQ.ts file to move a message
  to the Dead Letter Queue
*/

import { ServiceBusMessage, ServiceBusClient, ReceiveMode, QueueClient } from "@azure/service-bus";

// Define connection string and related Service Bus entity names here
const connectionString = "";
const queueName = "";

// If deadlettered messages are from Subscription, use `TopicClient.getDeadLetterTopicPath` instead
const deadLetterQueueName = QueueClient.getDeadLetterQueuePath(queueName);
const sbClient: ServiceBusClient = ServiceBusClient.createFromConnectionString(connectionString);

async function main(): Promise {
  try {
    await processDeadletterMessageQueue();
  } finally {
    await sbClient.close();
  }
}

async function processDeadletterMessageQueue(): Promise {
  const queueClient = sbClient.createQueueClient(deadLetterQueueName);
  const receiver = queueClient.createReceiver(ReceiveMode.peekLock);

  const messages = await receiver.receiveMessages(1);