Skip to content

Releases: pellse/assembler

Assembler v0.6.2

12 Apr 14:18
Compare
Choose a tag to compare

What's Changed

  • New autoCache() event based helper method to avoid using AutoCacheFactoryBuilder when using default windowing strategy, error handler, life cycle management and scheduler:
import io.github.pellse.reactive.assembler.Assembler;
import io.github.pellse.reactive.assembler.caching.CacheFactory.CacheTransformer;
import static io.github.pellse.reactive.assembler.AssemblerBuilder.assemblerOf;
import static io.github.pellse.reactive.assembler.RuleMapper.oneToMany;
import static io.github.pellse.reactive.assembler.RuleMapper.oneToOne;
import static io.github.pellse.reactive.assembler.Rule.rule;
import static io.github.pellse.reactive.assembler.caching.CacheFactory.cached;
import static io.github.pellse.reactive.assembler.caching.AutoCacheFactory.autoCache;

// Example of your custom domain events not known by the Assembler Library
sealed interface MyEvent<T> {
    T item();
}
record Add<T>(T item) implements MyEvent<T> {}
record Delete<T>(T item) implements MyEvent<T> {}

record MyOtherEvent<T>(T value, boolean isAddEvent) {}

// E.g. Flux coming from a CDC/Kafka source
Flux<MyOtherEvent<BillingInfo>> billingInfoFlux = Flux.just(
    new MyOtherEvent<>(billingInfo1, true), new MyOtherEvent<>(billingInfo2, true),
    new MyOtherEvent<>(billingInfo2, false), new MyOtherEvent<>(billingInfo3, false));

// E.g. Flux coming from a CDC/Kafka source
Flux<MyEvent<OrderItem>> orderItemFlux = Flux.just(
    new Add<>(orderItem11), new Add<>(orderItem12), new Add<>(orderItem13),
    new Delete<>(orderItem31), new Delete<>(orderItem32), new Delete<>(orderItem33));

CacheTransformer<Long, BillingInfo, BillingInfo> billingInfoAutoCache =
    autoCache(billingInfoFlux, MyOtherEvent::isAddEvent, MyOtherEvent::value); // New autoCache() method

CacheTransformer<Long, OrderItem, List<OrderItem>> orderItemAutoCache =
    autoCache(orderItemFlux, Add.class::isInstance, MyEvent::item); // New autoCache() method

Assembler<Customer, Flux<Transaction>> assembler = assemblerOf(Transaction.class)
    .withCorrelationIdExtractor(Customer::customerId)
    .withAssemblerRules(
        rule(BillingInfo::customerId, oneToOne(cached(this::getBillingInfo, billingInfoAutoCache))),
        rule(OrderItem::customerId, oneToMany(OrderItem::id, cached(this::getAllOrders, orderItemAutoCache))),
        Transaction::new)
    .build();
  • Replaced onErrorStop() with onErrorContinue() as the default autoCache() error handler

Dependencies upgrades

  • Kotlin 1.8.20

Assembler v0.6.1

31 Mar 17:04
Compare
Choose a tag to compare

What's Changed

  • Default Concurrent Cache wrapper for all cache implementations
  • Ability to plug custom Scheduler in autoCache
  • No param cache() now implemented with a HashMap instead of ConcurrentHashMap as concurrentCache() provides correct concurrency semantic
  • new concurrentLifeCycleEventListener() separated from adapter logic
  • putAll() delegates to Caffeine synchronous LoadingCache in CaffeineCacheFactory
  • ConcurrencyStrategy defaults to SINGLE_READER
  • ConcurrentCacheFactory.concurrentCache() can now be configured with different ConcurrencyStrategy
  • New autoCache() with default config to avoid using AutoCacheFactoryBuilder for simple cases

Dependencies upgrades

  • Project Reactor 3.5.4
  • Caffeine Cache 3.1.5

Assembler v0.6.0

23 Feb 20:04
Compare
Choose a tag to compare

Big release involving partial rewrite of the Assembler Library core, small breaking API changes, improved concurrency performance and reliability of caching, better error handling and many bug fixes:

What's Changed

  • Unified cache interface for one to one and one to many rules
  • Refactoring AutoCacheFactory and ConcurrentCache for non-blocking CAS (compare and swap) read-write locking semantics
  • ID extractor function passed to oneToMany() to allow comparisons by ID
  • Generic Retry strategies can be injected in ConcurrentCache
  • Ability to register SubscriptionEventListener to control the subscription of the inner Flux in AutoCacheFactory
  • CacheFactory.cached() can now fall back to directly call fetchFunction when an error occurs in the underlying cache itself
  • New decorator functions in ConcurrentCacheFactory to make any CacheFactory safe for concurrent usage

