I am new to EasyNetQ and RabbitMQ.Unfortunately I am having problem with consuming messages and I am not sure if its because I am doing the Publish wrong or either my consuming is not correct. I can see by publishing, it does send to queue and consuming it does take it off from the queue. However when message is returned I get null :S I am using IAdvancedBus
Code Snippet for Publishing:
public void send(RegistrationCreatedEvent obj )
{
MessageBus.Publish(Exchange, RoutingKey, true, new Message<RegistrationCreatedEvent>(obj));
}
Code Snippet for Consuming:
public void Receive()
{
MessageBus.Consume(Queue, (messageBody, properties, info) => Task.Factory.StartNew(() =>
{
var stringMessage = Encoding.Default.GetString(messageBody);
json = JsonConvert.DeserializeObject<RegistrationCreatedEvent>(stringMessage);
Console.WriteLine($"Message Received: {json}");
}));
}