I have an issue I don't fully understand. When I create message this way it works:
var message = new StartFakeJobCommand();
using (var publishChannel = ApplicationSingleton.Instance.RabbitBus.OpenPublishChannel())
{
publishChannel.Publish(message);
}
A message is put on the queue and my listener can consume it. But when I create a message using Activator.CreateInstance like this it does not work. Nothing is published to the queue.
var t = Type.GetType(string.Format("{0}.{1},{2}", job.CommandNamespace, job.Command, job.AssemblyName));
if (t == null)
throw new ArgumentException();
var message = Activator.CreateInstance(t);
using (var publishChannel = ApplicationSingleton.Instance.RabbitBus.OpenPublishChannel())
{
publishChannel.Publish(message);
}
During debugging I can clearly see that the same type is created using both methods. Any idea why the second approach does not work?
This is how i subscribe to the message:
bus.Subscribe<StartFakeJobCommand>("StartFakeJobCommand_ID", message => fakeJob.Handle(message));