<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fernando Callata</title>
    <description>The latest articles on DEV Community by Fernando Callata (@fernando_callata_dev).</description>
    <link>https://dev.to/fernando_callata_dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1858937%2Fbf057237-b145-4a1b-bfb7-e260e932ab42.jpg</url>
      <title>DEV Community: Fernando Callata</title>
      <link>https://dev.to/fernando_callata_dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fernando_callata_dev"/>
    <language>en</language>
    <item>
      <title>I built a GitHub year-in-review video. Counting was the hard part</title>
      <dc:creator>Fernando Callata</dc:creator>
      <pubDate>Fri, 23 Oct 2026 03:27:41 +0000</pubDate>
      <link>https://dev.to/fernando_callata_dev/i-built-a-github-year-in-review-video-counting-was-the-hard-part-fj9</link>
      <guid>https://dev.to/fernando_callata_dev/i-built-a-github-year-in-review-video-counting-was-the-hard-part-fj9</guid>
      <description>&lt;p&gt;Open your GitHub profile and look at it the way a recruiter would. There's a grid of green squares, a few pinned repositories and a language bar. You can read that page because you know what a contribution is. Someone who hires developers but doesn't write code can tell you were busy, and not much else.&lt;/p&gt;

&lt;p&gt;gitreplay.club is meant for that moment. It turns your GitHub activity into a vertical, 20-second video you can send before an interview: commits, pull requests, top languages, your longest streak and a heatmap of the year. It's the same idea as the "GitHub Wrapped" recaps that go around every December, and you can make one any time of year, for any year back to 2008 or for a single month.&lt;/p&gt;

&lt;p&gt;Rendering the video was the easy part. It's a Remotion composition rendered on AWS Lambda, and it takes about a minute and a half. Getting the numbers right was harder.&lt;/p&gt;

&lt;p&gt;The obvious source for a commit count is contributionsCollection.totalCommitContributions in GitHub's GraphQL API. For a lot of developers that number is too low. It counts commits in public repositories. Commits in private repositories are pooled into restrictedContributionsCount, a single number that also includes other kinds of contributions and never says which repository they came from. If most of your year happened in private repos, as it does for many people who code for a living, the obvious number leaves most of your year out.&lt;/p&gt;

&lt;p&gt;So gitreplay.club asks each repository instead. For every repo the token can read, it requests the default branch's history, filtered by author and date range:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="err"&gt;defaultBranchRef&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;on&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Commit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="n"&gt;history&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$authorId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;since&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$since&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;until&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$until&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;totalCount&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The commit total is the sum of those counts, merge commits included, with GitHub's own figure kept as a floor. Some repositories stay unreadable even with your token, such as organization repos behind SAML single sign-on or OAuth app restrictions. Their commits come from GitHub's per-repository contribution data instead. Those repos don't trigger the video's partial-data warning, which only appears when a public repository has disappeared.&lt;/p&gt;

&lt;p&gt;Languages took three tries. The first version added up the language bytes of every repository you own, the same data that draws the language bar on a repo page. That describes the history of your account rather than your year: a repository you last touched in 2019 counted as much as the one you worked in every day.&lt;/p&gt;

&lt;p&gt;The second version tried to be exact. It walked every commit you authored in the period and ran the changed files through linguist-js, a port of GitHub's Linguist, to classify them. It was accurate, and it couldn't finish for prolific accounts. With one API request per commit, the cost grew with how much you wrote, and heavy users ran past the collection time budget and GitHub's secondary limit of 900 points per minute. It failed for exactly the people with the busiest years.&lt;/p&gt;

&lt;p&gt;The version running now takes each repository's language mix and weights it by the commits you made there in the period. If a repo is 80% TypeScript and you made 200 commits there, that adds 160 commits' worth of TypeScript. It costs one GraphQL request per 25 repositories, however many commits you made. It doesn't measure which lines you personally wrote, and I'd rather say so here than let the chart imply it.&lt;/p&gt;

&lt;p&gt;Then there's work GitHub can't see at all, like code on GitLab or in a company repo you lost access to when you changed jobs. Premium users can correct their numbers on a review screen before the video renders. Before a correction saves, you confirm the numbers are yours to report, and anyone watching the video or opening the share page sees a "Self-reported stats" label. A recap you could edit freely would be a résumé with animations, and a recruiter would be right to ignore it. One that can't be corrected is wrong for anyone whose work lives outside GitHub. The label is the compromise.&lt;/p&gt;

