-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathaws-microservices-stack.ts
37 lines (30 loc) · 1.23 KB
/
aws-microservices-stack.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { SwnApiGateway } from './apigateway';
import { SwnDatabase } from './database';
import { SwnEventBus } from './eventbus';
import { SwnMicroservices } from './microservice';
import { SwnQueue } from './queue';
export class AwsMicroservicesStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const database = new SwnDatabase(this, 'Database');
const microservices = new SwnMicroservices(this, 'Microservices', {
productTable: database.productTable,
basketTable: database.basketTable,
orderTable: database.orderTable
});
const apigateway = new SwnApiGateway(this, 'ApiGateway', {
productMicroservice: microservices.productMicroservice,
basketMicroservice: microservices.basketMicroservice,
orderingMicroservices: microservices.orderingMicroservice
});
const queue = new SwnQueue(this, 'Queue', {
consumer: microservices.orderingMicroservice
});
const eventbus = new SwnEventBus(this, 'EventBus', {
publisherFuntion: microservices.basketMicroservice,
targetQueue: queue.orderQueue
});
}
}