📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

1325 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.

Messaging

Azure Service Bus, RabbitMQ, Kafka, Amazon SQS and AMQP, queues and pub/sub, competing consumers, dead-letter queues, poison messages, message ordering and delivery guarantees (at-most-once, at-least-once and the exactly-once myth).

  1. What is the difference between a queue and a topic (publish/subscribe)? Explain competing consumers, why putting a message broker between two services decouples them, and when you would still make a direct HTTP call instead.

    Covers point-to-point queues versus publish/subscribe topics and subscriptions, the competing consumers pattern, the kinds of decoupling a broker gives (time, location, load) and when synchronous HTTP is still the right choice.

    Junior Theory Messaging Β· πŸ”— 3 follow-ups
  2. How do Azure Service Bus, RabbitMQ, Apache Kafka and Amazon SQS differ? Compare their messaging models, ordering, retention and replay, delivery guarantees and operating cost, and tell me how you would choose one for a new .NET system.

    Compares queue brokers (Azure Service Bus, RabbitMQ, Amazon SQS) with Kafka's partitioned log on model, ordering, retention and replay, delivery guarantees, throughput and operations, and gives a decision approach for .NET teams.

    Intermediate Theory Messaging Β· πŸ”— 3 follow-ups
  3. Explain message delivery guarantees: at-most-once, at-least-once and exactly-once. Why do people call exactly-once delivery a myth, what do Kafka transactions and Service Bus duplicate detection really give you, and how do you get effectively-once processing in a .NET consumer?

    Covers at-most-once and at-least-once delivery, where duplicates come from, why end-to-end exactly-once delivery is impossible over an unreliable network, what broker features (Kafka idempotent producer and transactions, Service Bus duplicate detection, SQS FIFO dedup) actually guarantee, and how idempotent consumers deliver effectively-once processing.

    Mid-Level Theory Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. Write an Azure Service Bus consumer as a .NET 10 hosted service using ServiceBusProcessor. Show how you complete, abandon and dead-letter messages, set concurrency and prefetch, handle lock renewal and cancellation on shutdown, and tell me what delivery guarantee your consumer gives and how it handles duplicates.

    Covers building a production Service Bus consumer with ServiceBusProcessor in a BackgroundService: settlement (complete, abandon, dead-letter), MaxConcurrentCalls and PrefetchCount, auto lock renewal, graceful shutdown with cancellation, error handling, DI with Microsoft.Extensions.Azure and idempotent processing.

    Mid-Level Coding Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  5. How do you keep messages in order in a distributed system? Explain Azure Service Bus sessions, Kafka partition keys and SQS FIFO message groups, what breaks ordering (competing consumers, retries, dead-lettering, repartitioning), and how you design so you don't need global ordering at all.

    Covers why ordering is expensive, per-key ordering with Service Bus sessions, Kafka partitions and SQS FIFO message groups, what breaks order (parallel consumers, retries, DLQ, rebalancing, repartitioning), and design alternatives: commutative updates, version numbers and state-carrying events.

    Mid-Level Theory Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  6. Your Service Bus queue's active message count keeps climbing, the dead-letter queue has thousands of messages, and logs show the same few messages failing over and over. How do you diagnose what is going on, deal with the poison messages and the backlog, and fix it so it doesn't happen again?

    Covers diagnosing a growing Service Bus backlog with poison messages: reading DLQ reasons and properties, distinguishing poison messages from a failing dependency, settlement mistakes that cause loops, safe DLQ resubmission, scaling consumers against the downstream limit, and alerting and testing to prevent recurrence.

    Senior Debugging Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. Explain Kafka for a .NET engineer: topics and partitions, consumer groups, offsets and commits, and rebalancing. What causes consumer lag, how do you commit offsets safely with Confluent.Kafka, and what delivery guarantee does your consumer end up with?

    Covers Kafka's partitioned log model, consumer groups and partition assignment, offset commit strategies in Confluent.Kafka (auto commit, StoreOffset, manual Commit), rebalancing (eager versus cooperative-sticky, max.poll.interval.ms), consumer lag and its causes, and the resulting at-least-once guarantee with idempotent processing.

    Senior Theory Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  8. After a four-hour outage of a downstream system, your Service Bus subscription has a backlog of about 2 million messages, and new messages are still arriving. Walk me through your recovery plan: how you drain it without overwhelming the recovered system, what you do about ordering, duplicates and stale messages, and how you keep the business informed.

    Covers recovering from a 2-million-message backlog after an outage: assessing message types and staleness, throttled draining sized to the downstream, prioritising new traffic, ordering and idempotency during catch-up, discarding or archiving expired messages, monitoring progress and communicating ETAs to stakeholders.

    Senior RealWorldScenario Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  9. Code review: a colleague's Service Bus message handler for OrderPaid calls a third-party shipping API to book a courier, saves a Shipment row with EF Core, and publishes a ShipmentBooked event, with no idempotency and auto-complete turned on. What problems do you find, how do you rank them, and how would you rewrite it?

    Covers reviewing a message handler with side effects: duplicate courier bookings from at-least-once delivery, swallowed exceptions with auto-complete, the dual write between the database and the broker, missing idempotency keys, lost cancellation, blocking calls, logging gaps, and a rewrite using an inbox, outbox and provider idempotency key.

    Senior CodeReview Messaging Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me