Created
April 28, 2016 05:52
-
-
Save mishrsud/9f2c937d83c7499cc02347b55ca6bedf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// METHOD 1 No receive endpoint (this is meant for Publish in a pub-sub scenario) | |
public IBusControl CreateBusControl() | |
{ | |
var bus = Bus.Factory.CreateUsingRabbitMq(configurator => | |
{ | |
IRabbitMqHost rabbitMqHost = configurator.Host(new Uri("rabbitmq://localhost/test"), hostConfigurator => | |
{ | |
hostConfigurator.Username("guest"); | |
hostConfigurator.Password("guest"); | |
}); | |
}); | |
return bus; | |
} | |
// METHOD: 2 Initializes bus on the subscriber with receive endpoint and consumer | |
public IBusControl CreateBusControlWithReceiveEndpointAndConsumer() | |
{ | |
var bus = Bus.Factory.CreateUsingRabbitMq(configurator => | |
{ | |
IRabbitMqHost rabbitMqHost = configurator.Host(new Uri("rabbitmq://localhost/test"), hostConfigurator => | |
{ | |
hostConfigurator.Username("guest"); | |
hostConfigurator.Password("guest"); | |
}); | |
configurator.ReceiveEndpoint(rabbitMqHost, "myReceiveQueue", e => e.Consumer<SomeConsumer>()); | |
}); | |
return bus; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment