Last active
February 27, 2017 00:59
-
-
Save stdray/e6b8b13138c9b7205357f4a35329ff6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
//пускает цикл | |
Thread.Start(ReceiveLoop) | |
} | |
async void ReceiveLoop() | |
{ | |
while(true) | |
{ | |
//получаем сообщения ассинхронно | |
var msg = await ReceiveMessage(); | |
//отправляем на работу | |
Task.Run(() => DoYoba(msg)); | |
} | |
} | |
async Task DoYoba(YobaMessage msg) | |
{ | |
// получаем прицеп из данных | |
var msgData = await GetYobaMessageData(msg); | |
// процессим | |
var someStepData = DoSomeStep(msgData); | |
// вертаем или как-то ещё фиксируем результат | |
SendSomeResponce(someStepData); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment