-
Notifications
You must be signed in to change notification settings - Fork 12
Configuration "MessageHandlerConfiguration"
Gets or sets the default message time to live value. This is the duration after which the message expires, starting from when the message is sent to the Service Bus. This is the default value used when TimeToLive is not set on a message itself.
Messages older than their TimeToLive value will expire and no longer be retained in the message store. Subscribers will be unable to receive expired messages.
/// <summary>
/// Gets or sets the default message time to live for a subscription. (in seconds)
/// </summary>
public int DefaultMessageTimeToLive {
get {
return defaultMessageTimeToLive;
}
set {
defaultMessageTimeToLive = value;
defaultMessageTimeToLiveSet = true;
}
}
If your handler is not able to handle the message within the configured retries, place the message in the Dead Letter Queue.
/// <summary>
/// Send the letter to the default dead letter queue after the max retries.
/// </summary>
public bool DeadLetterAfterMaxRetries {
get;
set;
}
Gets or sets a value that indicates whether the batched operations are enabled.
/// <summary>
/// Gets or sets a value that indicates whether the batched operations are enabled.
/// </summary>
public bool EnableBatchedOperations {
get;
set;
}
Gets or sets the value that indicates if a subscription has dead letter support when a message expires.
/// <summary>
/// Gets or sets the value that indicates if a subscription has dead letter support when a message expires.
/// </summary>
public bool EnableDeadLetteringOnMessageExpiration {
get;
set;
}
Gets or sets the lock duration time span for the subscription. (in seconds)
/// <summary>
/// Gets or sets the lock duration time span for the subscription. (in seconds)
/// </summary>
/// <remarks>30 seconds to 5 minutes??? Looking for more info.</remarks>
public int LockDuration {
get {
return lockDuration;
}
set {
lockDuration = value;
lockDurationSet = true;
}
}
Gets or sets the maximum number of concurrent calls to the callback the message pump should initiate. This maps to the OnMessageOptions.MaxConcurrentCalls property of the Topic Description.
By setting this to 4, the framework will attempt to keep 4 copies of your handler receiving messages. Because of the IOC resolution, this will not perform as quickly as it would if you implemented the OnMessage loop in your own code, but we also deal with exception handling, retries and object resolution out of the box.
/// <summary>
/// Gets or sets the maximum number of concurrent calls to the callback the message pump should initiate.
/// </summary>
public int MaxConcurrentCalls {
get {
return maxConcurrentCalls;
}
set {
Guard.ArgumentNotZeroOrNegativeValue(value, "value");
maxConcurrentCalls = value;
}
}
Gets or sets the number of maximum calls to your handler.
/// <summary>
/// Gets or sets the number of maximum calls to your handler.
/// </summary>
public int MaxRetries {
get {
return maxDeliveryCount;
}
set {
Guard.ArgumentNotZeroOrNegativeValue(value, "value");
maxDeliveryCount = value;
maxDeliveryCountSet = true;
}
}
This property is designed to allow you to trottle the time that the framework pauses before calling you back.
/// <summary>
/// If we threw an error, pause the provided milliseconds before calling the handler again
/// </summary>
/// <remarks>
/// The goal is to allow the application to have basic retry throttling logic.
/// </remarks>
public int PauseTimeIfErrorWasThrown {
get;
set;
}
You can use PrefetchCount to fetch multiple messages from the server in the same round-trip. This can be useful in scenarios that need lower latency for receiving existing messages from a queue or subscription. Prefetch can also improve throughput depending upon the scenarios as the number of round-trips to the server are reduced.
Prefetch is disabled by default. You can enable it by using this property on the client. You must set PrefetchCount before receiving the first message.
/// <summary>
/// Gets or sets the number of messages that the message receiver can simultaneously request.
/// </summary>
/// <remarks>This is a property of the SubscriptionClient</remarks>
public int PrefetchCount {
get {
return prefetchCount;
}
set {
Guard.ArgumentNotZeroOrNegativeValue(value, "value");
prefetchCount = value;
prefetchCountSet = true;
}
}
If you need retry logic, then you must use PeekLock. If you want the fastest way to receive messages and you know that you will never fail, then use ReceiveAndDelete.
/// <summary>
/// Enumerates the values for the receive mode.
/// </summary>
/// <remarks>
/// PeekLock
/// Specifies the PeekLock receive mode.
/// This mode receives the message but keeps it peek-locked until the receiver abandons the message.
///
/// ReceiveAndDelete
/// Specifies the ReceiveAndDelete receive mode.
///This mode deletes the message after it is received.
/// </remarks>
public ReceiveMode ReceiveMode {
get;
set;
}
This is recommended for all apps unless there is state in your handler. This would be set to true if you were not able to receive multiple calls on the same instance of the handler.
/// <summary>
/// Is the message handler a singleton or instance member?
/// </summary>
public bool Singleton {
get;
set;
}