rabbitmq-tutorials/dotnet
2016-02-11 17:10:29 +03:00
..
.gitignore Ignore compilation artifacts 2014-05-29 19:04:11 +04:00
EmitLog.cs remove useless whitespaces in argument list 2015-08-17 14:30:08 +01:00
EmitLogDirect.cs remove useless whitespaces in argument list 2015-08-17 14:30:08 +01:00
EmitLogTopic.cs remove useless whitespaces in argument list 2015-08-17 14:30:08 +01:00
NewTask.cs remove useless whitespaces in argument list 2015-08-17 14:30:08 +01:00
README.md Link to VS version and NuGet package 2015-08-17 14:17:36 +03:00
Receive.cs Use EventingBasicConsumer in tutorials 2015-07-20 12:29:28 +03:00
ReceiveLogs.cs Use EventingBasicConsumer in tutorials 2015-07-20 12:29:28 +03:00
ReceiveLogsDirect.cs remove useless whitespaces in argument list 2015-08-17 14:30:08 +01:00
ReceiveLogsTopic.cs Use EventingBasicConsumer in tutorials 2015-07-20 12:29:28 +03:00
recompile.sh Update for Mono 4.0 2015-07-29 13:23:06 +03:00
RPCClient.cs Adhere to the existing coding style 2015-07-29 13:49:34 +03:00
RPCServer.cs Rewrite .NET RPC Server to use EventingBasicConsumer 2016-02-11 17:10:29 +03:00
Send.cs remove useless whitespaces in argument list 2015-08-17 14:30:08 +01:00
Worker.cs Use EventingBasicConsumer in tutorials 2015-07-20 12:29:28 +03:00

Dotnet C# code for RabbitMQ tutorials

Here you can find the C# code examples for RabbitMQ tutorials.

To successfully use the examples you will need a running RabbitMQ server.

Requirements

Requirements on Windows

You need the RabbitMQ dotnet client.

You also need to ensure your system can find the C# compiler csc.exe, you may need to add ;C:\Windows\Microsoft.NET\Framework\v4.0.30319 (change .NET version to fit your installation) to your PATH.

We're using the command line (start->run cmd.exe) to compile and run the code. Alternatively you could use Visual Studio and NuGet package, but this set of tutorials assumes the command line.

Requirements on Linux

You need Mono and RabbitMQ dotnet client.

sudo apt-get install mono-devel
mkdir lib
cd lib
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_5_4/rabbitmq-dotnet-client-3.5.4-dotnet-4.0.zip
unzip rabbitmq-dotnet-client-3.5.4-dotnet-4.0.zip
cd ..

Code

Tutorial one: "Hello World!"

Windows
csc /r:"RabbitMQ.Client.dll" Send.cs
csc /r:"RabbitMQ.Client.dll" Receive.cs

Send.exe
Receive.exe
Linux
gmcs -r:lib/bin/RabbitMQ.Client.dll Send.cs
gmcs -r:lib/bin/RabbitMQ.Client.dll Receive.cs

MONO_PATH=lib/bin mono Send.exe
MONO_PATH=lib/bin mono Receive.exe

Tutorial two: Work Queues

Windows
csc /r:"RabbitMQ.Client.dll" NewTask.cs
csc /r:"RabbitMQ.Client.dll" Worker.cs

NewTask.exe
Worker.exe
Linux
gmcs -r:lib/bin/RabbitMQ.Client.dll NewTask.cs
gmcs -r:lib/bin/RabbitMQ.Client.dll Worker.cs

MONO_PATH=lib/bin mono NewTask.exe
MONO_PATH=lib/bin mono Worker.exe

Tutorial three: Publish/Subscribe

Windows
csc /r:"RabbitMQ.Client.dll" ReceiveLogs.cs
csc /r:"RabbitMQ.Client.dll" EmitLog.cs

ReceiveLogs.exe
EmitLog.exe
Linux
gmcs -r:lib/bin/RabbitMQ.Client.dll ReceiveLogs.cs
gmcs -r:lib/bin/RabbitMQ.Client.dll EmitLog.cs

MONO_PATH=lib/bin mono ReceiveLogs.exe
MONO_PATH=lib/bin mono EmitLog.exe

Tutorial four: Routing

Windows
csc /r:"RabbitMQ.Client.dll" ReceiveLogsDirect.cs
csc /r:"RabbitMQ.Client.dll" EmitLogDirect.cs

ReceiveLogsDirect.exe
EmitLogDirect.exe
Linux
gmcs -r:lib/bin/RabbitMQ.Client.dll ReceiveLogsDirect.cs
gmcs -r:lib/bin/RabbitMQ.Client.dll EmitLogDirect.cs

MONO_PATH=lib/bin mono ReceiveLogsDirect.exe
MONO_PATH=lib/bin mono EmitLogDirect.exe

Tutorial five: Topics

Windows
csc /r:"RabbitMQ.Client.dll" ReceiveLogsTopic.cs
csc /r:"RabbitMQ.Client.dll" EmitLogTopic.cs

ReceiveLogsTopic.exe
EmitLogTopic.exe
Linux
gmcs -r:lib/bin/RabbitMQ.Client.dll ReceiveLogsTopic.cs
gmcs -r:lib/bin/RabbitMQ.Client.dll EmitLogTopic.cs

MONO_PATH=lib/bin mono ReceiveLogsTopic.exe
MONO_PATH=lib/bin mono EmitLogTopic.exe

Tutorial six: RPC

Windows
csc /r:"RabbitMQ.Client.dll" RPCServer.cs
csc /r:"RabbitMQ.Client.dll" RPCClient.cs

RPCServer.exe
RPCClient.exe
Linux
gmcs -r:lib/bin/RabbitMQ.Client.dll RPCServer.cs
gmcs -r:lib/bin/RabbitMQ.Client.dll RPCClient.cs

MONO_PATH=lib/bin mono RPCServer.exe
MONO_PATH=lib/bin mono RPCClient.exe