Introduction
Recently, we faced a production issue where our web application was not able to write in our queue. Since all writing over queue is encapsulated in COM based Wrapper class which only returns Boolean in case of success or failure, it led us to hours and hours of investigation which led to nowhere. But the same wrapper class works outside of IIS (Desktop version of the application).
In order to improve investigation, we quickly built a sample web application which inserted a message into defined queue.
The above screen creates appropriate messages in the message queue (see below).
Using the Code
The code is extremely simple to use and by nature, self explanatory.
protected void btnSubmit_OnClick(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
try
{
sb.Append("btnSubmit_OnClick Called" + "<BR/>");
System.Messaging.Message msg = new System.Messaging.Message();
sb.AppendLine("Msg.Label => " + txtLabel.Value + "<BR/>");
msg.Label = txtLabel.Value;
sb.AppendLine("Msg.Body => " + txtareaBody.Value + "<BR/>");
msg.Body = txtareaBody.Value;
sb.AppendLine("Initiating Message Queue => " + txtQueueName.Value + "<BR/>");
MessageQueue mq = new MessageQueue(txtQueueName.Value);
sb.AppendLine("Message Queue Exists?" + "<BR/>");
if (MessageQueue.Exists(mq.Path) == false)
{
sb.AppendLine("Message Queue not exist, aborting operation" + "<BR/>");
}
else
{
sb.AppendLine("Message Queue exist" + "<BR/>");
sb.AppendLine("Initiating send message" + "<BR/>");
mq.Send(msg);
sb.AppendLine("Send Message Success" + "<BR/>");
}
}
catch (Exception ex)
{
sb.Append(ex.ToString() + "<BR/>");
}
outputMessage = sb.ToString();
}
This sample application help us in identifying access issues and leads to resolution.
Points of Interest
This sample application help us in identifying access issues and leads to resolution.
History
- 22nd April, 2019: 1.0: First version
Asif embarked on his programming journey back in 1991 when he first encountered 80286 8-16 MHz systems. His programming repertoire began with dBase III+, FoxPro, C, and assembly language, where he honed exceptional skills that have been a cornerstone of his development career.
Over the years, Asif's programming saga has seen him delve into a wide array of technologies and languages, ranging from C++, VC++, Java, Delphi, RPG400, SQL Server, and Oracle, to name just a few. His insatiable curiosity continues to lead him towards newer horizons, such as DOT Net Technologies, SOA architectures, BI, DSL, and beyond. These learning experiences are underscored by a robust theoretical foundation, with a penchant for research.
Beyond the realm of technology, Asif's interests include delving into the pages of fiction, exploring biotechnology, and gazing at the wonders of Astronomy. He finds joy in watching movies, and during his free time, he delights in quality moments spent with his children.