17 Ekim 2022 Pazartesi

Hazelcast Jet StreamStageWithKey İşlemleri

Giriş
Şu satırı dahil ederiz
import com.hazelcast.jet.pipeline.StreamStageWithKey;

filterStateful metodu
3 parametre alır
- ttl
- create function
- filter function
Örnek - deduplication
Şöyle yaparız
stage.groupingKey(AddNewComment::getUuid)
  .filterStateful(
    10_000, 
    () -> new boolean[1],
    (s, i) -> {
      boolean res = s[0];
      s[0] = true;
      return !res;
    }
);
Açıklaması şöyle
The first parameter in the filterStateful() method is time-to-live. Event time is typically in milliseconds. This means each state object will be retained for at least 10 seconds. We have to choose this parameter to match the longest possible time window between two duplicated elements.

Hiç yorum yok:

Yorum Gönder

HazelcastAPI CP SubSystem vs Transaciton Yapılar

Giriş Bu yazının yazılma sebebi bu soru 1. Transactional Yapılar Hazelcast TransactionalMap, birden fazla veri değişikliğinin tek bir işlem ...