0

Hi I have a question about using a topic in Azure Service Bus, which I control/configure using mass transit in my .NET application. My query is as follows, I use MassTransit to create a topic in my service and a subscription in Azure Service Bus. I then use this setup in Azure Function, where I want to respond to everything that comes from the message broker to the aforementioned topic. I don't understand why, but even if I send a completely identical message, Azure Function always catches it only on the second attempt the first one falls into the dead letter queue with the following wording. I really don't understand what's going on. Is this the right approach? Or should I trigger the function differently? However, I really don't understand why it always passes on the second time. I haven't any consumers in my app.

Application

            services.AddMassTransit(o =>
            {
                o.AddConsumers(Assembly.GetExecutingAssembly());

                o.UsingAzureServiceBus((context, cfg) =>
                {
                    cfg.Host(conString);

                    cfg.Publish<ImportDataCheckRequested>();
                    cfg.SubscriptionEndpoint<ImportDataCheckRequested>("test-sub", x =>
                    {

                    });
                 
                    // I try this comment
                    cfg.ConfigureEndpoints(context);
                });
            });

Function

        [Function("Function1")]
        public void Run([ServiceBusTrigger("queue", "test-sub", Connection = "Test")] string myQueueItem)
        {
            _logger.LogInformation($"C# ServiceBus topic trigger function processed message:");
        }

enter image description here

Thank you

I try send message from Azure and app too to topic. When i try send message from portal with off app it's working well so i think my problem will be in configuration app

1 Answers1

0

Reference :

I have referred this MassTransit , git @Chris Patterson and Stack reference. Thank @ChrisPatterson for the steps.

  • Make sure your Azure Function is set up to activate properly.
  • Review your Azure Service Bus retry and dead-letter settings. It's possible that some circumstances are causing messages to be retried or added to the dead-letter queue.
  • Follow my below code
  x.UsingAzureServiceBus(configure: (context, cfg) =>
                        {
                            cfg.Host(connectionString: "connectionstring");
                            cfg.SubscriptionEndpoint("sampath", "sampath", e =>
                            {
                                cfg.ConfigureEndpoints(context);
                            });
                            //cfg.ConfigureEndpoints(context);

                        });
                        
                    });
                    services.AddHostedService<worker>();

enter image description here

enter image description here

I tried in this way hope it may be helpful to you with your requirements.

Output :

enter image description here

Sampath
  • 810
  • 2
  • 2
  • 13