tags:

views:

20

answers:

0

Within ActiveMQ I've been told that the most optimal solution for increased throughput is to have multiple connections, each with their own session and consumer.

I've been trying to achieve this with NMS (Connecting via C#), but in the "Active Consumwers" screen of the MQ web console, I'm seeing all my connections & consumers listed as I'd expect to see them, but in the next column they all have a sessionId of "1". I would have expected there to be a separate session ID for each.

Is this right? And if there should be different session IDs for each connection/consumer, how would I go about ensuring these extra sessions are created?

Here's some example code I'm using to start a new connection (this is based on Remarks ActiveMQ transactional messaging introduction code):

public QueueConnection(IConnectionFactory connectionFactory, string queueName, AcknowledgementMode acknowledgementMode)
{
    this.connection = connectionFactory.CreateConnection();
    this.connection.Start();

    this.session = this.connection.CreateSession(acknowledgementMode);

    this.queue = new ActiveMQQueue(queueName);
}

... and this is being done each time for each of the connections I'm opening.