&lt;p&gt;You can try it without signing in. Put any GitHub username after gitreplay.club/ and you get that account's public year, drawn as a terminal screen with the avatar in ASCII art, a bit like neofetch. Mine is gitreplay.club/fernandohre. That page only uses public data.&lt;/p&gt;

&lt;p&gt;Signing in with GitHub adds your private work to the totals and lets you make the video. You review the numbers, pick a year or a month and a style, and the MP4 is ready in about a minute and a half. You can download it or share a link, and the share page can hide your repository names if your repos are client work. The video is free in the GitHub Dark style, with a watermark. Premium is a one-time US$15 that adds four more styles, removes the watermark and turns on the self-reported corrections.&lt;/p&gt;

&lt;p&gt;If a number in your recap looks wrong, tell me which one in the comments and what you expected it to be.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>github</category>
      <category>career</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to clean dead-letter queue from azure service bus</title>
      <dc:creator>Fernando Callata</dc:creator>
      <pubDate>Mon, 21 Jul 2025 14:15:00 +0000</pubDate>
      <link>https://dev.to/fernando_callata_dev/how-to-clean-dead-letter-queue-from-azure-service-bus-12b0</link>
      <guid>https://dev.to/fernando_callata_dev/how-to-clean-dead-letter-queue-from-azure-service-bus-12b0</guid>
      <description>&lt;h2&gt;
  
  
  Problem
&lt;/h2&gt;

&lt;p&gt;Have you faced a situation where a lot of messages went to the dead-letter queue in azure service bus and then you need to clean it? You can easily go to azure portal and peek at messages and clear them. But if you have more than 20k messages, maybe it becomes painful to select one by one and clear. Other than that, it is important to understand why messages went there for troubleshooting reasons and help you to fix any issue that your application may be experiencing. What to do in such a situation ? &lt;/p&gt;

&lt;h2&gt;
  
  
  Thoughts
&lt;/h2&gt;

&lt;p&gt;A high number of messages in the dead-letter queue is a clear indication that your application is not able to consume them and usually they go there after the max attempts are reached. This includes uncaught exceptions, TTL expiration, serialization and deserialization issues, and so on. We must consider the impacts if business operations rely on these messages because if we do not have enough monitoring this can bring silent failures like: user operations not completed, payment confirmation failing causing dissatisfaction or financial loss. Retained messages consume storage and can contribute to increase costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Consolidation of Thoughts
&lt;/h2&gt;

&lt;p&gt;Instead of just cleaning the dead-letter queue we should understand why messages got there in order to fix silent issues that may exist in our application. With that being said, how about generating code that connects to your queue extract the errors details to files and then mark the messages as consumed?&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { ServiceBusClient } = require("@azure/service-bus");
const fs = require('fs').promises;
const path = require('path');
const dotenv = require('dotenv');
dotenv.config();
class DeadLetterQueueExtractor {
    constructor(connectionString, queueName) {
        this.connectionString = connectionString;
        this.queueName = queueName;
        this.client = new ServiceBusClient(connectionString);
        this.receiver = null;
    }

    async initialize() {
        try {
            // Create receiver for dead-letter sub-queue
            this.receiver = this.client.createReceiver(this.queueName, {
                subQueueType: "deadLetter"
            });
            console.log(`✅ Connected to dead-letter queue: ${this.queueName}`);
        } catch (error) {
            console.error(`❌ Failed to initialize receiver: ${error.message}`);
            throw error;
        }
    }

    async extractMessages(maxMessages = 100, saveToFile = true) {
        try {
            console.log(`🔍 Extracting up to ${maxMessages} messages from dead-letter queue...`);

            // Peek messages without removing them
            const messages = await this.receiver.peekMessages(maxMessages);

            if (messages.length === 0) {
                console.log("ℹ️  No messages found in dead-letter queue");
                return [];
            }

            console.log(`📨 Found ${messages.length} messages in dead-letter queue`);

            // Process and analyze messages
            const extractedMessages = messages.map((message, index) =&amp;gt; {
                return {
                    messageId: message.messageId,
                    sequenceNumber: message.sequenceNumber?.toString(),
                    enqueuedTimeUtc: message.enqueuedTimeUtc,
                    deadLetterReason: message.deadLetterReason,
                    deadLetterErrorDescription: message.deadLetterErrorDescription,
                    deliveryCount: message.deliveryCount,
                    timeToLive: message.timeToLive,
                    subject: message.subject,
                    contentType: message.contentType,
                    correlationId: message.correlationId,
                    sessionId: message.sessionId,
                    replyTo: message.replyTo,
                    replyToSessionId: message.replyToSessionId,
                    applicationProperties: message.applicationProperties,
                    body: this.parseMessageBody(message.body),
                    rawMessage: {
                        // Store raw message for debugging
                        bodyType: typeof message.body,
                        bodyLength: message.body?.length || 0
                    }
                };
            });

            // Generate analysis report
            const analysis = this.analyzeMessages(extractedMessages);

            if (saveToFile) {
                await this.saveToFiles(extractedMessages, analysis);
            }

            return {
                messages: extractedMessages,
                analysis: analysis
            };

        } catch (error) {
            console.error(`❌ Error extracting messages: ${error.message}`);
            throw error;
        }
    }

