AWS.MQ reference
Broker
Section titled “Broker”Source:
src/AWS/MQ/Broker.ts
An Amazon MQ broker — a managed message broker running Apache ActiveMQ or RabbitMQ. Amazon MQ handles provisioning, patching, and (for multi-AZ deployments) failover, exposing standard wire protocols (OpenWire, AMQP, MQTT, STOMP, WSS) so existing clients connect unchanged.
Broker creation and deletion are asynchronous and take several minutes;
the provider waits (bounded) for the broker to reach RUNNING before
returning, and waits for it to disappear on delete.
Broker: Creating a Broker
Section titled “Broker: Creating a Broker”Single-instance ActiveMQ (cheapest)
const broker = yield* MQ.Broker("Orders", { engineType: "ACTIVEMQ", engineVersion: "5.18", hostInstanceType: "mq.t3.micro", deploymentMode: "SINGLE_INSTANCE", publiclyAccessible: true, users: [{ username: "admin", password: Redacted.make("SuperSecretPassw0rd") }],});// broker.endpoints -> ["ssl://b-xxxx-1.mq.us-west-2.amazonaws.com:61617", ...]Single-instance RabbitMQ
const broker = yield* MQ.Broker("Events", { engineType: "RABBITMQ", engineVersion: "3.13", hostInstanceType: "mq.t3.micro", publiclyAccessible: true, users: [{ username: "admin", password: Redacted.make("SuperSecretPassw0rd") }],});Broker: Networking and Encryption
Section titled “Broker: Networking and Encryption”const broker = yield* MQ.Broker("Orders", { engineType: "ACTIVEMQ", engineVersion: "5.18", hostInstanceType: "mq.m5.large", deploymentMode: "ACTIVE_STANDBY_MULTI_AZ", publiclyAccessible: false, subnetIds: [subnetA.subnetId, subnetB.subnetId], securityGroups: [group.groupId], encryptionOptions: { kmsKeyId: key.keyArn }, users: [{ username: "admin", password: Redacted.make("SuperSecretPassw0rd") }],});Broker: Logging and Maintenance
Section titled “Broker: Logging and Maintenance”const broker = yield* MQ.Broker("Orders", { engineType: "ACTIVEMQ", engineVersion: "5.18", hostInstanceType: "mq.t3.micro", users: [{ username: "admin", password: Redacted.make("SuperSecretPassw0rd") }], logs: { general: true, audit: true }, maintenanceWindow: { dayOfWeek: "SUNDAY", timeOfDay: "03:00", timeZone: "UTC", },});Broker: Consuming Messages
Section titled “Broker: Consuming Messages”Subscribe a Lambda function to broker queues from the init phase via
consumeBrokerMessages. The event-source mapping, IAM grants, and
runtime dispatch are created automatically (provide
Lambda.BrokerEventSource on the function).
// inityield* MQ.consumeBrokerMessages( broker, { queues: ["orders"], credentialsSecretArn: secret.secretArn, }, (messages) => messages.pipe( Stream.runForEach((message) => Effect.log(`received: ${message.data}`), ), ),);BrokerEventSource
Section titled “BrokerEventSource”Source:
src/AWS/MQ/BrokerEventSource.ts
Event source connecting an Amazon MQ Broker to the hosting Lambda
function. Prefer the consumeBrokerMessages helper; this service is
the underlying contract, implemented by the Lambda.BrokerEventSource
layer (which registers the event-source mapping, IAM grants, and runtime
dispatch).
BrokerEventSource: Examples
Section titled “BrokerEventSource: Examples”// equivalent to consumeBrokerMessages(broker, props, process)yield* BrokerEventSource.use((source) => source(broker, props, process),);Configuration
Section titled “Configuration”Source:
src/AWS/MQ/Configuration.ts
An Amazon MQ broker configuration — a versioned document (ActiveMQ XML or
RabbitMQ Cuttlefish) that a Broker can reference to control
engine-level settings. Each edit to data publishes a new immutable
revision; a broker pins a specific { id, revision } pair.
Configuration: Creating a Configuration
Section titled “Configuration: Creating a Configuration”Default ActiveMQ Configuration
const config = yield* MQ.Configuration("BrokerConfig", { engineType: "ACTIVEMQ", engineVersion: "5.18",});Custom ActiveMQ Configuration Document
const config = yield* MQ.Configuration("BrokerConfig", { engineType: "ACTIVEMQ", engineVersion: "5.18", description: "Enable statistics plugin", data: `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><broker xmlns="http://activemq.apache.org/schema/core"> <plugins> <statisticsBrokerPlugin/> </plugins></broker>`,});// config.configurationRevision -> 2 (the published revision)Configuration: Attaching to a Broker
Section titled “Configuration: Attaching to a Broker”const broker = yield* MQ.Broker("Orders", { engineType: "ACTIVEMQ", engineVersion: "5.18", hostInstanceType: "mq.t3.micro", users: [{ username: "admin", password: Redacted.make("SuperSecretPassw0rd") }], configuration: { id: config.configurationId, revision: config.configurationRevision, },});CreateUser
Section titled “CreateUser”Source:
src/AWS/MQ/CreateUser.ts
Runtime binding for the CreateUser operation (IAM action
mq:CreateUser), scoped to one Broker.
Creates a broker user — e.g. provisioning per-tenant credentials at
runtime. On ActiveMQ the change is staged and applied at the next broker
reboot or maintenance window; on RabbitMQ it takes effect immediately.
The password is marked sensitive — pass a Redacted value and it stays
redacted until wire encoding. Provide the implementation with
Effect.provide(AWS.MQ.CreateUserHttp).
CreateUser: Managing Users
Section titled “CreateUser: Managing Users”const createUser = yield* MQ.CreateUser(broker);
yield* createUser({ Username: "tenant-42", Password: Redacted.make("SuperSecretPassw0rd"),});DeleteUser
Section titled “DeleteUser”Source:
src/AWS/MQ/DeleteUser.ts
Runtime binding for the DeleteUser operation (IAM action
mq:DeleteUser), scoped to one Broker.
Deletes a broker user — e.g. revoking per-tenant credentials at runtime.
On ActiveMQ the change is staged and applied at the next broker reboot or
maintenance window; on RabbitMQ it takes effect immediately. Provide the
implementation with Effect.provide(AWS.MQ.DeleteUserHttp).
DeleteUser: Managing Users
Section titled “DeleteUser: Managing Users”const deleteUser = yield* MQ.DeleteUser(broker);
yield* deleteUser({ Username: "tenant-42" });DescribeBroker
Section titled “DescribeBroker”Source:
src/AWS/MQ/DescribeBroker.ts
Runtime binding for the DescribeBroker operation (IAM action
mq:DescribeBroker), scoped to one Broker.
Resolves the broker’s live state at runtime — engine version, instance
endpoints (the wire-protocol URIs clients connect to), pending changes,
and maintenance information. Provide the implementation with
Effect.provide(AWS.MQ.DescribeBrokerHttp).
DescribeBroker: Observing a Broker
Section titled “DescribeBroker: Observing a Broker”const describeBroker = yield* MQ.DescribeBroker(broker);
const info = yield* describeBroker();// info.BrokerState → "RUNNING"// info.BrokerInstances?.[0]?.Endpoints → ["ssl://b-….mq.us-west-2.amazonaws.com:61617", …]DescribeUser
Section titled “DescribeUser”Source:
src/AWS/MQ/DescribeUser.ts
Runtime binding for the DescribeUser operation (IAM action
mq:DescribeUser), scoped to one Broker.
Reads a broker user’s attributes — console access, groups, and any
pending change staged for the next reboot. Provide the implementation
with Effect.provide(AWS.MQ.DescribeUserHttp).
DescribeUser: Managing Users
Section titled “DescribeUser: Managing Users”const describeUser = yield* MQ.DescribeUser(broker);
const user = yield* describeUser({ Username: "tenant-42" });// user.Groups, user.Pending?.PendingChange → "CREATE" | "UPDATE" | "DELETE"ListBrokers
Section titled “ListBrokers”Source:
src/AWS/MQ/ListBrokers.ts
Runtime binding for the ListBrokers operation (IAM action
mq:ListBrokers on * — the operation is not resource-scoped).
Lists all Amazon MQ brokers in the account/region. Provide the
implementation with Effect.provide(AWS.MQ.ListBrokersHttp).
ListBrokers: Observing a Broker
Section titled “ListBrokers: Observing a Broker”const listBrokers = yield* MQ.ListBrokers();
const page = yield* listBrokers();// page.BrokerSummaries → [{ BrokerName: "orders", BrokerState: "RUNNING", … }]ListUsers
Section titled “ListUsers”Source:
src/AWS/MQ/ListUsers.ts
Runtime binding for the ListUsers operation (IAM action
mq:ListUsers), scoped to one Broker.
Lists all users on the broker, including any with staged pending changes.
Provide the implementation with Effect.provide(AWS.MQ.ListUsersHttp).
ListUsers: Managing Users
Section titled “ListUsers: Managing Users”const listUsers = yield* MQ.ListUsers(broker);
const page = yield* listUsers();// page.Users → [{ Username: "admin" }, { Username: "tenant-42", PendingChange: "CREATE" }]Promote
Section titled “Promote”Source:
src/AWS/MQ/Promote.ts
Runtime binding for the Promote operation (IAM action mq:Promote),
scoped to one Broker.
Promotes a cross-region data replication (CRDR) replica broker to the
primary role — SWITCHOVER performs a coordinated role exchange with the
current primary, FAILOVER promotes the replica unilaterally when the
primary is unreachable. Only meaningful for brokers created with
dataReplicationMode: "CRDR". Provide the implementation with
Effect.provide(AWS.MQ.PromoteHttp).
Promote: Disaster Recovery
Section titled “Promote: Disaster Recovery”const promote = yield* MQ.Promote(replica);
yield* promote({ Mode: "FAILOVER" });RebootBroker
Section titled “RebootBroker”Source:
src/AWS/MQ/RebootBroker.ts
Runtime binding for the RebootBroker operation (IAM action
mq:RebootBroker), scoped to one Broker.
Reboots the broker to apply pending modifications (engine version,
host instance type, configuration revision, user changes). The reboot is
asynchronous — the broker transitions through REBOOT_IN_PROGRESS back to
RUNNING. Provide the implementation with
Effect.provide(AWS.MQ.RebootBrokerHttp).
RebootBroker: Managing a Broker
Section titled “RebootBroker: Managing a Broker”const rebootBroker = yield* MQ.RebootBroker(broker);
yield* rebootBroker();UpdateUser
Section titled “UpdateUser”Source:
src/AWS/MQ/UpdateUser.ts
Runtime binding for the UpdateUser operation (IAM action
mq:UpdateUser), scoped to one Broker.
Updates a broker user’s password, console access, or groups — e.g.
rotating credentials at runtime. On ActiveMQ the change is staged and
applied at the next broker reboot or maintenance window; on RabbitMQ it
takes effect immediately. Provide the implementation with
Effect.provide(AWS.MQ.UpdateUserHttp).
UpdateUser: Managing Users
Section titled “UpdateUser: Managing Users”const updateUser = yield* MQ.UpdateUser(broker);
yield* updateUser({ Username: "tenant-42", Password: Redacted.make("NewSecretPassw0rd"),});