Skip to main content

RedisMqServer

Creates a Redis MQ Server that processes each message on its own background thread. i.e. if you register 3 handlers it will create 7 background threads:

  • 1 listening to the Redis MQ Subscription, getting notified of each new message
  • 3x1 Normal InQ for each message handler
  • 3x1 PriorityQ for each message handler (Turn off with DisablePriorityQueues)

When RedisMqServer Starts it creates a background thread subscribed to the Redis MQ Topic that listens for new incoming messages. It also starts 2 background threads for each message type:

  • 1 for processing the services Priority Queue and 1 processing the services normal Inbox Queue.

Priority Queue's can be enabled on a message-per-message basis by specifying types in the OnlyEnablePriorityQueuesForTypes property. The DisableAllPriorityQueues property disables all Queues.

The Start/Stop methods are idempotent i.e. It's safe to call them repeatedly on multiple threads and the Redis MQ Server will only have Started or Stopped once.

Assembly: ServiceStack.Server.dll
View Source
Declaration
public class RedisMqServer : object, IMessageService

Properties

RetryCount

View Source
Declaration
public int RetryCount { get; set; }

WaitBeforeNextRestart

View Source
Declaration
public TimeSpan? WaitBeforeNextRestart { get; set; }

MessageFactory

View Source
Declaration
public IMessageFactory MessageFactory { get; }

ReplyClientFactory

View Source
Declaration
public Func<string, IOneWayClient> ReplyClientFactory { get; set; }

RequestFilter

Execute global transformation or custom logic before a request is processed. Must be thread-safe.

View Source
Declaration
public Func<IMessage, IMessage> RequestFilter { get; set; }

ResponseFilter

Execute global transformation or custom logic on the response. Must be thread-safe.

View Source
Declaration
public Func<object, object> ResponseFilter { get; set; }

ErrorHandler

Execute global error handler logic. Must be thread-safe.

View Source
Declaration
public Action<Exception> ErrorHandler { get; set; }

PriorityQueuesWhitelist

If you only want to enable priority queue handlers (and threads) for specific msg types

View Source
Declaration
public string[] PriorityQueuesWhitelist { get; set; }

DisablePriorityQueues

Don't listen on any Priority Queues

View Source
Declaration
public bool DisablePriorityQueues { set; }

RedisPubSub

View Source
Declaration
public IRedisPubSubServer RedisPubSub { get; set; }

ClientsManager

View Source
Declaration
public IRedisClientsManager ClientsManager { get; }

PublishResponsesWhitelist

Opt-in to only publish responses on this white list. Publishes all responses by default.

View Source
Declaration
public string[] PublishResponsesWhitelist { get; set; }

DisablePublishingResponses

Don't publish any response messages

View Source
Declaration
public bool DisablePublishingResponses { set; }

PublishToOutqWhitelist

Opt-in to only publish .outq messages on this white list. Publishes all responses by default.

View Source
Declaration
public string[] PublishToOutqWhitelist { get; set; }

DisablePublishingToOutq

Don't publish any messages to .outq

View Source
Declaration
public bool DisablePublishingToOutq { set; }

RegisteredTypes

View Source
Declaration
public List<Type> RegisteredTypes { get; }

CaptureEvents

View Source
Declaration
public bool CaptureEvents { get; set; }

Fields

DefaultRetryCount

View Source
Declaration
public const int DefaultRetryCount = null

Methods

CreateMessageQueueClient()

View Source
Declaration
public IMessageQueueClient CreateMessageQueueClient()
Returns

ServiceStack.Messaging.IMessageQueueClient

GetCapturedEvents()

View Source
Declaration
public string GetCapturedEvents()
Returns

System.String

RegisterHandler<T>(Func<IMessage<T>, Object>)

View Source
Declaration
public void RegisterHandler<T>(Func<IMessage<T>, object> processMessageFn)
Parameters
TypeName
Func<ServiceStack.Messaging.IMessage<<T>>,System.Object>processMessageFn
Type Parameters
  • T

RegisterHandler<T>(Func<IMessage<T>, Object>, Int32)

