Get started with ActiveMQ integration
Dette indhold er ikke tilgængeligt i dit sprog endnu.
Use the ActiveMQ integration from the Aspire Community Toolkit to run ActiveMQ Classic or ActiveMQ Artemis as a container resource. Both brokers expose a TCP endpoint that you can reference from application resources.
Prerequisites
Section titled “Prerequisites”- An Aspire AppHost project
- An ActiveMQ client library compatible with the broker you choose
Add ActiveMQ to your AppHost
Section titled “Add ActiveMQ to your AppHost”Install the 📦 CommunityToolkit.Aspire.Hosting.ActiveMQ package in the AppHost:
aspire add CommunityToolkit.Aspire.Hosting.ActiveMQaspire add CommunityToolkit.Aspire.Hosting.ActiveMQChoose either ActiveMQ Classic or Artemis in your AppHost. See Set up ActiveMQ in the AppHost for credentials, the web console, schemes, and storage options.
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();const username = await builder.addParameter('activemq-user', { value: 'admin', publishValueAsDefault: true,});const password = await builder.addParameter('activemq-password', { value: 'admin', secret: true,});
const broker = await builder.addActiveMQ('activemq', { userName: username, password,});await builder.build().run();var builder = DistributedApplication.CreateBuilder(args);var username = builder.AddParameter("activemq-user", "admin");var password = builder.AddParameter("activemq-password", secret: true);
var broker = builder.AddActiveMQ("activemq", username, password);
// After adding all resources, run the app...builder.Build().Run();The package also provides AddActiveMQArtemis and addActiveMQArtemis for the Artemis image. A connection name such as activemq is used when another resource references the broker.