@@ -37,7 +37,7 @@ public class LettuceClient implements Client {
3737 /**
3838 * The underlying Redis Client.
3939 */
40- private final LettuceAdapter client ;
40+ private final LettuceAdapter adapter ;
4141
4242 /**
4343 * Re-usable instance to prevent unnecessary garbage creation.
@@ -58,20 +58,20 @@ public LettuceClient(final RedisStreamSpoutConfig config, final int instanceId)
5858 // Determine which adapter to use based on what type of redis instance we are
5959 // communicating with.
6060 config .isConnectingToCluster ()
61- ? new LettuceClusterClient (RedisClusterClient .create (config .getConnectString ()))
62- : new LettuceRedisClient (RedisClient .create (config .getConnectString ()))
61+ ? new LettuceClusterAdapter (RedisClusterClient .create (config .getConnectString ()))
62+ : new LettuceRedisAdapter (RedisClient .create (config .getConnectString ()))
6363 );
6464 }
6565
6666 /**
6767 * Protected constructor for injecting a RedisClient instance, typically for tests.
6868 * @param config Configuration.
6969 * @param instanceId Which instance number is this running under.
70- * @param client RedisClient instance.
70+ * @param adapter RedisClient instance.
7171 */
72- LettuceClient (final RedisStreamSpoutConfig config , final int instanceId , final LettuceAdapter client ) {
72+ LettuceClient (final RedisStreamSpoutConfig config , final int instanceId , final LettuceAdapter adapter ) {
7373 this .config = Objects .requireNonNull (config );
74- this .client = Objects .requireNonNull (client );
74+ this .adapter = Objects .requireNonNull (adapter );
7575
7676 // Calculate consumerId
7777 this .consumerId = config .getConsumerIdPrefix () + instanceId ;
@@ -92,15 +92,15 @@ public LettuceClient(final RedisStreamSpoutConfig config, final int instanceId)
9292
9393 @ Override
9494 public void connect () {
95- if (client .isConnected ()) {
95+ if (adapter .isConnected ()) {
9696 throw new IllegalStateException ("Cannot call connect more than once!" );
9797 }
9898
99- client .connect ();
99+ adapter .connect ();
100100
101101 try {
102102 // Attempt to create consumer group
103- client .getSyncCommands ().xgroupCreate (
103+ adapter .getSyncCommands ().xgroupCreate (
104104 // Start the group at first offset for our key.
105105 XReadArgs .StreamOffset .from (config .getStreamKey (), "0-0" ),
106106 // Define the group name
@@ -128,7 +128,7 @@ public void connect() {
128128 @ Override
129129 public List <Message > nextMessages () {
130130 // Get next batch of messages.
131- final List <StreamMessage <String , String >> messages = client .getSyncCommands ().xreadgroup (
131+ final List <StreamMessage <String , String >> messages = adapter .getSyncCommands ().xreadgroup (
132132 consumerFrom ,
133133 xreadArgs ,
134134 lastConsumed
@@ -144,7 +144,7 @@ public List<Message> nextMessages() {
144144 @ Override
145145 public void commitMessage (final String msgId ) {
146146 // Confirm that the message has been processed using XACK
147- client .getSyncCommands ().xack (
147+ adapter .getSyncCommands ().xack (
148148 config .getStreamKey (),
149149 config .getGroupName (),
150150 msgId
@@ -153,6 +153,6 @@ public void commitMessage(final String msgId) {
153153
154154 @ Override
155155 public void disconnect () {
156- client .shutdown ();
156+ adapter .shutdown ();
157157 }
158158}
0 commit comments