-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/379 support active mq artemis (#386)
* #379 support ActiveMQ Artemis * #379: start ActiveMQ Classic * #379 test settings * #379 implemented review * #379 correction unittest * #379 (Un)Shipped updated * #379 tried to move new or changed API's to unshipped * #379 again tried to move changed and new to unshipped * #379 update shipped and unshipped * #379 shipped and unshipped --------- Co-authored-by: Alireza Baloochi <[email protected]>
- Loading branch information
1 parent
a12e081
commit 6787af5
Showing
14 changed files
with
323 additions
and
87 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
17 changes: 17 additions & 0 deletions
17
src/CommunityToolkit.Aspire.Hosting.ActiveMQ/ActiveMQArtemisContainerImageSettings.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,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace CommunityToolkit.Aspire.Hosting.ActiveMQ; | ||
|
||
internal static class ActiveMQArtemisContainerImageSettings | ||
{ | ||
public const string Registry = "docker.io"; | ||
public const string Image = "apache/activemq-artemis"; | ||
public const string Tag = "2.39.0"; | ||
public const string EnvironmentVariableUsername = "ARTEMIS_USER"; | ||
public const string EnvironmentVariablePassword = "ARTEMIS_PASSWORD"; | ||
public const string JolokiaPath = "/console/jolokia/read/org.apache.activemq.artemis:broker=%220.0.0.0%22/Started"; | ||
public const string DataPath = "/var/lib/artemis-instance"; | ||
public const string ConfPath = "/var/lib/artemis-instance/etc-override"; | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
src/CommunityToolkit.Aspire.Hosting.ActiveMQ/ActiveMQArtemisServerResource.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,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using CommunityToolkit.Aspire.Hosting.ActiveMQ; | ||
|
||
namespace Aspire.Hosting.ApplicationModel; | ||
|
||
/// <summary> | ||
/// A resource that represents a ActiveMQ Artemis resource. | ||
/// </summary> | ||
/// <param name="name">The name of the resource.</param> | ||
/// <param name="userName">A parameter that contains the ActiveMQ server username, or <see langword="null"/> to use a default value.</param> | ||
/// <param name="password">A parameter that contains the ActiveMQ server password.</param> | ||
/// <param name="scheme">Scheme used in the connectionString (e.g. tcp or activemq, see MassTransit)</param> | ||
public class ActiveMQArtemisServerResource(string name, ParameterResource? userName, ParameterResource password, string scheme) : ActiveMQServerResourceBase(name, userName, password, scheme, ActiveMQSettings.ForArtemis) | ||
{ | ||
} |
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
17 changes: 17 additions & 0 deletions
17
src/CommunityToolkit.Aspire.Hosting.ActiveMQ/ActiveMQClassicContainerImageSettings.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,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace CommunityToolkit.Aspire.Hosting.ActiveMQ; | ||
|
||
internal static class ActiveMQClassicContainerImageSettings | ||
{ | ||
public const string Registry = "docker.io"; | ||
public const string Image = "apache/activemq-classic"; | ||
public const string Tag = "6.1.4"; | ||
public const string EnvironmentVariableUsername = "ACTIVEMQ_CONNECTION_USER"; | ||
public const string EnvironmentVariablePassword = "ACTIVEMQ_CONNECTION_PASSWORD"; | ||
public const string JolokiaPath = | ||
"/api/jolokia/read/org.apache.activemq:type=Broker,brokerName=localhost,service=Health/CurrentStatus"; | ||
public const string DataPath = "/opt/apache-activemq/data"; | ||
public const string ConfPath = "/opt/apache-activemq/conf"; | ||
} |
11 changes: 0 additions & 11 deletions
11
src/CommunityToolkit.Aspire.Hosting.ActiveMQ/ActiveMQContainerImageTags.cs
This file was deleted.
Oops, something went wrong.
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
55 changes: 55 additions & 0 deletions
55
src/CommunityToolkit.Aspire.Hosting.ActiveMQ/ActiveMQServerResourceBase.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,55 @@ | ||
using CommunityToolkit.Aspire.Hosting.ActiveMQ; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace Aspire.Hosting.ApplicationModel; | ||
|
||
/// <summary> | ||
/// Base class form ActiveMQ Classic and Artemis server resources. | ||
/// </summary> | ||
/// <param name="name">The name of the resource.</param> | ||
/// <param name="userName">A parameter that contains the ActiveMQ server username, or <see langword="null"/> to use a default value.</param> | ||
/// <param name="password">A parameter that contains the ActiveMQ server password.</param> | ||
/// <param name="scheme">Scheme used in the connectionString (e.g. tcp or activemq, see MassTransit)</param> | ||
/// <param name="settings">Settings being used for ActiveMQ Classic or Artemis</param> | ||
public abstract class ActiveMQServerResourceBase(string name, ParameterResource? userName, ParameterResource password, string scheme, IActiveMQSettings settings) : ContainerResource(name), IResourceWithConnectionString, IResourceWithEnvironment | ||
{ | ||
internal const string PrimaryEndpointName = "tcp"; | ||
internal const string DefaultUserName = "admin"; | ||
internal EndpointReference? _primaryEndpoint; | ||
|
||
|
||
/// <inheritdoc /> | ||
public ReferenceExpression ConnectionStringExpression => | ||
ReferenceExpression.Create( | ||
$"{scheme}://{UserNameReference}:{PasswordParameter}@{PrimaryEndpoint.Property(EndpointProperty.Host)}:{PrimaryEndpoint.Property(EndpointProperty.Port)}"); | ||
|
||
/// <summary> | ||
/// Gets the primary endpoint for the ActiveMQ server. | ||
/// </summary> | ||
public EndpointReference PrimaryEndpoint => _primaryEndpoint ??= new EndpointReference(this, PrimaryEndpointName); | ||
|
||
/// <summary> | ||
/// Gets the parameter that contains the ActiveMQ server username. | ||
/// </summary> | ||
public ParameterResource? UserNameParameter { get; } = userName; | ||
|
||
/// <summary> | ||
/// Gets the parameter that contains the ActiveMQ server password. | ||
/// </summary> | ||
public ParameterResource PasswordParameter { get; } = ThrowIfNull(password); | ||
|
||
|
||
/// <summary> | ||
/// Gets the ActiveMQ settings. | ||
/// </summary> | ||
public IActiveMQSettings ActiveMqSettings { get; } = settings; | ||
|
||
internal ReferenceExpression UserNameReference => | ||
UserNameParameter is not null ? | ||
ReferenceExpression.Create($"{UserNameParameter}") : | ||
ReferenceExpression.Create($"{DefaultUserName}"); | ||
|
||
private static T ThrowIfNull<T>([NotNull] T? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null) | ||
=> argument ?? throw new ArgumentNullException(paramName); | ||
} |
Oops, something went wrong.