[Л/Р 4] Воронкова Лиза #163
226
tasks/voronkova-es/lab_4/.gitignore
vendored
Normal file
@ -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)
|
||||
#####
|
65
tasks/voronkova-es/lab_4/README.md
Normal file
@ -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 тем самым не позволяя очереди накапливать огромное количество сообщений.
|
25
tasks/voronkova-es/lab_4/Receiver/Receiver.sln
Normal file
@ -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
|
25
tasks/voronkova-es/lab_4/Receiver/Receiver/Program.cs
Normal file
@ -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);
|
||||
}
|
14
tasks/voronkova-es/lab_4/Receiver/Receiver/Receiver.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
25
tasks/voronkova-es/lab_4/Receiver_Slow/Receiver_Slow.sln
Normal file
@ -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
|
@ -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);
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
25
tasks/voronkova-es/lab_4/Sender/Sender.sln
Normal file
@ -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
|
25
tasks/voronkova-es/lab_4/Sender/Sender/Program.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
14
tasks/voronkova-es/lab_4/Sender/Sender/Sender.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
BIN
tasks/voronkova-es/lab_4/images/screen_1.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_10.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_11.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_12.png
Normal file
After Width: | Height: | Size: 109 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_2.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_3.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_4.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_5.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_6.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_7.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_8.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
tasks/voronkova-es/lab_4/images/screen_9.png
Normal file
After Width: | Height: | Size: 45 KiB |