Here you can find the C# code examples for RabbitMQ tutorials.
To successfully use the examples you will need a running RabbitMQ server.
You need the RabbitMQ dotnet client.
- Download RabbitMQ .NET client
- Extract it and copy "RabbitMQ.Client.dll" to your working folder.
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.
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 ..
csc /r:"RabbitMQ.Client.dll" Send.cs
csc /r:"RabbitMQ.Client.dll" Receive.cs
Send.exe
Receive.exe
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
csc /r:"RabbitMQ.Client.dll" NewTask.cs
csc /r:"RabbitMQ.Client.dll" Worker.cs
NewTask.exe
Worker.exe
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
csc /r:"RabbitMQ.Client.dll" ReceiveLogs.cs
csc /r:"RabbitMQ.Client.dll" EmitLog.cs
ReceiveLogs.exe
EmitLog.exe
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
csc /r:"RabbitMQ.Client.dll" ReceiveLogsDirect.cs
csc /r:"RabbitMQ.Client.dll" EmitLogDirect.cs
ReceiveLogsDirect.exe
EmitLogDirect.exe
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
csc /r:"RabbitMQ.Client.dll" ReceiveLogsTopic.cs
csc /r:"RabbitMQ.Client.dll" EmitLogTopic.cs
ReceiveLogsTopic.exe
EmitLogTopic.exe
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
csc /r:"RabbitMQ.Client.dll" RPCServer.cs
csc /r:"RabbitMQ.Client.dll" RPCClient.cs
RPCServer.exe
RPCClient.exe
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