Tạo DSL với Kotlin để đọc dữ liệu từ Elasticsearch
Kotlin cho phép ta tạo DSL một cách dễ dàng. Hôm nay, chúng ta sẽ cùng tạo một DSL đơn giản để đọc dữ liệu từ Elasticsearch.
About technology stuff that piqued my interest
Kotlin cho phép ta tạo DSL một cách dễ dàng. Hôm nay, chúng ta sẽ cùng tạo một DSL đơn giản để đọc dữ liệu từ Elasticsearch.
Implementing a DSL can’t be easier with Kotlin. Today, we will create a toy DSL to query data from Elasticsearch cluster.
Thời gian xử lý request của Elasticsearch có thể kéo dài. Lúc này, ta có thể gửi chúng một cách không đồng bộ hoặc dùng async search.
Elasticsearch requests can take a long time. In such cases, we can send them in an asynchronous way, or use async search request.
Tiếp nối loạt bài về Elasticsearch, trong bài hôm nay chúng ta sẽ tìm hiểu hai phương pháp tạo request với Kotlin và thư viên Elasticsearch API Client.
In Kotlin, Elasticsearch API Client is the recommended library to interact with Elasticsearch cluster. Today, e will find out how to use it to query data.
Đôi khi ta cần phải thay đổi Datadog metric sinh bởi library của bên thứ ba. Lúc này, interface MeterFilter là một công cụ hữu ích.
Sometimes, we need to modify Datadog metrics emitted by a third party libraries. In that case, the MeterFilter interface is a powerful tool.
Kotlin hỗ trợ ta implement pattern Delegation. Nó giúp ta không phải viết nhiều code. Nhưng ta phải chú ý tới những hạn chế của tính năng này.
Kotlin has great support for implementing the delegation pattern. But we must be mindful of its limitations and pitfalls.