Update ServiceBus sdk from t1 to t2 (#1698)
* Update ServiceBus to the new SDKs. * resolve errors * resolve errors * update codes * update codes * add a call in constructor * remove changes * add Dispose() menthod in interface * Update codes * update the method to get topicName * Remove invalid changes * resolve the errors in service * fix issue * fix issue * update code Co-authored-by: zedy <zedy@wicresoft.com>
This commit is contained in:
parent
46219957ef
commit
c357aeac63
src
BuildingBlocks/EventBus/EventBusServiceBus
DefaultServiceBusPersisterConnection.csEventBusServiceBus.csEventBusServiceBus.csprojIServiceBusPersisterConnection.cs
Services
Basket/Basket.API
Catalog/Catalog.API
Ordering
Ordering.API
Ordering.BackgroundTasks/Extensions
Ordering.SignalrHub
Payment/Payment.API
Webhooks/Webhooks.API
Web/WebSPA/Client
@ -1,58 +1,49 @@
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using Azure.Messaging.ServiceBus.Administration;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
|
||||
{
|
||||
public class DefaultServiceBusPersisterConnection : IServiceBusPersisterConnection
|
||||
{
|
||||
private readonly ServiceBusConnectionStringBuilder _serviceBusConnectionStringBuilder;
|
||||
private readonly string _subscriptionClientName;
|
||||
private SubscriptionClient _subscriptionClient;
|
||||
private ITopicClient _topicClient;
|
||||
private readonly string _serviceBusConnectionString;
|
||||
private ServiceBusClient _topicClient;
|
||||
private ServiceBusAdministrationClient _subscriptionClient;
|
||||
|
||||
bool _disposed;
|
||||
|
||||
public DefaultServiceBusPersisterConnection(ServiceBusConnectionStringBuilder serviceBusConnectionStringBuilder,
|
||||
string subscriptionClientName)
|
||||
public DefaultServiceBusPersisterConnection(string serviceBusConnectionString)
|
||||
{
|
||||
_serviceBusConnectionStringBuilder = serviceBusConnectionStringBuilder ??
|
||||
throw new ArgumentNullException(nameof(serviceBusConnectionStringBuilder));
|
||||
_subscriptionClientName = subscriptionClientName;
|
||||
_subscriptionClient = new SubscriptionClient(_serviceBusConnectionStringBuilder, subscriptionClientName);
|
||||
_topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default);
|
||||
_serviceBusConnectionString = serviceBusConnectionString;
|
||||
_subscriptionClient = new ServiceBusAdministrationClient(_serviceBusConnectionString);
|
||||
_topicClient = new ServiceBusClient(_serviceBusConnectionString);
|
||||
}
|
||||
|
||||
public ITopicClient TopicClient
|
||||
public ServiceBusClient TopicClient
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_topicClient.IsClosedOrClosing)
|
||||
if (_topicClient.IsClosed)
|
||||
{
|
||||
_topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default);
|
||||
_topicClient = new ServiceBusClient(_serviceBusConnectionString);
|
||||
}
|
||||
return _topicClient;
|
||||
}
|
||||
}
|
||||
|
||||
public ISubscriptionClient SubscriptionClient
|
||||
public ServiceBusAdministrationClient AdministrationClient
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_subscriptionClient.IsClosedOrClosing)
|
||||
{
|
||||
_subscriptionClient = new SubscriptionClient(_serviceBusConnectionStringBuilder, _subscriptionClientName);
|
||||
}
|
||||
return _subscriptionClient;
|
||||
}
|
||||
}
|
||||
|
||||
public ServiceBusConnectionStringBuilder ServiceBusConnectionStringBuilder => _serviceBusConnectionStringBuilder;
|
||||
|
||||
public ITopicClient CreateModel()
|
||||
public ServiceBusClient CreateModel()
|
||||
{
|
||||
if (_topicClient.IsClosedOrClosing)
|
||||
if (_topicClient.IsClosed)
|
||||
{
|
||||
_topicClient = new TopicClient(_serviceBusConnectionStringBuilder, RetryPolicy.Default);
|
||||
_topicClient = new ServiceBusClient(_serviceBusConnectionString);
|
||||
}
|
||||
|
||||
return _topicClient;
|
||||
@ -63,6 +54,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
|
||||
if (_disposed) return;
|
||||
|
||||
_disposed = true;
|
||||
_topicClient.DisposeAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,44 @@
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
|
||||
{
|
||||
using Autofac;
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using Azure.Messaging.ServiceBus.Administration;
|
||||
using Autofac;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
|
||||
public class EventBusServiceBus : IEventBus
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
|
||||
{
|
||||
public class EventBusServiceBus : IEventBus, IDisposable
|
||||
{
|
||||
private readonly IServiceBusPersisterConnection _serviceBusPersisterConnection;
|
||||
private readonly ILogger<EventBusServiceBus> _logger;
|
||||
private readonly IEventBusSubscriptionsManager _subsManager;
|
||||
private readonly ILifetimeScope _autofac;
|
||||
private readonly string _topicName = "eshop_event_bus";
|
||||
private readonly string _subscriptionName;
|
||||
private ServiceBusSender _sender;
|
||||
private ServiceBusProcessor _processor;
|
||||
private readonly string AUTOFAC_SCOPE_NAME = "eshop_event_bus";
|
||||
private const string INTEGRATION_EVENT_SUFFIX = "IntegrationEvent";
|
||||
|
||||
public EventBusServiceBus(IServiceBusPersisterConnection serviceBusPersisterConnection,
|
||||
ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, ILifetimeScope autofac)
|
||||
ILogger<EventBusServiceBus> logger, IEventBusSubscriptionsManager subsManager, ILifetimeScope autofac, string subscriptionClientName)
|
||||
{
|
||||
_serviceBusPersisterConnection = serviceBusPersisterConnection;
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
_subsManager = subsManager ?? new InMemoryEventBusSubscriptionsManager();
|
||||
_autofac = autofac;
|
||||
_subscriptionName = subscriptionClientName;
|
||||
_sender = _serviceBusPersisterConnection.TopicClient.CreateSender(_topicName);
|
||||
ServiceBusProcessorOptions options = new ServiceBusProcessorOptions { MaxConcurrentCalls = 10, AutoCompleteMessages = false };
|
||||
_processor = _serviceBusPersisterConnection.TopicClient.CreateProcessor(_topicName, _subscriptionName, options);
|
||||
|
||||
RemoveDefaultRule();
|
||||
RegisterSubscriptionClientMessageHandler();
|
||||
RegisterSubscriptionClientMessageHandlerAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public void Publish(IntegrationEvent @event)
|
||||
@ -38,14 +47,14 @@
|
||||
var jsonMessage = JsonSerializer.Serialize(@event, @event.GetType());
|
||||
var body = Encoding.UTF8.GetBytes(jsonMessage);
|
||||
|
||||
var message = new Message
|
||||
var message = new ServiceBusMessage
|
||||
{
|
||||
MessageId = Guid.NewGuid().ToString(),
|
||||
Body = body,
|
||||
Label = eventName,
|
||||
Body = new BinaryData(body),
|
||||
Subject = eventName,
|
||||
};
|
||||
|
||||
_serviceBusPersisterConnection.TopicClient.SendAsync(message)
|
||||
_sender.SendMessageAsync(message)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
@ -69,9 +78,9 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
_serviceBusPersisterConnection.SubscriptionClient.AddRuleAsync(new RuleDescription
|
||||
_serviceBusPersisterConnection.AdministrationClient.CreateRuleAsync(_topicName, _subscriptionName, new CreateRuleOptions
|
||||
{
|
||||
Filter = new CorrelationFilter { Label = eventName },
|
||||
Filter = new CorrelationRuleFilter() { Subject = eventName },
|
||||
Name = eventName
|
||||
}).GetAwaiter().GetResult();
|
||||
}
|
||||
@ -95,12 +104,12 @@
|
||||
try
|
||||
{
|
||||
_serviceBusPersisterConnection
|
||||
.SubscriptionClient
|
||||
.RemoveRuleAsync(eventName)
|
||||
.AdministrationClient
|
||||
.DeleteRuleAsync(_topicName, _subscriptionName, eventName)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
catch (MessagingEntityNotFoundException)
|
||||
catch (ServiceBusException ex) when (ex.Reason == ServiceBusFailureReason.MessagingEntityNotFound)
|
||||
{
|
||||
_logger.LogWarning("The messaging entity {eventName} Could not be found.", eventName);
|
||||
}
|
||||
@ -118,32 +127,35 @@
|
||||
_subsManager.RemoveDynamicSubscription<TH>(eventName);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
private async Task RegisterSubscriptionClientMessageHandlerAsync()
|
||||
{
|
||||
_subsManager.Clear();
|
||||
}
|
||||
|
||||
private void RegisterSubscriptionClientMessageHandler()
|
||||
{
|
||||
_serviceBusPersisterConnection.SubscriptionClient.RegisterMessageHandler(
|
||||
async (message, token) =>
|
||||
_processor.ProcessMessageAsync +=
|
||||
async (args) =>
|
||||
{
|
||||
var eventName = $"{message.Label}{INTEGRATION_EVENT_SUFFIX}";
|
||||
var messageData = Encoding.UTF8.GetString(message.Body);
|
||||
var eventName = $"{args.Message.Subject}{INTEGRATION_EVENT_SUFFIX}";
|
||||
string messageData = args.Message.Body.ToString();
|
||||
|
||||
// Complete the message so that it is not received again.
|
||||
if (await ProcessEvent(eventName, messageData))
|
||||
{
|
||||
await _serviceBusPersisterConnection.SubscriptionClient.CompleteAsync(message.SystemProperties.LockToken);
|
||||
await args.CompleteMessageAsync(args.Message);
|
||||
}
|
||||
},
|
||||
new MessageHandlerOptions(ExceptionReceivedHandler) { MaxConcurrentCalls = 10, AutoComplete = false });
|
||||
};
|
||||
|
||||
_processor.ProcessErrorAsync += ErrorHandler;
|
||||
await _processor.StartProcessingAsync();
|
||||
}
|
||||
|
||||
private Task ExceptionReceivedHandler(ExceptionReceivedEventArgs exceptionReceivedEventArgs)
|
||||
public void Dispose()
|
||||
{
|
||||
var ex = exceptionReceivedEventArgs.Exception;
|
||||
var context = exceptionReceivedEventArgs.ExceptionReceivedContext;
|
||||
_subsManager.Clear();
|
||||
_processor.CloseAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
private Task ErrorHandler(ProcessErrorEventArgs args)
|
||||
{
|
||||
var ex = args.Exception;
|
||||
var context = args.ErrorSource;
|
||||
|
||||
_logger.LogError(ex, "ERROR handling message: {ExceptionMessage} - Context: {@ExceptionContext}", ex.Message, context);
|
||||
|
||||
@ -189,14 +201,14 @@
|
||||
try
|
||||
{
|
||||
_serviceBusPersisterConnection
|
||||
.SubscriptionClient
|
||||
.RemoveRuleAsync(RuleDescription.DefaultRuleName)
|
||||
.AdministrationClient
|
||||
.DeleteRuleAsync(_topicName, _subscriptionName, RuleProperties.DefaultRuleName)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
catch (MessagingEntityNotFoundException)
|
||||
catch (ServiceBusException ex) when (ex.Reason == ServiceBusFailureReason.MessagingEntityNotFound)
|
||||
{
|
||||
_logger.LogWarning("The messaging entity {DefaultRuleName} Could not be found.", RuleDescription.DefaultRuleName);
|
||||
_logger.LogWarning("The messaging entity {DefaultRuleName} Could not be found.", RuleProperties.DefaultRuleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac" Version="6.1.0" />
|
||||
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="5.1.0" />
|
||||
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.2.1" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
@ -1,11 +1,12 @@
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using Azure.Messaging.ServiceBus.Administration;
|
||||
namespace Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus
|
||||
{
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using System;
|
||||
|
||||
public interface IServiceBusPersisterConnection : IDisposable
|
||||
{
|
||||
ITopicClient TopicClient { get; }
|
||||
ISubscriptionClient SubscriptionClient { get; }
|
||||
ServiceBusClient TopicClient { get; }
|
||||
ServiceBusAdministrationClient AdministrationClient { get; }
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using Basket.API.Infrastructure.Filters;
|
||||
using Basket.API.IntegrationEvents.EventHandling;
|
||||
using Basket.API.IntegrationEvents.Events;
|
||||
@ -10,7 +11,6 @@ using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||
@ -122,10 +122,8 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||
{
|
||||
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||
|
||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -285,9 +283,10 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API
|
||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||
eventBusSubcriptionsManager, iLifetimeScope);
|
||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using Catalog.API.Grpc;
|
||||
using global::Catalog.API.Infrastructure.Filters;
|
||||
using global::Catalog.API.IntegrationEvents;
|
||||
@ -9,7 +10,6 @@ using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
@ -281,10 +281,9 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||
{
|
||||
var settings = sp.GetRequiredService<IOptions<CatalogSettings>>().Value;
|
||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(settings.EventBusConnection);
|
||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||
var serviceBusConnection = settings.EventBusConnection;
|
||||
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection);
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -333,9 +332,10 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API
|
||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
string subscriptionName = configuration["SubscriptionClientName"];
|
||||
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||
eventBusSubcriptionsManager, iLifetimeScope);
|
||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -69,6 +69,7 @@
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Setup\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
@ -1,43 +1,44 @@
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API
|
||||
{
|
||||
using AspNetCore.Http;
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using global::Ordering.API.Application.IntegrationEvents;
|
||||
using global::Ordering.API.Application.IntegrationEvents.Events;
|
||||
using global::Ordering.API.Infrastructure.Filters;
|
||||
using GrpcOrdering;
|
||||
using HealthChecks.UI.Client;
|
||||
using Infrastructure.AutofacModules;
|
||||
using Infrastructure.Filters;
|
||||
using Infrastructure.Services;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Ordering.Infrastructure;
|
||||
using RabbitMQ.Client;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using global::Ordering.API.Application.IntegrationEvents;
|
||||
using global::Ordering.API.Application.IntegrationEvents.Events;
|
||||
using global::Ordering.API.Infrastructure.Filters;
|
||||
using GrpcOrdering;
|
||||
using HealthChecks.UI.Client;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.AutofacModules;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Filters;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Services;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF.Services;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.API.Controllers;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Ordering.Infrastructure;
|
||||
using RabbitMQ.Client;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Infrastructure;
|
||||
|
||||
namespace Microsoft.eShopOnContainers.Services.Ordering.API
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IConfiguration configuration)
|
||||
@ -297,10 +298,10 @@
|
||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||
{
|
||||
var serviceBusConnectionString = configuration["EventBusConnection"];
|
||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||
|
||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -374,9 +375,10 @@
|
||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
string subscriptionName = configuration["SubscriptionClientName"];
|
||||
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||
eventBusSubcriptionsManager, iLifetimeScope);
|
||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Autofac;
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||
@ -54,9 +54,8 @@ namespace Ordering.BackgroundTasks.Extensions
|
||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||
{
|
||||
var serviceBusConnectionString = configuration["EventBusConnection"];
|
||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||
});
|
||||
|
||||
services.AddSingleton<IEventBus, EventBusServiceBus>(sp =>
|
||||
@ -65,8 +64,9 @@ namespace Ordering.BackgroundTasks.Extensions
|
||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
string subscriptionName = configuration["SubscriptionClientName"];
|
||||
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger, eventBusSubcriptionsManager, iLifetimeScope);
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger, eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -1,10 +1,10 @@
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using HealthChecks.UI.Client;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||
@ -65,11 +65,10 @@ namespace Ordering.SignalrHub
|
||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||
{
|
||||
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||
|
||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -213,9 +212,10 @@ namespace Ordering.SignalrHub
|
||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||
eventBusSubcriptionsManager, iLifetimeScope);
|
||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -1,9 +1,9 @@
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using HealthChecks.UI.Client;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ;
|
||||
@ -41,10 +41,9 @@ namespace Payment.API
|
||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||
{
|
||||
var serviceBusConnectionString = Configuration["EventBusConnection"];
|
||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
|
||||
var subscriptionClientName = Configuration["SubscriptionClientName"];
|
||||
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnectionString);
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -130,9 +129,10 @@ namespace Payment.API
|
||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
string subscriptionName = Configuration["SubscriptionClientName"];
|
||||
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||
eventBusSubcriptionsManager, iLifetimeScope);
|
||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -1,12 +1,12 @@
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Azure.Messaging.ServiceBus;
|
||||
using Devspaces.Support;
|
||||
using HealthChecks.UI.Client;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Azure.ServiceBus;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus;
|
||||
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions;
|
||||
@ -215,9 +215,10 @@ namespace Webhooks.API
|
||||
var iLifetimeScope = sp.GetRequiredService<ILifetimeScope>();
|
||||
var logger = sp.GetRequiredService<ILogger<EventBusServiceBus>>();
|
||||
var eventBusSubcriptionsManager = sp.GetRequiredService<IEventBusSubscriptionsManager>();
|
||||
string subscriptionName = configuration["SubscriptionClientName"];
|
||||
|
||||
return new EventBusServiceBus(serviceBusPersisterConnection, logger,
|
||||
eventBusSubcriptionsManager, iLifetimeScope);
|
||||
eventBusSubcriptionsManager, iLifetimeScope, subscriptionName);
|
||||
});
|
||||
|
||||
}
|
||||
@ -285,9 +286,8 @@ namespace Webhooks.API
|
||||
{
|
||||
services.AddSingleton<IServiceBusPersisterConnection>(sp =>
|
||||
{
|
||||
var serviceBusConnection = new ServiceBusConnectionStringBuilder(configuration["EventBusConnection"]);
|
||||
var subscriptionClientName = configuration["SubscriptionClientName"];
|
||||
return new DefaultServiceBusPersisterConnection(serviceBusConnection, subscriptionClientName);
|
||||
return new DefaultServiceBusPersisterConnection(configuration["EventBusConnection"]);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
2026
src/Web/WebSPA/Client/package-lock.json
generated
2026
src/Web/WebSPA/Client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user