4
4
import java .util .Set ;
5
5
import java .util .stream .Collectors ;
6
6
7
+ import org .slf4j .Logger ;
7
8
import org .springframework .batch .item .ItemWriter ;
8
9
import org .springframework .expression .spel .support .StandardEvaluationContext ;
9
10
import org .springframework .util .Assert ;
@@ -72,12 +73,11 @@ protected <O> Step<KeyValue<String>, O> step(ItemWriter<O> writer) {
72
73
73
74
protected <K , V , T , O > Step <KeyValue <K >, O > step (RedisItemReader <K , V > reader , ItemWriter <O > writer ) {
74
75
Step <KeyValue <K >, O > step = new Step <>(reader , writer );
75
- if (reader .getMode () != ReaderMode .LIVEONLY ) {
76
+ if (reader .getMode () == ReaderMode .SCAN ) {
76
77
log .info ("Configuring step with scan size estimator" );
77
78
step .maxItemCountSupplier (reader .scanSizeEstimator ());
78
- }
79
- if (reader .getMode () != ReaderMode .SCAN ) {
80
- checkNotifyConfig (reader .getClient ());
79
+ } else {
80
+ checkNotifyConfig (reader .getClient (), log );
81
81
log .info ("Configuring export step with live true, flushInterval {}, idleTimeout {}" ,
82
82
reader .getFlushInterval (), reader .getIdleTimeout ());
83
83
step .live (true );
@@ -87,7 +87,7 @@ protected <K, V, T, O> Step<KeyValue<K>, O> step(RedisItemReader<K, V> reader, I
87
87
return step ;
88
88
}
89
89
90
- private void checkNotifyConfig (AbstractRedisClient client ) {
90
+ public static void checkNotifyConfig (AbstractRedisClient client , Logger log ) {
91
91
Map <String , String > valueMap ;
92
92
try (StatefulRedisModulesConnection <String , String > conn = RedisModulesUtils .connection (client )) {
93
93
try {
@@ -105,7 +105,7 @@ private void checkNotifyConfig(AbstractRedisClient client) {
105
105
NOTIFY_CONFIG , NOTIFY_CONFIG_VALUE , actual ));
106
106
}
107
107
108
- private Set <Character > characterSet (String string ) {
108
+ private static Set <Character > characterSet (String string ) {
109
109
return string .codePoints ().mapToObj (c -> (char ) c ).collect (Collectors .toSet ());
110
110
}
111
111
0 commit comments