@@ -3,7 +3,7 @@ import cdk = require('@aws-cdk/cdk');
3
3
import { QueueWorkerServiceBase , QueueWorkerServiceBaseProps } from '../base/queue-worker-service-base' ;
4
4
5
5
/**
6
- * Properties to define an Ec2 query worker service
6
+ * Properties to define an Ec2 queue worker service
7
7
*/
8
8
export interface Ec2QueueWorkerServiceProps extends QueueWorkerServiceBaseProps {
9
9
/**
@@ -41,9 +41,15 @@ export interface Ec2QueueWorkerServiceProps extends QueueWorkerServiceBaseProps
41
41
}
42
42
43
43
/**
44
- * Class to create an Ec2 query worker service
44
+ * Class to create an Ec2 queue worker service
45
45
*/
46
46
export class Ec2QueueWorkerService extends QueueWorkerServiceBase {
47
+
48
+ /**
49
+ * The ECS service in this construct
50
+ */
51
+ public readonly service : ecs . Ec2Service ;
52
+
47
53
constructor ( scope : cdk . Construct , id : string , props : Ec2QueueWorkerServiceProps ) {
48
54
super ( scope , id , props ) ;
49
55
@@ -61,11 +67,11 @@ export class Ec2QueueWorkerService extends QueueWorkerServiceBase {
61
67
62
68
// Create an ECS service with the previously defined Task Definition and configure
63
69
// autoscaling based on cpu utilization and number of messages visible in the SQS queue.
64
- const ecsService = new ecs . Ec2Service ( this , 'QueueWorkerService' , {
70
+ this . service = new ecs . Ec2Service ( this , 'QueueWorkerService' , {
65
71
cluster : props . cluster ,
66
72
desiredCount : this . desiredCount ,
67
73
taskDefinition
68
74
} ) ;
69
- this . configureAutoscalingForService ( ecsService ) ;
75
+ this . configureAutoscalingForService ( this . service ) ;
70
76
}
71
77
}
0 commit comments