The bootstrapper does the work of registering consumers for you. If you need this to still be done you can use the bootstrapper outside of the host, or alternatively register the consumers yourself.
On Tue, Aug 9, 2011 at 9:51 AM, MichaelK <[email protected]> wrote: > It think it makes sense. From say a web application I don't need a > host since its only going to be publishing messages, but if I have a > windows service consuming events (CQRS read side for example) then > that is where I would want the host. > > So my issue now is that in my sample applications if I use the default > host and call bus.Publish things work fine. > > var host = new DefaultHost(); > host.Start<Bootstrapper>(); > var bus = host.Bus as IServiceBus; > bus.Publish(x); > > if I try to use the below code it blows up stating "There were no > subscribers for message X". What am I missing? > > var builder = new ContainerBuilder(); > var container = builder.Build(); > > new RhinoServiceBusConfiguration() > .UseAutofac(container) > .Configure(); > > var bus = container.Resolve<IServiceBus>(); > bus.Publish(x); > > > On Aug 9, 9:51 am, Corey Kaylor <[email protected]> wrote: > > You have a couple options. Pass the container to the bootstrapper's > > constructor. Or register your services in the bootstrapper. Each > container > > specific bootstrapper has a Container property that is accessible from > > within the bootstrapper. Or you can bootstrap things yourself with the > code > > that you saw in the tests. My preference is to do the bootstrapping in my > > own code. The host doesn't buy you a lot if you're just trying to run the > > bus from within your own app. I will typically use the host classes when > > hosting a windows service and the bus endpoing IS the application. Does > that > > make sense? > > > > > > > > > > > > > > > > On Mon, Aug 8, 2011 at 11:06 PM, MichaelK <[email protected]> wrote: > > > Hi All, > > > > > Sorry for the maybe very noobie question but I am just starting to > > > play around with RSB. So far I really like how easy it was to get up > > > and running but I am a bit confused regarding IoC containers and > > > registering my own stuff > > > > > 1) I like how easy it is to use the IoC library of choice since you > > > have them all defined. For example I got autofac working by creating > > > this class > > > > > public class BootStrapper : AutofacBootStrapper > > > { > > > } > > > > > and then in program main calling this and all RSB stuff was registered > > > for me...awesome! > > > > > var host = new DefaultHost(); > > > host.Start<Bootstrapper>(); > > > > > Then reviewing the unit Tests I see... > > > > > new RhinoServiceBusConfiguration() > > > .UseAutofac(container) > > > .Configure(); > > > > > My question is this. What is the proper way to register my own > > > services? Can I use the BootStrapper class and override a method? Or > > > if you want to register your own stuff you need to use the 2nd > > > approach. Basically looking for some guidance as I would assume both > > > approaches would work. > > > > > Thanks in advance > > > -Michael > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Rhino Tools Dev" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]. > > > For more options, visit this group at > > >http://groups.google.com/group/rhino-tools-dev?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Rhino Tools Dev" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rhino-tools-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rhino-tools-dev?hl=en.
