config.Subscribe(subs => { // using the LoadFrom causes an ArgumentOutOfRangeException to be throw // subs.LoadFrom(container); subs.Consumer<TestMessage1Consumer>().Permanent(); });
<package id="Magnum" version="2.1.3" targetFramework="net45" /> <package id="MassTransit" version="2.9.9" targetFramework="net45" /> <package id="MassTransit.AzureServiceBus" version="0.4.1" targetFramework="net45" /> <package id="MassTransit.StructureMap" version="2.9.9" targetFramework="net45" /> <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.1.0" targetFramework="net45" /> <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" /> <package id="structuremap" version="3.1.4.143" targetFramework="net45" /> <package id="WindowsAzure.ServiceBus" version="2.6.2" targetFramework="net45" />
class Program { static void Main(string[] args) { var container = StructureMapFactory.Container;
var bus = ServiceBusFactory.New(config => { var azureNamespace = ConfigurationManager.AppSettings["ServiceBus.Namespace"]; var queueUri = "azure-sb://" + azureNamespace + "/TestCloudSubscriber3";
config.ReceiveFrom(queueUri);
config.UseAzureServiceBus(a => a.ConfigureNamespace(azureNamespace, h => { h.SetKeyName("RootManageSharedAccessKey"); h.SetKey(ConfigurationManager.AppSettings["ServiceBus.Key"]); })); config.UseAzureServiceBusRouting();
config.SetConcurrentConsumerLimit(64); config.Subscribe(subs => { // using the LoadFrom causes an ArgumentOutOfRangeException to be throw // subs.LoadFrom(container); subs.Consumer<TestMessage1Consumer>().Permanent(); }); });
container.Inject(bus);
Console.ReadLine(); } }
public interface ITestMessage1Consumer : Consumes<ISomethingHappened>.Context { }
public class TestMessage1Consumer : ITestMessage1Consumer { public void Consume(IConsumeContext<ISomethingHappened> message) { Trace.TraceInformation("TXT: " + message.Message.What + " SENT: " + message.Message.When + " PROCESSED: " + DateTime.Now + " (" + Thread.CurrentThread.ManagedThreadId + ")");
// Simulate processing time Thread.Sleep(250); } }
--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/e6e52175-f41e-4a6f-889a-ce205aa129f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I thought the LoadFrom extension method with the StructureMapIntegration Nuget package took care of that for me. Is that not correct?
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/1427472595674.30309%40fairwaytech.com.
Oh sorry I was confused with what you were saying. Here is my StrucutreMap config that is used in my simple example. It is relying on the SingleImplementationsOfInterface right now since I created the consumer against a single interface. I had tried using
AddAllTypesOf(typeof(IConsumer)) and ConnectImplementationsToTypesClosing(typeof(Consumes<>.Context)) previously but was hitting a wall so tried to simplify.
public class StructureMapConfig : Registry
{
public StructureMapConfig()
{
Scan(scanner =>
{
scanner.TheCallingAssembly();
scanner.SingleImplementationsOfInterface();
scanner.WithDefaultConventions();
});
}
}
cfg.Scan(x =>
{
x.TheCallingAssembly();
x.AddAllTypesOf(
typeof
(IConsumer));
});
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/1427474596642.50309%40fairwaytech.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/CAHX4WYeMCMdaXmmi5mW2Cqa_MhVCMMsFSggG0LtFRhJJ61g9Ug%40mail.gmail.com.
Thanks guys. I will give that a shot tonight and see how it goes. I appreciate it.