-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ buildNumber.properties | |
bin/ | ||
/build/ | ||
/.gradle/ | ||
*.log |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/redislabs/riot/batch/ThrottlingItemStreamReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.redislabs.riot.batch; | ||
|
||
import org.springframework.batch.item.ExecutionContext; | ||
import org.springframework.batch.item.ItemStreamException; | ||
import org.springframework.batch.item.ItemStreamReader; | ||
|
||
public class ThrottlingItemStreamReader<T> extends ThrottlingItemReader<T> implements ItemStreamReader<T> { | ||
|
||
private ItemStreamReader<T> reader; | ||
|
||
public ThrottlingItemStreamReader(ItemStreamReader<T> reader, long sleep) { | ||
super(reader, sleep); | ||
this.reader = reader; | ||
} | ||
|
||
@Override | ||
public void open(ExecutionContext executionContext) throws ItemStreamException { | ||
reader.open(executionContext); | ||
} | ||
|
||
@Override | ||
public void update(ExecutionContext executionContext) throws ItemStreamException { | ||
reader.update(executionContext); | ||
} | ||
|
||
@Override | ||
public void close() throws ItemStreamException { | ||
reader.close(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/redislabs/riot/redis/writer/DebugMapWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.redislabs.riot.redis.writer; | ||
|
||
import java.util.Map; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import io.lettuce.core.RedisFuture; | ||
import redis.clients.jedis.JedisCluster; | ||
import redis.clients.jedis.Pipeline; | ||
import redis.clients.jedis.Response; | ||
|
||
public class DebugMapWriter implements RedisMapWriter { | ||
|
||
private final Logger log = LoggerFactory.getLogger(DebugMapWriter.class); | ||
|
||
@Override | ||
public RedisFuture<?> write(Object commands, Map<String, Object> item) { | ||
debug(item); | ||
return null; | ||
} | ||
|
||
private void debug(Map<String, Object> item) { | ||
log.info("{}", item); | ||
} | ||
|
||
@Override | ||
public Response<?> write(Pipeline pipeline, Map<String, Object> item) { | ||
debug(item); | ||
return null; | ||
} | ||
|
||
@Override | ||
public void write(JedisCluster cluster, Map<String, Object> item) { | ||
debug(item); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
{ | ||
"facility": 1234, | ||
"userFullName": "Julien Ruaux", | ||
"userId": "jruaux", | ||
"sessionId": "c7ac5e75-33a2-466c-99be-1f112b394dg7", | ||
"roles": "[RN, PCT]", | ||
"timestamp": "2019-01-24T10:27:47.825Z", | ||
"body": "What do you call someone who hangs around with computer professionals? A DBA", | ||
"id": 123 | ||
} | ||
] |