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

  • SEARCH
  • Home
  • 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 8286913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:54:11+00:00 2026-06-08T11:54:11+00:00

My system uses The Command Pattern with separate handlers. My commands are executed on

  • 0

My system uses The Command Pattern with separate handlers. My commands are executed on a CommandService which currently handles all commands in-process.

I have certain commands which do at least 1 of these things that are slow operations:

  1. Sends an email
  2. Generates a PDF
  3. Sends a Fax
  4. Interacts with 3rd party web services

I want all of these commands to be handled out of process so that the UI is more snappy.

Should I use a messaging bus just for these commands, or should I have the in-process command handler call BeginInvoke()?

Edit – Additional Info

The system has a small number of users (maybe 100 concurrent on a busy day), so the queue would likely never get very long. The main thing here is to reduce the amount of time the UI is blocked when sending an email with an attached PDF (the command in question). The employees have to execute that command many times in a day.

With the entire situation in mind, I think I’m going to go with BeginInvoke() for now for several reasons:

  1. All the UI interactions would have to be touched to make sure that they behave as though the command succeeded. The reminder of “you need to send this document” is in multiple places in the UI and it does a full page refresh once the report is sent.
  2. It’s the middle of my client’s busy season (they do over 50% of their yearly business in the summer), so it doesn’t seem wise to me at this time to introduce a whole new piece of infrastructure that I’m unfamiliar with administering.

But knowing what I know now, on a new system I would use a service bus from the get-go for any slow commands (virtually every system needs to send an email) and design the UI so that commands could more easily be switched from synchronous to asynchronous processing. In implementation, that basically means every POST is AJAX and performs an action in the UI as if it succeeded. (For an example of this, check out how Facebook handles comments.)

  • 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-06-08T11:54:13+00:00Added an answer on June 8, 2026 at 11:54 am

    Both solutions has their pros and cons.

    • BeginInvoke is deadly simple solution and its semantic it is same as just calling a handler by command directly. But this solution depends on threading infrastructure: max thread numbers, frozen thread due to concurrent access to the IO resources etc.
    • MessageBus is very flexible and powerful solution where you can control every aspect of commands handling process. But it introduces another abstraction layer to your application that would be an overengineering in case when simpler means better

    I’d recommend to estimate your system loading requirements, number of these background tasks, growing factor etc and depends on that to make a decision.

    But in my personal opinion introducing a bus solution fitting @ 80% of cases. You can introduce a naive bus implementation that will be possible to extend on the next iterations if needed.

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

Sidebar

Related Questions

I have a process x which uses system C function to start ntpd daemon.
I have a java app that uses ProcessBuilder to prepare an operating system command
For a system monitoring Java application which currently runs on the command line and
I have a small command line program that uses the Team System API. When
I'm in the process of writing a compiled C application which uses the system()
I have a C# program that uses System.Data.OracleClient to access an oracle database. The
I'm using a data transmission system which uses a fixed SYNC word (0xD21DB8) at
I'm working on a program which uses the System.Diagnostics.Debugger.Break() method to allow the user
I have my system set up to compile jee6 code from the command line
Has anybody ever seen/attempted to write a service locator pattern which uses a Guice

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.