Domanda

I got a queue with a lot of messages.

I'm requesting 200 messages per read/transaction:

using (var connection = _configuration.ConnectionFactory.OpenConnection())
{
    using (var transaction = connection.BeginTransaction())
    {
        using (var command = connection.CreateCommand())
        {
            command.Transaction = transaction;
            command.CommandText = string.Format(ReadCommand, maxNumberOfMessagesPerRead, _queueName);

Generated SQL:

RECEIVE TOP(200) message_body, conversation_handle FROM [BenchQueue]

But I just get 100 messages per read. Are there a limit in SQL Server or am I doing something wrong?

È stato utile?

Soluzione

A RECEIVE statement will only returns messages belonging to a single conversation group. This is explicitly done in order to simplify processing of correlated messages in multi-threaded environment (max_queue_readers > 1). See Conversation Group Locks for details.

Unless you did any explicit conversation group management, each individual conversation is a separate conversation group. So you probably only have 100 messages per conversation in your queue.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top