I am trying to get rebus with RabbitMQ to retrieving the messages that I have successfully published to the message queue. What am I not doing that needs to be done. below is the example code?
static async Task MainSubscribeAsync()
{
var connection = "amqp://jhgj67546:yjyj5565@localhost";
using (var activator = new BuiltinHandlerActivator())
{
activator.Register(() => new WagonHandler());
var bus = Configure.With(activator)
.Logging(l => l.ColoredConsole())
.Transport(t => t.UseRabbitMq(connection, "wagon_v1")
.ExchangeNames(directExchangeName: "WamosExchange"))
.Start();
await activator.Bus.Subscribe<Wagon>();
Console.WriteLine("Done");
}
}
The handler class looks like this
class WagonHandler : IHandleMessages
{
public async Task Handle(Wagon message)
{
Console.WriteLine($"Token {message.Token}");
Console.WriteLine($"WagonId {message.WagonId}");
}
}