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 8983789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:55:40+00:00 2026-06-15T20:55:40+00:00

Just getting my head around message queues and Redis MQ , excellent framework. I

  • 0

Just getting my head around message queues and Redis MQ, excellent framework.

I understand that you have to use .RegisterHandler(…) to determine which handler will process the type of message/event that is in the message queue.

So if I have EventA, EventB etc should I have one Service which handles each of those Events, like :

public class DomainService : Service {

    public object Any(EventA eventA) {...}
    public object Any(EventB eventA) {...}
}

So these should be only queue/redis list created?

Also, what If I want a chain of events to happen, so for example a message of type EventA also has a handler that sends an Email providing handlers earlier on the chain are successful?

  • 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-15T20:55:42+00:00Added an answer on June 15, 2026 at 8:55 pm

    ServiceStack has no distinction between services created for MQ’s, REST, HTML or SOAP services, they’re the same thing. i.e. they each accept a Request DTO and optionally return a Response DTO and the same service can handle calls from any endpoint or format, e.g HTML, REST, SOAP or MQ.

    Refer to ServiceStack’s Architecture diagram to see how MQ fits in.

    Limitations

    The only things you need to keep in mind are:

    • Like SOAP, MQ’s only support 1 Verb so your methods need to be named Post or Any
    • Only Action Filters are executed (i.e. not Global or Attribute filters)
    • You get MqRequest and MqResponse stubs in place of IHttpRequest, IHttpResponse. You can still use .Items to pass data through the request pipeline but any HTTP actions like setting cookies or HTTP Headers are benign

    Configuring a Redis MQ Host

    The MQ Host itself is completely decoupled from the rest of the ServiceStack framework, who doesn’t know the MQ exists until you pass the message into ServiceStack yourself, which is commonly done inside your registered handler, e.g:

    var redisFactory = new PooledRedisClientManager("localhost:6379");
    var mqHost = new RedisMqServer(redisFactory, retryCount:2);
    
    mqHost.RegisterHandler<Hello>(m => {
        return this.ServiceController.ExecuteMessage(m);
    });
    
    //shorter version:
    //mqHost.RegisterHandler<Hello>(ServiceController.ExecuteMessage);
    
    
    mqHost.Start(); //Starts listening for messages
    

    In your RegisterHandler<T> you specify the type of Request you want it to listen for.

    By default you can only Register a single handler for each message and in ServiceStack a Request is tied to a known Service implementation, in the case of MQ’s it’s looking for a method signature first matching: Post(Hello) and if that doesn’t exist it looks for the fallback Any(Hello).

    Can add multiple handlers per message yourself

    If you want to invoke multiple handlers then you would just maintain your own List<Handler> and just go through and execute them all when a request comes in.

    Calling different services

    If you want to call a different service, just translate it to a different Request DTO and pass that to the ServiceController instead.

    When a MQ Request is sent by anyone, e.g:

    mqClient.Publish(new Hello { Name = "Client" });
    

    Your handler is invoked with an instance of type IMessage where the Request DTO is contained in the Body property. At that point you can choose to discard the message, validate it or alter it.

    MQ Requests are the same as any other Service requests

    In most cases you would typically just forward the message on to the ServiceController to process, the implementation of which is:

    public object ExecuteMessage<T>(IMessage<T> mqMsg)
    {
        return Execute(mqMsg.Body, new MqRequestContext(this.Resolver, mqMsg));
    }
    

    The implementation just extracts the Request DTO from the mqMsg.Body and processes that message as a normal service being passed a C# Request DTO from that point on, with a MqRequestContext that contains the MQ IHttpRequest, IHttpResponse stubs.

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

Sidebar

Related Questions

I'm just getting my head around java (and OOP for that matter), the only
Im just getting my head around java and eclipse. Im trying to use the
I'm just getting my head around Coffescript and have come across a requirement to
Just getting my head around WCF, so forgive me for the inelegant coding. The
I'm having a hard time getting my head around this, and Google just isn't
Just getting my head around Linq and having lots of fun! Can any one
I'm just getting my head around insert statements today after getting sick of cheating
The problem is not that difficult, I just can't get my head around it
I'm just getting into JavaScript and I'm trying to wrap my head around prototypal
I've just started learning LISP and I'm just getting my head around the logic

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.