-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
@MrPickle311
Description
A good option in Redis stream processing would be adding a batch processing feature. It can improve performance and comfort using Stream API for Spring Data Redis.
For example new/extended interface can look like this.
@FunctionalInterface public interface BatchStreamListener<K, V extends Record<K, ?>> { void onMessage(List<V> message); }
example usage:
public class SomeService { private final SomeJpaRepository someJpaRepository; private final StreamMessageListenerContainer container; void someMethod() { StreamReadRequest<String> readRequest = ...; container.registerBatch(readRequest, messages -> { List<SomeEntity> result = someJpaRepository.findAllById(messages.map(SomeRecord:::getId).toList()); processResult(result); }); } }