Database Reference
In-Depth Information
Sample e-mail notification
We mentioned earlier that normal production is filled with notifications related to checking
queues, tables, processes, tasks, and more for both businesses and operations. We will cre-
ate a console program that just formats an e-mail, reads the error queue in MSMQ, saves
the number of errors in the queue, and sends it via an e-mail. Programs such as these don't
do much work, but they can be added to check tasks, services, and even send log details via
e-mail as time progresses. Some people like to only see e-mails if something is not work-
ing. However, having a daily e-mail that indicates whether all the systems are working or
not is something that is found to be useful; this is because when systems fail, they have a
tendency to have issues with notifications as well.
In this section, we will be using the ConsoleReadTasks solution:
This will be the ConsoleReadTasks solution:
using System.Messaging;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleReadTasks
{
class Program
{
static void Main(string[] args)
{
// Set the machine to read queues and processes
string machineToRead =
System.Environment.MachineName;
/*****
* Checking MSMQ status
* *****/
StringBuilder sendMessage = new StringBuilder();
sendMessage.AppendLine(" Message from Daily
Status Process on " + System.Environment.MachineName);
Search WWH ::




Custom Search