How to enable Turnout in RabbitMQ

401 views
Skip to first unread message

Krzysztof Lewicki

unread,
Apr 14, 2016, 5:38:32 AM4/14/16
to masstransit-discuss
Hi,

I'm trying to work my way through MT. I tried to use Turnout for my consumer:
        static void Main(string[] args)
       
{
           
var settings = ConfigurationManager.AppSettings;
           
           
var bus = Bus.Factory.CreateUsingRabbitMq(x =>
           
{
               
IRabbitMqHost host = x.Host(new Uri(settings["RabbitMQHost"]), h =>
               
{
                    h
.Username(settings["RabbitMQUsername"]);
                    h
.Password(settings["RabbitMQPassword"]);
               
});
 
               
Console.WriteLine("Connecting to {0} queue", settings["QueueName"]);
 
                x
.ReceiveEndpoint(
                    host
,
                    settings
["QueueName"],
                    e
=>
                   
{
                        e
.Consumer<MyConsumer>();
                       
// e has no method Turnout?
                   
});
           
});
 
            bus
.Start();
 
           
Console.ReadKey();
 
            bus
.Stop();
       
}

But Turnout() method is not there. I inspected the TurnoutConfigurationExtensions class and I can't see extension for IRabbitMqReceiveEndpointConfigurator. Am I missing something?

Thanks!
Krzysztof

Chris Patterson

unread,
May 12, 2016, 9:37:33 AM5/12/16
to masstrans...@googlegroups.com
I would have to dig further into this, the feature was originally created for Azure Service Bus, but should work with any transport.

I haven't worked with it lately, and it's probably not truly production ready, but it's been low on my list since the team it was created for hasn't gotten back to me after the initial bits were released.



--
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/8c27d121-1f69-4037-a7cb-df99affc8f09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wiktor Zychla

unread,
May 13, 2016, 6:15:52 AM5/13/16
to masstransit-discuss
Krzysztof, Chris,

Looks like a problem with interface hierarchy. The extension is currently defined in TurnoutConfigurationExtension.cs as

public static void Turnout<T>(this IInMemoryReceiveEndpointConfigurator configurator, IInMemoryBusFactoryConfigurator busFactoryConfigurator,

which makes it unusable, since the IInMemoryReceiveEndpointConfigurator inherits from IReceiveEndpointConfigurator and is a sibling of the IRabbitMqReceiveEndpointConfigurator. Therefore, the extension is not available on the latter.

To correct this, a patch is required in the source code, the signature has to use the base interface:

public static void Turnout<T>(this IReceiveEndpointConfigurator configurator, IInMemoryBusFactoryConfigurator busFactoryConfigurator,

I have verified that this works with the patch applied.

Regards,
Wiktor


W dniu czwartek, 12 maja 2016 15:37:33 UTC+2 użytkownik Chris Patterson napisał:
I would have to dig further into this, the feature was originally created for Azure Service Bus, but should work with any transport.

I haven't worked with it lately, and it's probably not truly production ready, but it's been low on my list since the team it was created for hasn't gotten back to me after the initial bits were released.


Chris Patterson

unread,
May 14, 2016, 9:11:27 AM5/14/16
to masstrans...@googlegroups.com
Great. I'll see it gets committed. 

__
Chris Patterson




--
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.

Chris Platts

unread,
May 22, 2016, 6:43:18 PM5/22/16
to masstransit-discuss
Hi!

I'm currently experimenting with MT to build a proof-of-concept for my team.  We've got a large set of long-running operations that we're looking to refactor and provide via scalable services communicating via MT over RabbitMQ and Turnouts look ideal.  Even with the described patch, I'm not sure how the required IInMemoryBusFactoryConfigurator fits with using RabbitMQ.  There's a distinct chance I'm not grokking how Turnouts operate of course!

Looking forward to any updates in this area!

Thanks,
Chris

Serge van den Oever

unread,
Jun 14, 2016, 10:04:01 AM6/14/16
to masstransit-discuss
 Hi Chris, I did not see it committed on the develop branch yet, I did work around the issue by doing:


 

           var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>

           {

               var rabbitMqHost = cfg.Host(new Uri("rabbitmq://localhost/sergetest"), h =>

               {

                   h.Username("guest");

                   h.Password("guest");

               });


               cfg.PublisherConfirmation = true;

               cfg.UseInMemoryScheduler();

               cfg.ReceiveEndpoint(rabbitMqHost, "serge-long-commands", e =>

               {

                   var temporaryQueueName = cfg.GetTemporaryQueueName($"turnout-");


                   cfg.ReceiveEndpoint(temporaryQueueName, turnoutEndpointConfigurator =>

                   {

                       TurnoutConfigurationExtensions.ConfigureTurnoutEndpoints<LongTransformation>(e, cfg, configurator =>

                       {

                           Console.WriteLine("Long running task configuration with turnout");

                           configurator.SuperviseInterval = TimeSpan.FromSeconds(2);

                           configurator.SetJobFactory(async context =>

                           {

                               await Task.Factory.StartNew(async () =>

                               {

                                   Console.WriteLine("Start long running task... 60 seconds...");

                                   await Task.Delay(60000);

                                   Console.WriteLine("Long running task completed!!");

                               }).Unwrap();

                                Console.WriteLine("All long running task stuff done");

                           });

                       }, turnoutEndpointConfigurator);

                   });

               });

           });


           busControl.Start();

Reply all
Reply to author
Forward
0 new messages