콘텐츠로 이동
AWS 문서0.4

서비스 plugin

최신 안정판 AWS 0.4.0 릴리스 기준

Ktor 서비스 plugin은 애플리케이션 설정을 typed runtime으로 바꾸고 application attribute나 operation interface로 노출합니다.

queueUrlqueueName 중 정확히 하나를 지정해야 하며 plugin instance 하나에는 handler 하나만 등록할 수 있습니다. poller 수, receive 크기, long poll, visibility, 삭제, 실패 visibility, heartbeat, 변환 정책, 종료 timeout을 하나의 전달 계약으로 설정하세요.

install(SqsConsumer) {
queueName = "orders"
coroutines = 4
maxMessages = 10
waitTimeSeconds = 20
onMessage<OrderMessage> { order -> process(order) }
}

주입한 SqsAsyncClient는 plugin이 닫지 않습니다. plugin이 직접 만든 client만 runtime이 소유하고 닫습니다.

DynamoDB plugin은 async·enhanced client를 만들거나 주입받고 repository runtime을 제공합니다. table 생성, index 선택, capacity, 재시도, 멱등성은 여전히 애플리케이션 책임입니다.

미리 만든 databaseProperties와 Ktor DSL 중 하나만 사용하세요. 둘을 섞으면 거부됩니다. 시작·종료 timeout, blocking transaction context, settings resolver를 설정합니다. runtime은 자신이 만든 registry를 닫습니다.

CloudWatch, Logs, IMDS, Access Grants, S3 Vectors도 같은 패턴을 따릅니다. 선택적 서비스 SDK, typed configuration, 명시적 소유권, runtime operations, stop hook으로 구성됩니다.

testApplication과 주입한 fake client로 수명 주기를 검증하고 서비스 동작은 Floci에서 테스트하세요. 누락·중복 설정, 취소, 변환 실패, redelivery, 종료 정리를 포함해야 합니다.