1

I am trying to configure MassTransit to work with Automatonymous State Machine using the Azure Service Bus and i cannot see any working examples on how to do this. We previously was using RabbitMQ which we configured using the following code. I've swapped to use Azure Service Bus instead of the .CreateUsingRabbitMq() operation, but there seems to be some misconfiguration. The official documentation is a bit light in this area.

  1. Operating system: Windows 10 Pro
  2. Visual Studio version: 2017
  3. Dotnet version: 2.2

I have a queue named "SomeQueue" created in Azure Service Bus

I have a StateSage cs.proj that is responsible for handling the saga workflows using Automatonymous. In its configuration, i have the following

var bus = Bus.Factory.CreateUsingAzureServiceBus(cfg =>
        {
            var host = cfg.Host(
                new Uri(AzureServiceBusConfigurationSettings.Uri),
                h =>
                {
                    h.SharedAccessSignature(s =>
                    {
                        s.KeyName = AzureServiceBusConfigurationSettings.KeyName;
                        s.SharedAccessKey = AzureServiceBusConfigurationSettings.ShareAccessKey;
                        s.TokenTimeToLive = TimeSpan.FromDays(1);
                        s.TokenScope = TokenScope.Namespace;
                    });
                });

            cfg.UseSerilog();

            cfg.ReceiveEndpoint(
                host,
                "order_saga",
                e =>
                {
                    e.UseInMemoryOutbox();
                    e.StateMachineSaga(someStateMachine, repository);
                });

        });

bus.Start();

Now i know the constant AzureServiceBusConfigurationSettings.Uri is working correctly because i am placing messages on the queue in Azure Service Bus via another project that acts as the WebApi that receive some data sends it onto the service bus.

Has anyone tried doing this or have any experience with Automatonymous?

Johnny
  • 89
  • 1
  • 7
  • It works fine, and I don't see you mention any particular errors. And you said it worked with RabbitMQ. So, what's the error or behavior that you're experiencing? – Chris Patterson Mar 13 '19 at 15:38
  • For example, these tests work: https://github.com/MassTransit/MassTransit/blob/develop/src/MassTransit.AzureServiceBusTransport.Tests/ScheduleTimeout_Specs.cs – Chris Patterson Mar 13 '19 at 15:40
  • So we discovered the state machine saga workflows were not being triggered, so we could only assume the integration with Automatonymous was not correct. We had placed logs in each of the state transitions, and none were triggered. Even during debug, the breakpoints were never hit. – Johnny Mar 14 '19 at 17:15
  • What types is your state machine using for events, and what types are you publishing? RabbitMQ supports polymorphic message types and until very recently MassTransit didn’t support it on Azure. The latest versions for .NET core added it. – Chris Patterson Mar 14 '19 at 18:01

0 Answers0