Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#region CAP implementation
  string connectString = Configuration.GetValue<string>("ConnectionStrings:PostgreSql");
  string? schema = Assembly.GetEntryAssembly()?.GetName().Name?.ToLower();
            services.AddCap(x =>
              {
                  x.UseAzureServiceBus(opt =>
                  {
                      opt.ConnectionString = Configuration.GetValue<string>("AzureServiceBus:ConnectionString");
                      opt.TopicPath = Configuration.GetValue<string>("AzureServiceBus:TopicName");
                      opt.SubscriptionToTopics = Configuration.GetSection("AzureServiceBus:SubscriptionToTopics")
                      .GetChildren().ToDictionary(x => x.Key, x => x.Value);
                  });
                  x.DefaultGroupName = Configuration.GetValue<string>("AzureServiceBus:Subscription");
                  x.FailedRetryCount = Configuration.GetValue<int>("AzureServiceBus:FailedRetryCount");
                  x.FailedRetryInterval = Configuration.GetValue<int>("AzureServiceBus:FailedRetryInterval");
                  x.UsePostgreSql(x => { x.ConnectionString = connectString; x.Schema = schema; });
              });

#endregion

Note: if you have an error in the line 3, please add using System.Reflection;

Publishing and Subscribing Messages

...