Skip to content

Instantly share code, notes, and snippets.

@jlyman
Created September 5, 2012 21:10
Show Gist options
  • Save jlyman/3644816 to your computer and use it in GitHub Desktop.
Save jlyman/3644816 to your computer and use it in GitHub Desktop.
MassTransit creating 6 copies of an errored out message with RabbitMQ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MassTransit;
namespace JMMQConsoleApp
{
class Program
{
public class YourMessage { public string Text { get; set; } }
static void Main(string[] args)
{
Bus.Initialize(sbc =>
{
sbc.UseRabbitMqRouting();
sbc.ReceiveFrom("rabbitmq://localhost/test_queue");
sbc.Subscribe(subs =>
{
subs.Handler<YourMessage>(msg =>
{
throw new Exception("Bombing out intentionally.");
});
});
});
Bus.Instance.Publish(new YourMessage { Text = "Hi" });
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment