diff --git a/tasks/voronkova-es/lab_4/.gitignore b/tasks/voronkova-es/lab_4/.gitignore new file mode 100644 index 0000000..71ec0d1 --- /dev/null +++ b/tasks/voronkova-es/lab_4/.gitignore @@ -0,0 +1,226 @@ +# The following command works for downloading when using Git for Windows: +# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore +# +# Download this file using PowerShell v3 under Windows with the following comand: +# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore +# +# or wget: +# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +x64/ +[Bb]in/ +[Oo]bj/ +# build folder is nowadays used for build scripts and should not be ignored +#build/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings +modulesbin/ +tempbin/ + +# EPiServer Site file (VPP) +AppData/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# vim +*.txt~ +*.swp +*.swo + +# Temp files when opening LibreOffice on ubuntu +.~lock.* + +# svn +.svn + +# CVS - Source Control +**/CVS/ + +# Remainings from resolving conflicts in Source Control +*.orig + +# SQL Server files +**/App_Data/*.mdf +**/App_Data/*.ldf +**/App_Data/*.sdf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# OS generated files # +Icon? + +# Mac desktop service store files +.DS_Store + +# SASS Compiler cache +.sass-cache + +# Visual Studio 2014 CTP +**/*.sln.ide + +# Visual Studio temp something +.vs/ + +# dotnet stuff +project.lock.json + +# VS 2015+ +*.vc.vc.opendb +*.vc.db + +# Rider +.idea/ + +# Visual Studio Code +.vscode/ + +# Output folder used by Webpack or other FE stuff +**/node_modules/* +**/wwwroot/* + +# SpecFlow specific +*.feature.cs +*.feature.xlsx.* +*.Specs_*.html + +# UWP Projects +AppPackages/ + +##### +# End of core ignore list, below put you custom 'per project' settings (patterns or path) +##### \ No newline at end of file diff --git a/tasks/voronkova-es/lab_4/README.md b/tasks/voronkova-es/lab_4/README.md new file mode 100644 index 0000000..85be654 --- /dev/null +++ b/tasks/voronkova-es/lab_4/README.md @@ -0,0 +1,65 @@ +# Отчет по лабораторной работе №4 + +Выполнила студентка гр. ИСЭбд-41 Воронкова Е.С. + +## Прохождение tutorial + +Установила RabbitMQ server и erlang + +Прохождение туториала 1: + +Сначала был запущен receiver, который становится в ожидании сообщения. Затем запустили с отдельном терминале sender, который отправил сообщение + +![](images/screen_1.png) + +![](images/screen_2.png) + +Прохождение туториала 2: + +Открыли три терминала: в первых двух запустили поочередно receiver. В третьем терминале запустили sender и отправили пять сообщений. +![](images/screen_3.png) + +В результате эти сообщения были распределены между двумя receiver. + +![](images/screen_4.png) + +![](images/screen_5.png) + +Прохождение туториала 3: + +Сначала в первом терминале запустили receiver, затем во втором запустили sender, и отправили сообщение + +![](images/screen_1.png) + +![](images/screen_2.png) + +## Разработка демонстрационных приложений + +Предметная область:медицина +Запустили приложения по одному экземпляру: + +1. Sender + +![](images/screen_6.png) + +2. Receiver_Slow. + +![](images/screen_8.png) + +3. Receiver. + +![](images/screen_7.png) + +## Результаты выполнения лабораторной работы + +Результат отработки Receiver_Slow: + +![](images/screen_11.png) +![](images/screen_12.png) + +Результат отработки Receiver: + +![](images/screen_9.png) +![](images/screen_10.png) + +Вывод: Receiver принимает сообщения гораздо быстрее, чем Receiver_Slow тем самым не позволяя очереди накапливать огромное количество сообщений. \ No newline at end of file diff --git a/tasks/voronkova-es/lab_4/Receiver/Receiver.sln b/tasks/voronkova-es/lab_4/Receiver/Receiver.sln new file mode 100644 index 0000000..19bcfff --- /dev/null +++ b/tasks/voronkova-es/lab_4/Receiver/Receiver.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33723.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Receiver", "Receiver\Receiver.csproj", "{1CB8C246-779F-4FB5-B1A3-E8375FCE14C3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1CB8C246-779F-4FB5-B1A3-E8375FCE14C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1CB8C246-779F-4FB5-B1A3-E8375FCE14C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1CB8C246-779F-4FB5-B1A3-E8375FCE14C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1CB8C246-779F-4FB5-B1A3-E8375FCE14C3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {797586D4-0A6E-43B6-8857-C0B392679690} + EndGlobalSection +EndGlobal diff --git a/tasks/voronkova-es/lab_4/Receiver/Receiver/Program.cs b/tasks/voronkova-es/lab_4/Receiver/Receiver/Program.cs new file mode 100644 index 0000000..79806d3 --- /dev/null +++ b/tasks/voronkova-es/lab_4/Receiver/Receiver/Program.cs @@ -0,0 +1,25 @@ +using RabbitMQ.Client; +using RabbitMQ.Client.Events; +using System.Text; + +var factory = new ConnectionFactory() { HostName = "localhost:7003" }; +using (var connection = factory.CreateConnection()) +using (var channel = connection.CreateModel()) +{ + channel.QueueDeclare(queue: "", + durable: false, + exclusive: false, + autoDelete: false, + arguments: null); + + var consumer = new EventingBasicConsumer(channel); + consumer.Received += (model, ea) => + { + var body = ea.Body.ToArray(); + var message = Encoding.UTF8.GetString(body); + Console.WriteLine("Received {0}", message); + }; + channel.BasicConsume(queue: "", + autoAck: true, + consumer: consumer); +} \ No newline at end of file diff --git a/tasks/voronkova-es/lab_4/Receiver/Receiver/Receiver.csproj b/tasks/voronkova-es/lab_4/Receiver/Receiver/Receiver.csproj new file mode 100644 index 0000000..a60ec9b --- /dev/null +++ b/tasks/voronkova-es/lab_4/Receiver/Receiver/Receiver.csproj @@ -0,0 +1,14 @@ + + + + Exe + net7.0 + enable + enable + + + + + + + diff --git a/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow.sln b/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow.sln new file mode 100644 index 0000000..0e0b4ec --- /dev/null +++ b/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33723.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Receiver_Slow", "Receiver_Slow\Receiver_Slow.csproj", "{5EB0F390-2D37-46E4-8A8A-8995D08993D9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5EB0F390-2D37-46E4-8A8A-8995D08993D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EB0F390-2D37-46E4-8A8A-8995D08993D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EB0F390-2D37-46E4-8A8A-8995D08993D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EB0F390-2D37-46E4-8A8A-8995D08993D9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {00246D8F-3496-4A4F-BA3C-25A8EFA739EB} + EndGlobalSection +EndGlobal diff --git a/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow/Program.cs b/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow/Program.cs new file mode 100644 index 0000000..1286a5e --- /dev/null +++ b/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow/Program.cs @@ -0,0 +1,26 @@ +using RabbitMQ.Client; +using RabbitMQ.Client.Events; +using System.Text; + +var factory = new ConnectionFactory() { HostName = "localhost:7003" }; +using (var connection = factory.CreateConnection()) +using (var channel = connection.CreateModel()) +{ + channel.QueueDeclare(queue: "", + durable: false, + exclusive: false, + autoDelete: false, + arguments: null); + + var consumer = new EventingBasicConsumer(channel); + consumer.Received += (model, ea) => + { + var body = ea.Body.ToArray(); + var message = Encoding.UTF8.GetString(body); + Console.WriteLine("Received {0}", message); + Thread.Sleep(2000); + }; + channel.BasicConsume(queue: "", + autoAck: true, + consumer: consumer); +} \ No newline at end of file diff --git a/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow/Receiver_Slow.csproj b/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow/Receiver_Slow.csproj new file mode 100644 index 0000000..a60ec9b --- /dev/null +++ b/tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow/Receiver_Slow.csproj @@ -0,0 +1,14 @@ + + + + Exe + net7.0 + enable + enable + + + + + + + diff --git a/tasks/voronkova-es/lab_4/Sender/Sender.sln b/tasks/voronkova-es/lab_4/Sender/Sender.sln new file mode 100644 index 0000000..0d2d6f7 --- /dev/null +++ b/tasks/voronkova-es/lab_4/Sender/Sender.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33723.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sender", "Sender\Sender.csproj", "{D82034C3-125E-4BEC-90F0-CEFCCCD46E9D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D82034C3-125E-4BEC-90F0-CEFCCCD46E9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D82034C3-125E-4BEC-90F0-CEFCCCD46E9D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D82034C3-125E-4BEC-90F0-CEFCCCD46E9D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D82034C3-125E-4BEC-90F0-CEFCCCD46E9D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {23099B07-2AD0-4A20-9671-67D1E50BF17E} + EndGlobalSection +EndGlobal diff --git a/tasks/voronkova-es/lab_4/Sender/Sender/Program.cs b/tasks/voronkova-es/lab_4/Sender/Sender/Program.cs new file mode 100644 index 0000000..4d600fd --- /dev/null +++ b/tasks/voronkova-es/lab_4/Sender/Sender/Program.cs @@ -0,0 +1,25 @@ +using RabbitMQ.Client; +using System.Text; + +var factory = new ConnectionFactory() { HostName = "localhost:7003" }; +using (var connection = factory.CreateConnection()) +using (var channel = connection.CreateModel()) +{ + channel.QueueDeclare(queue: "", + durable: false, + exclusive: false, + autoDelete: false, + arguments: null); + + while (true) + { + Console.WriteLine("Enter your message:"); + string message = Console.ReadLine(); + + var body = Encoding.UTF8.GetBytes(message); + + channel.BasicPublish(exchange: "hello", + body: body); + Console.WriteLine("Sent {0}", message); + } +} \ No newline at end of file diff --git a/tasks/voronkova-es/lab_4/Sender/Sender/Sender.csproj b/tasks/voronkova-es/lab_4/Sender/Sender/Sender.csproj new file mode 100644 index 0000000..a60ec9b --- /dev/null +++ b/tasks/voronkova-es/lab_4/Sender/Sender/Sender.csproj @@ -0,0 +1,14 @@ + + + + Exe + net7.0 + enable + enable + + + + + + + diff --git a/tasks/voronkova-es/lab_4/images/screen_1.png b/tasks/voronkova-es/lab_4/images/screen_1.png new file mode 100644 index 0000000..fc3c37f Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_1.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_10.png b/tasks/voronkova-es/lab_4/images/screen_10.png new file mode 100644 index 0000000..009f6b4 Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_10.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_11.png b/tasks/voronkova-es/lab_4/images/screen_11.png new file mode 100644 index 0000000..7cc33a8 Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_11.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_12.png b/tasks/voronkova-es/lab_4/images/screen_12.png new file mode 100644 index 0000000..85ed4ca Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_12.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_2.png b/tasks/voronkova-es/lab_4/images/screen_2.png new file mode 100644 index 0000000..0badd0e Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_2.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_3.png b/tasks/voronkova-es/lab_4/images/screen_3.png new file mode 100644 index 0000000..6c29ddb Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_3.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_4.png b/tasks/voronkova-es/lab_4/images/screen_4.png new file mode 100644 index 0000000..d4a932b Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_4.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_5.png b/tasks/voronkova-es/lab_4/images/screen_5.png new file mode 100644 index 0000000..ddeb486 Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_5.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_6.png b/tasks/voronkova-es/lab_4/images/screen_6.png new file mode 100644 index 0000000..55c6e2d Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_6.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_7.png b/tasks/voronkova-es/lab_4/images/screen_7.png new file mode 100644 index 0000000..7f6a602 Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_7.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_8.png b/tasks/voronkova-es/lab_4/images/screen_8.png new file mode 100644 index 0000000..f021eeb Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_8.png differ diff --git a/tasks/voronkova-es/lab_4/images/screen_9.png b/tasks/voronkova-es/lab_4/images/screen_9.png new file mode 100644 index 0000000..c52104e Binary files /dev/null and b/tasks/voronkova-es/lab_4/images/screen_9.png differ