    parseMessageBody(body) {
        try {
            if (!body) return null;

            // Handle different body types
            if (Buffer.isBuffer(body)) {
                const bodyString = body.toString('utf8');
                // Try to parse as JSON
                try {
                    return JSON.parse(bodyString);
                } catch {
                    return bodyString;
                }
            } else if (typeof body === 'string') {
                try {
                    return JSON.parse(body);
                } catch {
                    return body;
                }
            } else if (typeof body === 'object') {
                return body;
            }

            return body;
        } catch (error) {
            console.warn(`⚠️  Failed to parse message body: ${error.message}`);
            return body?.toString() || null;
        }
    }

    analyzeMessages(messages) {
        const analysis = {
            totalMessages: messages.length,
            deadLetterReasons: {},
            deliveryCountStats: {},
            timeDistribution: {},
            contentTypes: {},
            correlationIds: new Set(),
            sessionIds: new Set(),
            oldestMessage: null,
            newestMessage: null,
            averageDeliveryCount: 0,
            recommendations: []
        };

        let totalDeliveryCount = 0;
        let oldestTime = null;
        let newestTime = null;

        messages.forEach(message =&amp;gt; {
            // Dead letter reasons
            const reason = message.deadLetterReason || 'Unknown';
            analysis.deadLetterReasons[reason] = (analysis.deadLetterReasons[reason] || 0) + 1;

            // Delivery count statistics
            const deliveryCount = message.deliveryCount || 0;
            analysis.deliveryCountStats[deliveryCount] = (analysis.deliveryCountStats[deliveryCount] || 0) + 1;
            totalDeliveryCount += deliveryCount;

            // Time distribution (by hour)
            if (message.enqueuedTimeUtc) {
                const hour = new Date(message.enqueuedTimeUtc).getHours();
                analysis.timeDistribution[hour] = (analysis.timeDistribution[hour] || 0) + 1;

                if (!oldestTime || message.enqueuedTimeUtc &amp;lt; oldestTime) {
                    oldestTime = message.enqueuedTimeUtc;
                    analysis.oldestMessage = message;
                }
                if (!newestTime || message.enqueuedTimeUtc &amp;gt; newestTime) {
                    newestTime = message.enqueuedTimeUtc;
                    analysis.newestMessage = message;
                }
            }

            // Content types
            if (message.contentType) {
                analysis.contentTypes[message.contentType] = (analysis.contentTypes[message.contentType] || 0) + 1;
            }

            // Correlation IDs
            if (message.correlationId) {
                analysis.correlationIds.add(message.correlationId);
            }

            // Session IDs
            if (message.sessionId) {
                analysis.sessionIds.add(message.sessionId);
            }
        });

        analysis.averageDeliveryCount = totalDeliveryCount / messages.length;
        analysis.correlationIds = Array.from(analysis.correlationIds);
        analysis.sessionIds = Array.from(analysis.sessionIds);

        // Generate recommendations
        analysis.recommendations = this.generateRecommendations(analysis);

        return analysis;
    }

    generateRecommendations(analysis) {
        const recommendations = [];

        // Check for common issues
        const maxDeliveryExceeded = analysis.deadLetterReasons['MaxDeliveryCountExceeded'] || 0;
        const ttlExpired = analysis.deadLetterReasons['TTLExpiredException'] || 0;
        const sessionLockLost = analysis.deadLetterReasons['SessionLockLost'] || 0;
        const messageLockLost = analysis.deadLetterReasons['MessageLockLost'] || 0;

        if (maxDeliveryExceeded &amp;gt; 0) {
            recommendations.push({
                issue: "MaxDeliveryCountExceeded",
                count: maxDeliveryExceeded,
                recommendation: "Review receiver error handling logic. Consider increasing max delivery count or fixing processing exceptions."
            });
        }

        if (ttlExpired &amp;gt; 0) {
            recommendations.push({
                issue: "TTLExpiredException",
                count: ttlExpired,
                recommendation: "Messages are expiring. Consider increasing TTL or improving processing speed."
            });
        }

        if (sessionLockLost &amp;gt; 0) {
            recommendations.push({
                issue: "SessionLockLost",
                count: sessionLockLost,
                recommendation: "Session handling issues. Review session management in receiver application."
            });
        }

        if (messageLockLost &amp;gt; 0) {
            recommendations.push({
                issue: "MessageLockLost",
                count: messageLockLost,
                recommendation: "Message processing is taking too long. Consider increasing lock duration or optimizing processing logic."
            });
        }

        if (analysis.averageDeliveryCount &amp;gt; 5) {
            recommendations.push({
                issue: "HighDeliveryCount",
                averageCount: analysis.averageDeliveryCount,
                recommendation: "High average delivery count indicates persistent processing failures. Review receiver application logic."
            });
        }

        return recommendations;
    }

    async saveToFiles(messages, analysis) {
        try {
            const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
            const outputDir = `dlq-extraction-${timestamp}`;

            await fs.mkdir(outputDir, { recursive: true });

            // Save detailed messages
            await fs.writeFile(
                path.join(outputDir, 'messages.json'),
                JSON.stringify(messages, null, 2)
            );

            // Save analysis report
            await fs.writeFile(
                path.join(outputDir, 'analysis.json'),
                JSON.stringify(analysis, null, 2)
            );

            // Save summary report
            const summaryReport = this.generateSummaryReport(analysis);
            await fs.writeFile(
                path.join(outputDir, 'summary.txt'),
                summaryReport
            );

            // Save CSV for easy analysis
            const csvContent = this.generateCSV(messages);
            await fs.writeFile(
                path.join(outputDir, 'messages.csv'),
                csvContent
            );

            console.log(`📁 Files saved to directory: ${outputDir}`);
            console.log(`   - messages.json: Detailed message data`);
            console.log(`   - analysis.json: Analysis results`);
            console.log(`   - summary.txt: Human-readable summary`);
            console.log(`   - messages.csv: CSV format for spreadsheet analysis`);

        } catch (error) {
            console.error(`❌ Error saving files: ${error.message}`);
        }
    }

    generateSummaryReport(analysis) {
        let report = `Dead Letter Queue Analysis Report\n`;
        report += `=====================================\n\n`;
        report += `Total Messages: ${analysis.totalMessages}\n`;
        report += `Average Delivery Count: ${analysis.averageDeliveryCount.toFixed(2)}\n\n`;

        if (analysis.oldestMessage &amp;amp;&amp;amp; analysis.newestMessage) {
            report += `Oldest Message: ${analysis.oldestMessage.enqueuedTimeUtc}\n`;
            report += `Newest Message: ${analysis.newestMessage.enqueuedTimeUtc}\n\n`;
        }

        report += `Dead Letter Reasons:\n`;
        report += `-------------------\n`;
        Object.entries(analysis.deadLetterReasons).forEach(([reason, count]) =&amp;gt; {
            const percentage = ((count / analysis.totalMessages) * 100).toFixed(1);
            report += `${reason}: ${count} (${percentage}%)\n`;
        });

        report += `\nDelivery Count Distribution:\n`;
        report += `---------------------------\n`;
        Object.entries(analysis.deliveryCountStats).forEach(([count, messages]) =&amp;gt; {
            report += `${count} deliveries: ${messages} messages\n`;
        });

        if (analysis.recommendations.length &amp;gt; 0) {
            report += `\nRecommendations:\n`;
            report += `---------------\n`;
            analysis.recommendations.forEach((rec, index) =&amp;gt; {
                report += `${index + 1}. ${rec.issue}: ${rec.recommendation}\n`;
            });
        }

        return report;
    }

