Skip to content

Commit bb5a40a

Browse files
committed
update documentation
1 parent 9b322d4 commit bb5a40a

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

README.md

+20-4
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@ The [AzureBusServer](src\ServiceStack.AzureServiceBus\AzureBusServer.cs) has the
4747
- `int` **RetryCount** - How many times a message should be retried before sending to the DLQ.
4848
- `string` **connectionString** - The connection string to the Azure Service Bus namespace
4949
- `IMessageFactory` **MessageFactory** - the MQ Message Factory used by this MQ Server
50+
- `Action<QueueDescription>` **CreateQueueFilter** - A filter to customize the options Azure Queues are created/updated with.
5051

51-
As an alternative to the connection string, you can pass an instance of `AzureBusMessageFactory` to the `AzureBusServer` constructor allowing you to provide your own [NamespaceManager](https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.namespacemanager?redirectedfrom=MSDN&view=azureservicebus-4.1.1#microsoft_servicebus_namespacemanager) and [MessagingFactory](https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.messagingfactory?view=azureservicebus-4.1.1)
52+
As an alternative to a connection string, you can pass an instance of `AzureBusMessageFactory` to the `AzureBusServer` constructor and provide your own [NamespaceManager](https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.namespacemanager?redirectedfrom=MSDN&view=azureservicebus-4.1.1#microsoft_servicebus_namespacemanager) and [MessagingFactory](https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.messagingfactory?view=azureservicebus-4.1.1).
5253

53-
Starting the MQ Server will create up to 2 threads for each handler, one to listen to the Message Inbox `mq-{RequestDto}.inq` and another to listen on the Priority Queue located at `mq-{RequestDto}.priorityq`.
54+
Starting the MQ Server will create up to 2 threads for each handler, one to listen to the Message Inbox `{RequestDto}.inq` and another to listen on the Priority Queue located at `{RequestDto}.priorityq`.
5455

55-
> Queue names are limited to alphanumeric, period, hyphen and underscore in Azure Service Bus. As such, names from the ServiceStack utility [QueueNames<T>](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Messaging/QueueNames.cs) will differ from the actual queue name.
56+
> Queue names are limited to alphanumeric, period, hyphen and underscore in Azure Service Bus. As such, the default prefixes from [QueueNames](https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Messaging/QueueNames.cs) and the queue name resolver get overriden by `AzureBusMessageFactory`. The deadletter queue name resolves to `RequestDto.inq/$deadletterqueue`.
57+
> Finally, note that queue names are case-insensitive in Azure Service Bus.
5658
5759
By default, only 1 thread is allocated to handle each message type, but like the other MQ Servers is easily configurable at registration:
5860

@@ -62,9 +64,23 @@ mqServer.RegisterHandler<Hello>(m => { .. }, noOfThreads:4);
6264

6365
> Behind the scenes, it delegates the work to Azure Service Bus [event-driven message pump](https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.messagereceiver.onmessage?view=azureservicebus-4.1.1#Microsoft_ServiceBus_Messaging_MessageReceiver_OnMessage_System_Action_Microsoft_ServiceBus_Messaging_BrokeredMessage__Microsoft_ServiceBus_Messaging_OnMessageOptions_).
6466
67+
### Filters
68+
69+
To modify the options a queue gets created with, provide a `CreateQueueFilter` filter and modify the `QueueDescription`.
70+
71+
For instance, to change the default TTL and have messages expire automatically after 2 minutes:
72+
```
73+
container.Register<IMessageService>(c => new AzureBusServer(ConnectionString) {
74+
CreateQueueFilter = (description) => {
75+
description.DefaultMessageTimeToLive = TimeSpan.FromMinutes(2);
76+
}
77+
});
78+
```
79+
80+
When the queue already exits, the filter can also be used to update the queue options in the same manner.
81+
6582
## Upcoming Features
6683

67-
- [X] queue creation filter
6884
- [ ] queue whitelisting
6985
- [ ] request and response global filter
7086
- [ ] error handler

0 commit comments

Comments
 (0)