Template design for windows service - C #

I get tired of programming, and my self-training leads me to this question. I read about design patterns and wanted to know what a good recommendation this would be.

My test application sends a message to MSMQ. I want to write a Windows service that will listen to this MSMQ, and for every message I receive, I want it to perform a simple database insert.

I looked through the text of this article.

which gave me some information that I needed. In this example, I could do most of my work in

 private static void MyReceiveCompleted(Object source, 
        ReceiveCompletedEventArgs asyncResult)
    {
        // Connect to the queue.
        MessageQueue mq = (MessageQueue)source;

        // End the asynchronous Receive operation.
        Message m = mq.EndReceive(asyncResult.AsyncResult);

        // Display message information on the screen.
        Console.WriteLine("Message: " + (string)m.Body);

        // Restart the asynchronous Receive operation.
        mq.BeginReceive();

        return; 
    }

But is there a specific sample that is a more viable candidate? From reading around, I assume this might be a team template, but I'm not sure if this is the best template. Any ideas or thoughts that will help me better understand the patterns.

, : Head First Design patterns - (sp?)

+3
3

, (-, Windows ..) - .

, , . , .

, ​​ , winforms apps .

+5

WCF , netMsmqBinding msmqIntegrationBinding. , .

WCF System.Messaging.

MSMQ Windows. ServiceHost WCF.

+1

When processing messages from the queue, I like to use Message Dispatcher .

0
source

Source: https://habr.com/ru/post/1703957/


All Articles