Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1034247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:21:33+00:00 2026-05-16T14:21:33+00:00

Looking for some ideas/pattern to solve a design problem for a system I will

  • 0

Looking for some ideas/pattern to solve a design problem for a system I will be starting work on soon. There is no question that I will need to use some sort of messaging (probably MSMQ) to communicate between certain areas of the system. I don’t want to reinvent the wheel, but at the same time I want to make sure I am using the right tool for the job. I have been tinkering with and reading up on NServiceBus, and I’m very impressed with what it does–however I’m not sure it’s intended for what I’m trying to achieve.

Here is a (hopefully) very simple and conceptual description of what the system needs to do:

I have a service that clients can send messages to. The service is “Fire and Forget”–the most the client would get back is something that may say success or failure (success being that the message was received).

The handling/processing of each message is non-trivial, and may take up significant system resources. For this reason only X messages can be handled concurrently, where X is a configurable value (based on system specs, etc.). Incoming messages will be stored in queue until it’s “their turn” to be handled.

For each client, messages must be handled in order (FIFO). However, some clients may send many messages in succession (thousands or more), for example if they lost connectivity for a period of time. For this reason, messages must be handled in a round-robin fashion across clients–no client is allowed to gorge and no client is allowed to starve. So the system will either have to be able to query the queue for a specific client, or create separate queues per client (automatically, since the clients won’t be known at compile time) and pull from them in rotation.

My current thinking is that I really just need to use vanilla MSMQ, create a service to accept messages and write them to one or more queues, then create a process to read messages from the queue(s) and handle/process them. However, the reliability, auditing, scaleability, and ease of configuration you get with something like NServicebus looks very appealing.

Is an ESB the wrong tool for the job? Is there some other technology or pattern I should be looking at?

Update

A few clarifications.

Regarding processing messages “in order”–in the context of a single client, the messages absolutely need to be processed in the order they are received. It’s complicated to explain the exact reasons why, but this is a firm requirement. I neglected to mention that only one message per client would ever be processed concurrently. So even if there were 10 worker threads and only one client had messages waiting to be processed, only one of those messages would be processed at a time–there would be no worry of a race condition.

I believe this is generally possible with vanilla MSMQ–that you can have a list of messages in a queue and always take the oldest one first.

I also wanted to clarify a use case for the round robin ordering. In this example, I have two clients (A and B) who send messages, and only one worker thread. All queues are empty. Client A has lost connectivity overnight, so at 8am sends 1000 messages to the service. These messages get queued up and the worker thread takes the oldest one and starts processing it. As this first message is being processed, client B sends a message into the service, which gets queued up (as noted, probably in a separate queue). When Client A’s first message completes processing, the logic should check whether client B has a message (it’s client B’s “turn”), and since it finds one, process it next.

If client B hadn’t sent a message during that time, the worker would continue processing client A’s messages one at a time, always checking after processing to see if other client queues contained waiting messages to ensure that no client was being starved.

Where I still feel there may be a mismatch between an ESB and this problem is that an ESB is designed to facilitate communication between services; what I am trying to achieve is a combination of messaging/communication and a selective queuing system.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:21:34+00:00Added an answer on May 16, 2026 at 2:21 pm

    So the system will either have to be
    able to query the queue for a specific client,

    Searching through an MSMQ queue for a message from a particular client using cursors can be inefficient and doesn’t scale.

    or create separate queues per client (automatically, since the
    clients won’t be known at compile time) and pull from them in rotation.

    MSMQ cannot create queues automatically. All messages have to be sent to a known queue first. Your own custom dispatcher service, though, could then create new queues on demand and put copies of the messages in them.

    [[I avoid saying “move” messages as you can’t do that with application code; you can only read a message and create a new message using the original data. This distinction is important when you are using Source Journaling, for example.]]

    Cheers

    John Breakwell

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 539k
  • Answers 539k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You mean, by hand? By hand, you grab the instruction… May 17, 2026 at 2:15 am
  • Editorial Team
    Editorial Team added an answer Chances are high that the TrackingSystem object on which you're… May 17, 2026 at 2:15 am
  • Editorial Team
    Editorial Team added an answer According to your comment, tsk is a variable. You can't… May 17, 2026 at 2:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm looking for some architecture ideas on a problem at work that I may
I'm currently looking at a simple programming problem that might be fun to optimize
I'm looking for some input for a challenge that I'm currently facing. I have
I am looking for some creative ideas for making numbers clickable in PDF file.
I know there is no simple answer to my question but I would appreciate
I'm having a system that collects real-time Apache log data from about 90-100 Web
I am halfway through an OOP project in the finance industry, and I'm looking
I am looking for a way to inject values from the fragment (#) of
I have a collection of domain objects that I need to convert into another
Sometimes I'm writing ugly if-else statements in C# 3.5; I'm aware of some different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.