This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added bindle-client dll to the infrastructure * Added bindle client interface to application and implementation to core * added bindle service to dependency injection and instantiated the BindleClient * Added configuration as DI, fixing mistake from past commit * removed dll, added package reference * Create initial channel when app created * Integrate bindle-dotnet in project infrastructure * Removed local dll reference * Make sure domain name is valid for initial channel Co-authored-by: Robert Gogete <[email protected]>
- Loading branch information
1 parent
492ea5c
commit 8c11b91
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
src/Application/Apps/EventHandlers/CreateInitialChannel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Hippo.Application.Channels.Commands; | ||
using Hippo.Application.Common.Config; | ||
using Hippo.Application.Common.Models; | ||
using Hippo.Core.Entities; | ||
using Hippo.Core.Enums; | ||
using Hippo.Core.Events; | ||
using MediatR; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Hippo.Application.Apps.EventHandlers; | ||
|
||
public class CreateInitialChannel : INotificationHandler<DomainEventNotification<CreatedEvent<App>>> | ||
{ | ||
private readonly ILogger<AppCreatedEventHandler> _logger; | ||
|
||
private readonly IMediator _mediator; | ||
|
||
private readonly HippoConfig _config; | ||
|
||
public CreateInitialChannel(ILogger<AppCreatedEventHandler> logger, IMediator mediator, HippoConfig config) | ||
{ | ||
_logger = logger; | ||
_mediator = mediator; | ||
_config = config; | ||
} | ||
|
||
public async Task Handle(DomainEventNotification<CreatedEvent<App>> notification, CancellationToken cancellationToken) | ||
{ | ||
var domainEvent = notification.DomainEvent; | ||
var app = domainEvent.Entity; | ||
|
||
var command = new CreateChannelCommand | ||
{ | ||
AppId = app.Id, | ||
Name = "Production", | ||
RevisionSelectionStrategy = ChannelRevisionSelectionStrategy.UseRangeRule, | ||
RangeRule = "*", | ||
Domain = $"{app.Name}.{_config.PlatformDomain}".Replace('_', '-').ToLower(), | ||
}; | ||
|
||
await _mediator.Send(command, cancellationToken); | ||
|
||
_logger.LogInformation("Hippo Domain Event: {DomainEvent}", domainEvent.GetType().Name); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters