Stefan Tsalapatis - 494 - Feb 3, 2014

thank you for the  new ServiceStack.RabbitMQ,  an excellent work.
 A question ,  if the Producer is  external to our system,  how we can make it to work  using the servicestack client - Consumer ?   passing all the information about queues, keys ?  maybe to have  some kind of proxy  mqServer in  servicestack ?
In our case, we read  or modify SIP messages  from an external producer,  via RabbitMQ .  Can we use ServiceStack.RabbitMQ in this case ?   like the RabbitMQ WCF binding  ?
I don’t know a lot from RabbitMQ. I had developed the  consumer-producer for our case, before 2 years, and it works fine till now.
 I should remember again the specifics.

you can use a message factory, e.g:

using (var mqFactory = new RabbitMqMessageFactory(“localhost”))
using (var mqClient = mqFactory.CreateMessageQueueClient())
{
    mqClient.Publish(new Hello { Name = “Foo” });
    var msg = mqClient.Get<Hello>(QueueNames<Hello>.In);

    Assert.That(msg.GetBody().Name, Is.EqualTo(“Foo”));
}

Stefan Tsalapatis:

This is the code for the producer to publish a message. ( Hope I understood it well)
 If I need to consume messages from an external producer,  then in order to receive a raw message, I have to give all information (exchange, type,queue,routing key, host, virtualHost, user, pwd).
How to consume,   specific events from the external source ,  using  the serviceStack Rest  client ?
Like the RabbitMQ WCF binding ?
I had thought before, to create  a proxy service, which will connect to RabbitMQ server and it will filter  the messages and return to clients.

The working example above doesn’t require you to specify any of those details. It automatically uses convention-based names for the Exchange and Queue: 
https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Interfaces/Messaging/QueueNames.cs#L55

Stefan Tsalapatis:

I think  it cannot support our case, to consume messages from an external producer.  Am I wrong  ?
Our case is like that
https://github.com/mdevilliers/SignalR.RabbitMq
or that  https://www.rabbitmq.com/releases/rabbitmq-dotnet-client/v3.0.1/rabbitmq-dotnet-client-3.0.1-wcf-service-model.pdf

I don’t think I understand what you’re asking?
You don’t need to specify an exchange name to consume messages only to publish them, and there’s an overload letting you specify the exchange name: https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.RabbitMq/RabbitMqProducer.cs#L74

You can decouple the above code example and separate the publisher and consumer and have them run from different servers.

But really ServiceStack’s producer/consumer is meant to be used together, if you’re using an producer from a different library, then better to use the low-level RabbitMQ.Client.

Stefan Tsalapatis:

I understood, thanks  for your valuable time and fantastic work.
We consume messages  ( some times we publish also) which are produced from an external system. 
The contract with this system is 
a.   the information to connect
e.g exchange, queue/ routing and credentials.
b. The   provider’s schema  in json.
I have to find a somehow automatic way,  from a REST client to call a service which will read  the messages and return to client. ( with long polling connection perhaps).  
thank you again

Stefan Tsalapatis:

BTW I was talking about an approach  like this http://www.asp.net/signalr/overview/signalr-20/performance-and-scaling/scaleout-in-signalr
no need for answer, simply I mentioned it, thx