You need to compare what is comparable. You cannot compare the browse to the destructive get while running both. If you are running both, the messages you are trying to browse are being consumed right away and you have a hard time browsing anything. On top of that you are scanning the queue every 5 seconds for the browse cursor to refresh... not ideal at the message rate you're seeing...
On the other hand, I would not trust the encoding.default to transform the bytes to a string... Check the message's ccsid...
If the message format is MQFMT_STRING, let MQ do the conversion to string by casting to a TextMessage...
Hope it helps...
------------------------------
Francois Brandelik
------------------------------
Original Message:
Sent: Fri September 30, 2022 02:10 AM
From: Ram Subba Rao Chalamalasetti
Subject: QueueBrowser vs MessageConsumer
As Andy was saying the numbers which you are mentioning are way too low for both BROWSE & GET. What is the size of the message and how are you calculating the time ?
------------------------------
Ram Subba Rao Chalamalasetti
Original Message:
Sent: Tue September 27, 2022 11:05 AM
From: Balaji Patil
Subject: QueueBrowser vs MessageConsumer
Dear Team,
When we compare QueueBrowser with MessageConsumer, QueueBrowser is very slow.
QueueBrowser is taking approx 1 min to process 100 messages where as consumer is processing ~840 messages.
This mush difference is expected? can you please suggest if anything needs to be changed in the below code:
queueEnum = queueBrowserIn.GetEnumerator(); while (true) { if (queueEnum.MoveNext()) { messageCount++; LogWrite($"Message No - {messageCount} - Method: ProcessNewMesage" + DateTime.Now); IBytesMessage bytesMessage = queueEnum.Current as IBytesMessage; if (bytesMessage != null) { byte[] arrayMessage = new byte[bytesMessage.BodyLength]; bytesMessage.ReadBytes(arrayMessage); string message = System.Text.Encoding.Default.GetString(arrayMessage); } } }
------------------------------
Balaji Patil
------------------------------