Bus.Initialize(sbc => {
sbc.UseMsmq();
sbc.UseMulticastSubscriptionClient();
sbc.ReceiveFrom("msmq://localhost/message_responder");
sbc.Subscribe(subs=> {
subs.Handler<BasicRequest>( (cxt, msg )=> {
cxt.Respond(new BasicResponse{Text = "RESP"+msg.Text});
});
});
})
In my application I'm using Consumers rather than Handlers (because I need dependency injection via Autofac) so my consumer looks like this
public class DoctorImporter : Consumes<ImportDoctorCommand>.For<Guid> { public void Consume(ImportDoctorCommand cmd) {
foo.DoStuff(); var ev = new ImportDoctorCommand.Occurred() { CorrelationId = cmd.CorrelationId }; bus.Publish(ev);
} readonly IServiceBus bus;
readonly Foo foo; public DoctorImporter(IServiceBus bus, Foo foo) { this.bus = bus;
this.foo = foo; } public Guid CorrelationId { get; private set; } }
--
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/02cf2474-f7c5-4a14-833b-b1aadda52899%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.