For MassTransit, when setting up a new service bus the endpoint/type must be declared; however, I am trying to remove that dependency so that when I do tests against the consumer I can utilize the loopback endpoint but once in production, it would use the actual msmq endpoint.
Below is an example setup of a new service bus:
public class ConsumerService
{
IServiceBus _bus;
public void Start()
{
// Initalize Service Bus
_bus = ServiceBusFactory.New(x =>
{
//x.UseMsmq();
x.ReceiveFrom("loopback://localhost/MyQueue");
x.SetConcurrentConsumerLimit(1);
});
_bus.SubscribeConsumer(() => new MyConsumer());
}
public void Stop()
{
_bus.Dispose();
}
}
Aucun commentaire:
Enregistrer un commentaire