View Source
Declaration
public void RegisterHandler<T>(Func<IMessage<T>, object> processMessageFn, int noOfThreads)
Parameters
TypeName
Func<ServiceStack.Messaging.IMessage<<T>>,System.Object>processMessageFn
System.Int32noOfThreads
Type Parameters
  • T

RegisterHandler<T>(Func<IMessage<T>, Object>, Action<IMessageHandler, IMessage<T>, Exception>)

View Source
Declaration
public void RegisterHandler<T>(Func<IMessage<T>, object> processMessageFn, Action<IMessageHandler, IMessage<T>, Exception> processExceptionEx)
Parameters
TypeName
Func<ServiceStack.Messaging.IMessage<<T>>,System.Object>processMessageFn
Action<ServiceStack.Messaging.IMessageHandler,ServiceStack.Messaging.IMessage<<T>>,Exception>processExceptionEx
Type Parameters
  • T

RegisterHandler<T>(Func<IMessage<T>, Object>, Action<IMessageHandler, IMessage<T>, Exception>, Int32)

View Source
Declaration
public void RegisterHandler<T>(Func<IMessage<T>, object> processMessageFn, Action<IMessageHandler, IMessage<T>, Exception> processExceptionEx, int noOfThreads)
Parameters
TypeName
Func<ServiceStack.Messaging.IMessage<<T>>,System.Object>processMessageFn
Action<ServiceStack.Messaging.IMessageHandler,ServiceStack.Messaging.IMessage<<T>>,Exception>processExceptionEx
System.Int32noOfThreads
Type Parameters
  • T

CreateMessageHandlerFactory<T>(Func<IMessage<T>, Object>, Action<IMessageHandler, IMessage<T>, Exception>)

View Source
Declaration
protected IMessageHandlerFactory CreateMessageHandlerFactory<T>(Func<IMessage<T>, object> processMessageFn, Action<IMessageHandler, IMessage<T>, Exception> processExceptionEx)
Returns

ServiceStack.Messaging.IMessageHandlerFactory

Parameters
TypeName
Func<ServiceStack.Messaging.IMessage<<T>>,System.Object>processMessageFn
Action<ServiceStack.Messaging.IMessageHandler,ServiceStack.Messaging.IMessage<<T>>,Exception>processExceptionEx
Type Parameters
  • T

OnError(Exception)

View Source
Declaration
public void OnError(Exception ex)
Parameters
TypeName
Exceptionex

OnEvent(String)

View Source
Declaration
public void OnEvent(string message)
Parameters
TypeName
System.Stringmessage

OnStart()

View Source
Declaration
public void OnStart()

OnStop()

View Source
Declaration
public void OnStop()

OnInit()

View Source
Declaration
public void OnInit()

OnMessage(String, String)

View Source
Declaration
public void OnMessage(string channel, string msg)
Parameters
TypeName
System.Stringchannel
System.Stringmsg

Start()

View Source
Declaration
public void Start()

Stop()

View Source
Declaration
public void Stop()

Restart()

View Source
Declaration
public void Restart()

NotifyAll()

View Source
Declaration
public void NotifyAll()

StartWorkerThreads()

View Source
Declaration
public void StartWorkerThreads()

ForceRestartWorkerThreads()

View Source
Declaration
public void ForceRestartWorkerThreads()

StopWorkerThreads()

View Source
Declaration
public void StopWorkerThreads()

GetStats()

View Source
Declaration
public IMessageHandlerStats GetStats()
Returns

ServiceStack.Messaging.IMessageHandlerStats

GetStatus()

View Source
Declaration
public string GetStatus()
Returns

System.String

GetStatsDescription()

View Source
Declaration
public string GetStatsDescription()
Returns

System.String

Dispose()

View Source
Declaration
public virtual void Dispose()

WorkerThreadsStatus()

View Source
Declaration
public List<string> WorkerThreadsStatus()
Returns

List<System.String>

ExpireTemporaryQueues(Int32)

View Source
Declaration
public long ExpireTemporaryQueues(int afterMs = null)
Returns

System.Int64

Parameters
TypeName
System.Int32afterMs

Implements