Hello,
in one of our projects we want to exchange messages between mobile devices and servers using RabbitMQ.
RabbitMQ provides a .net client library, but there is no PCL or compatible nuget packages available for it.
We tried building our own PCL from the .net client sources, but the client is using System.Net.Security and System.Net.Sockets and those are not available in the .net portable subset.
But there is another simple way to use the RabbitMQ Client in Xamarin.Forms by using a Shared Project.
You will need Visual Studio for this.
Here are the necessary steps:
get the sources for the RabbitMQ .Net Client from their website at http://www.rabbitmq.com/download.html or github at https://github.com/rabbitmq/rabbitmq-dotnet-client
find the file named "Local.props.examples" and rename it to "Local.props"
Open the solution in Visual Studio
Build the RabbitMQ.Client. This will generate a new source file in /gensrc/RabbitMQ.Client named autogenerated-api-0-9-1.cs
Create your own Shared Project to use in your Xamarin.Forms projects
Include all source files from /projects/client/RabbitMQ.Client/src in your Shared Project
Include the autogenerated sourcefile from /gensrc/RabbitMQ.Client in your Shared Project
Add a reference to your Shared Project to the platform specific projects.
Now to use the RabbitMQ.Client you will need to use the Xamarin.Forms DependencyService ( see https://developer.xamarin.com/guides/cross-platform/xamarin-forms/dependency-service/ ) and implement classes in the platform specific projects to connect to the RabbitMQ Servers to exchange messages.
I hope this helps other developers who want to use messaging services.
Regards,
Dirk