Breaking API changes:

  • withIdExtractor() renamed to withCorrelationIdExtractor() in AssemblerBuilder
  • ID extractor function passed to oneToMany()
var assembler = assemblerOf(Transaction.class)
    .withCorrelationIdExtractor(Customer::customerId)
    .withAssemblerRules(
        rule(BillingInfo::customerId, oneToOne(cached(this::getBillingInfo), BillingInfo::new)),
        rule(OrderItem::customerId, oneToMany(OrderItem::id, cached(this::getAllOrders))),
        Transaction::new)
    .build();
  • Overloaded versions of AutoCacheFactory.autoCache() replaced with AutoCacheFactoryBuilder.autoCache() and AutoCacheFactoryBuilder.autoCacheEvents()
var assembler = assemblerOf(Transaction.class)
    .withCorrelationIdExtractor(Customer::customerId)
    .withAssemblerRules(
        rule(BillingInfo::customerId, oneToOne(cached(
            autoCacheEvents(billingInfoFlux)
                .maxWindowSize(3)
                .build()))),
        rule(OrderItem::customerId, oneToMany(OrderItem::id, cached(getAllOrders, cache(),
            autoCache(orderItemFlux, CDCAdd.class::isInstance, CDC::item)
                .maxWindowSize(3)
                .build()))),
        Transaction::new)
    .build();

Dependencies upgrades

  • Project Reactor 3.5.3
  • Caffeine Cache 3.1.4
  • Kotlin 1.8.10

Assembler v0.5.0

07 Jun 14:37
Compare
Choose a tag to compare

This is a big release which adds support for automatic asynchronous cache population for cached assembler rules via autoCache(), allowing e.g. to consume changes pushed from a CDC solution (Change Data Capture like Debezium/Kafka) and populate cache:

var assembler = assemblerOf(Transaction.class)
    .withIdExtractor(Customer::customerId)
    .withAssemblerRules(
        rule(BillingInfo::customerId, oneToOne(cached(this::getBillingInfo, autoCache(billingInfoCDCFlux)))),
        rule(OrderItem::customerId, oneToMany(cached(this::getAllOrders, caffeineCache(), autoCache(orderItemCDCFlux)))),
        Transaction::new)
    .build();

Assembler v0.4.2

03 May 17:48
Compare
Choose a tag to compare

This version adds a new utility static method toPublisher() to convert non-reactive sources into Publisher:

import static io.github.pellse.reactive.assembler.QueryUtils.toPublisher;

List<BillingInfo> getBillingInfo(List<Long> customerIds);
List<OrderItem> getAllOrders(List<Long> customerIds);

var assembler = assemblerOf(Transaction.class)
    .withIdExtractor(Customer::customerId)
    .withAssemblerRules(
        rule(BillingInfo::customerId, oneToOne(toPublisher(this::getBillingInfo))),
        rule(OrderItem::customerId, oneToMany(toPublisher(this::getAllOrders))),
        Transaction::new)
    .build();

Assembler v0.4.1

19 Apr 03:51
a3af4bd
Compare
Choose a tag to compare

What's Changed

  • Support third party integration for asynchronous caching
  • Integration with Caffeine async cache api
  • Upgrade to Project Reactor 3.4.17

Assembler v0.4.0

12 Apr 02:30
0623a32
Compare
Choose a tag to compare
  • New cache API to support caching of individual values from downstream Publisher defined in assembler rules
  • Breaking API change to enabled passing a RuleContext in assembler rules through the rule() helper function

Before release 0.4.0:

Assembler<Customer, Flux<Transaction>> assembler = assemblerOf(Transaction.class)
    .withIdExtractor(Customer::customerId)
    .withAssemblerRules(
        oneToOne(this::getBillingInfo, BillingInfo::customerId),
        oneToMany(this::getAllOrders, OrderItem::customerId),
        Transaction::new)
    .build();

Since release 0.4.0:

Assembler<Customer, Flux<Transaction>> assembler = assemblerOf(Transaction.class)
    .withIdExtractor(Customer::customerId)
    .withAssemblerRules(
        rule(BillingInfo::customerId, oneToOne(this::getBillingInfo)),
        rule(OrderItem::customerId, oneToMany(this::getAllOrders)),
        Transaction::new)
    .build();

Assembler v0.3.4

01 Apr 04:35
8362f6b
Compare
Choose a tag to compare
  • Added cached() extension function to AssemblerKotlinSupport
  • Renamed newCache() to cache()

Assembler v0.3.3

01 Apr 02:47
06e8fbe
Compare
Choose a tag to compare

Support for pluggable caching mechanism

Assembler v0.3.2

29 Mar 04:06
897764c
Compare
Choose a tag to compare

Upgrade to Java 17 compatibility