    generateCSV(messages) {
        const headers = [
            'messageId',
            'sequenceNumber',
            'enqueuedTimeUtc',
            'deadLetterReason',
            'deadLetterErrorDescription',
            'deliveryCount',
            'subject',
            'contentType',
            'correlationId',
            'sessionId'
        ];

        let csv = headers.join(',') + '\n';

        messages.forEach(message =&amp;gt; {
            const row = headers.map(header =&amp;gt; {
                const value = message[header] || '';
                // Escape commas and quotes in CSV
                const escapedValue = String(value).replace(/"/g, '""');
                return `"${escapedValue}"`;
            });
            csv += row.join(',') + '\n';
        });

        return csv;
    }

    async close() {
        try {
            if (this.receiver) {
                await this.receiver.close();
            }
            await this.client.close();
            console.log("✅ Connection closed successfully");
        } catch (error) {
            console.error(`❌ Error closing connection: ${error.message}`);
        }
    }
}

// Usage example and main execution
async function main() {
    // Configuration
    const config = {
        connectionString: process.env.AZURE_SERVICEBUS_CONNECTION_STRING || "YOUR_CONNECTION_STRING_HERE",
        queueName: process.env.QUEUE_NAME || "your-queue-name",
        maxMessages: parseInt(process.env.MAX_MESSAGES) || 100
    };

    // Validate configuration
    if (!config.connectionString || config.connectionString === "YOUR_CONNECTION_STRING_HERE") {
        console.error("❌ Please set AZURE_SERVICEBUS_CONNECTION_STRING environment variable or update the config");
        process.exit(1);
    }

    if (!config.queueName || config.queueName === "your-queue-name") {
        console.error("❌ Please set QUEUE_NAME environment variable or update the config");
        process.exit(1);
    }

    console.log("🚀 Starting Dead Letter Queue extraction...");
    console.log(`Queue: ${config.queueName}`);
    console.log(`Max Messages: ${config.maxMessages}`);

    const extractor = new DeadLetterQueueExtractor(config.connectionString, config.queueName);

    try {
        await extractor.initialize();

        const result = await extractor.extractMessages(config.maxMessages, false);

        console.log("\n📊 Analysis Summary:");
        console.log(`Total Messages: ${result.analysis.totalMessages}`);
        console.log(`Average Delivery Count: ${result.analysis.averageDeliveryCount.toFixed(2)}`);

        console.log("\n🔍 Dead Letter Reasons:");
        Object.entries(result.analysis.deadLetterReasons).forEach(([reason, count]) =&amp;gt; {
            const percentage = ((count / result.analysis.totalMessages) * 100).toFixed(1);
            console.log(`  ${reason}: ${count} (${percentage}%)`);
        });

        if (result.analysis.recommendations.length &amp;gt; 0) {
            console.log("\n💡 Recommendations:");
            result.analysis.recommendations.forEach((rec, index) =&amp;gt; {
                console.log(`  ${index + 1}. ${rec.issue}: ${rec.recommendation}`);
            });
        }

        //Now clear the dead-letter queue
        console.log("\n🗑️  Clearing dead-letter queue...")
        const clearReceiver = extractor.client.createReceiver(config.queueName, {
            subQueueType: "deadLetter",
            receiveMode: "receiveAndDelete"
        });

        //We are already receiving and deleting messages in the extractMessages method, so we can just use receiveAndDelete mode here
        const messagesToClear = await clearReceiver.receiveMessages(config.maxMessages);
        if (messagesToClear.length &amp;gt; 0) {
            console.log(`✅ Cleared ${messagesToClear.length} messages from dead-letter queue`);
        } else {
            console.log("ℹ️  No messages to clear from dead-letter queue");
        }
    } catch (error) {
        console.error(`❌ Extraction failed: ${error.message}`);
        process.exit(1);
    } finally {
        await extractor.close();
    }
}

// Export for use as module
module.exports = DeadLetterQueueExtractor;

// Run if called directly
if (require.main === module) {
    main().catch(console.error);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script is designed to help developers analyze and manage messages in the Azure Service Bus Dead-Letter Queue (DLQ). &lt;/p&gt;

&lt;h2&gt;
  
  
  What does this code do?
&lt;/h2&gt;

&lt;p&gt;Connects to the Azure Service Bus DLQ for a specified queue.&lt;br&gt;
Extracts and analyzes messages without removing them, providing insights such as:&lt;br&gt;
Why messages were dead-lettered (dead-letter reasons)&lt;br&gt;
Delivery count statistics&lt;br&gt;
Message content and metadata&lt;br&gt;
Generates reports in multiple formats (JSON, CSV, and human-readable summaries) to help you understand and troubleshoot issues.&lt;br&gt;
Optionally clears the DLQ by removing all messages, making it easier to reset and monitor new issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why is this helpful?
&lt;/h2&gt;

&lt;p&gt;It gives you visibility into what’s going wrong in your message processing pipeline.&lt;br&gt;
You can quickly spot patterns (like repeated errors or expired messages) and get actionable recommendations.&lt;br&gt;
Beginners and experienced developers alike can use this tool to maintain healthy messaging systems and improve reliability.&lt;/p&gt;

&lt;p&gt;In short:&lt;br&gt;
This script is your assistant for diagnosing, reporting, and cleaning up the Azure Service Bus Dead-Letter Queue making message troubleshooting easier and more transparent for everyone.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>javascript</category>
      <category>javascriptlibraries</category>
      <category>azureservicebus</category>
    </item>
  </channel>
</rss>
