Adding batch support for Redis stream listener containers
Opened this issue · 2 comments
MrPickle311 commented
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);
});
}
}MrPickle311 commented
Can I create PR with my proposal ?