-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing Discovery.Azure IExtension (#2653)
* Fix missing Discovery.Azure IExtension * Cleanup code --------- Co-authored-by: Aaron Stannard <[email protected]>
- Loading branch information
1 parent
1de7cb2
commit ff66309
Showing
5 changed files
with
42 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
31 changes: 31 additions & 0 deletions
31
src/discovery/azure/Akka.Discovery.Azure/AzureDiscovery.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,31 @@ | ||
using Akka.Actor; | ||
using Akka.Configuration; | ||
|
||
namespace Akka.Discovery.Azure; | ||
|
||
public class AzureDiscovery: IExtension | ||
{ | ||
public static Configuration.Config DefaultConfiguration() | ||
=> ConfigurationFactory.FromResource<AzureDiscovery>("Akka.Discovery.Azure.reference.conf"); | ||
|
||
public static AzureDiscovery Get(ActorSystem system) | ||
=> system.WithExtension<AzureDiscovery, AzureDiscoveryProvider>(); | ||
|
||
public readonly AzureDiscoverySettings Settings; | ||
|
||
public AzureDiscovery(ExtendedActorSystem system) | ||
{ | ||
system.Settings.InjectTopLevelFallback(DefaultConfiguration()); | ||
Settings = AzureDiscoverySettings.Create(system); | ||
|
||
var setup = system.Settings.Setup.Get<AzureDiscoverySetup>(); | ||
if (setup.HasValue) | ||
Settings = setup.Value.Apply(Settings); | ||
} | ||
} | ||
|
||
public class AzureDiscoveryProvider : ExtensionIdProvider<AzureDiscovery> | ||
{ | ||
public override AzureDiscovery CreateExtension(ExtendedActorSystem system) | ||
=> new AzureDiscovery(system); | ||
} |
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