[모각글] 2023-11-14 #4
cheese10yun
announced in
Announcements
Replies: 3 comments
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
0 replies
-
코틀린 + 디자인 패턴빈번한 기능 추가에 대비하기 위해 데코레이터 패턴을 활용했습니다. 참고자료는 다음과 같습니다. abstract class ThumbnailDecorator(
private val thumbnail: Thumbnail
) : Thumbnail by thumbnail {
override fun content(): ByteArray {
return thumbnail.content()
}
}
class ThumbnailResizer(
private val thumbnail: Thumbnail
) : ThumbnailDecorator(thumbnail) {
override fun content(): ByteArray {
return 리사이즈(thumbnail.content())
}
}
class ThumbnailCompressor(
private val thumbnail: Thumbnail
) : ThumbnailDecorator(thumbnail) {
override fun content(): ByteArray {
return 압축(thumbnail.content())
}
} 코루틴 + 웹플럭스이터레이션을 비동기적으로 수행했을 때 모든 요청이 수행될 때까지 대기하는 suspend fun getAll(): Flow<Response> {
return service.getAll().map {
CoroutineScope(Dispatchers.IO).async {
get(it)
}
}.awaitAll().asFlow()
} 이벤트 스트림 형식으로 전달 할 수 있습니다. @GetMapping(
value = ["/"],
produces = [MediaType.TEXT_EVENT_STREAM_VALUE]
)
suspend fun getAll(): Flow<Response> {
return Service.getImages()
} 그런데 코드를 보면 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
2023-11-14
Beta Was this translation helpful? Give feedback.
All reactions