rabbitmq-tutorials/dotnet
Marek Majkowski a38a15ba63 cosmetic
2011-05-31 13:09:04 +01:00
..
EmitLog.cs Updated dotnet code. 2011-05-31 13:07:53 +01:00
NewTask.cs Updated dotnet code. 2011-05-31 13:07:53 +01:00
README.md cosmetic 2011-05-31 13:09:04 +01:00
Receive.cs Updated dotnet code. 2011-05-31 13:07:53 +01:00
ReceiveLogs.cs Updated dotnet code. 2011-05-31 13:07:53 +01:00
Send.cs Updated dotnet code. 2011-05-31 13:07:53 +01:00
Worker.cs Updated dotnet code. 2011-05-31 13:07:53 +01:00

Dotnet C# code for RabbitMQ tutorials

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

Requirements

Requirements on Windows

You need the RabbitMQ dotnet client.

You also need to nsure your system can find the C# compiler csc.exe, you may need to add ;C:\WINDOWS\Microsoft.NET\Framework\v3.5 to your Path.

We're suggesting to use the command line (start->run cmd.exe) to compile and run the code. Alternatively you could use Visual Studio, but due to the nature of examples command line is a preferred interface.

Requirements on Linux

You need Mono and RabbitMQ dotnet client.

sudo apt-get install mono-devel
mkdir lib
cd lib
wget http://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v2.4.1/rabbitmq-dotnet-client-2.4.1-dotnet-3.0.zip
unzip rabbitmq-dotnet-client-2.4.1-dotnet-3.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