-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
1 parent
f92ac9a
commit 950a7d1
Showing
14 changed files
with
727 additions
and
5 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
...redis-client/runtime/src/main/java/io/quarkus/redis/datasource/stream/PendingMessage.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,68 @@ | ||
package io.quarkus.redis.datasource.stream; | ||
|
||
import java.time.Duration; | ||
|
||
/** | ||
* Represents the result of an expended xpending command. | ||
* In the extended form we no longer see the summary information, instead there is detailed information for each message | ||
* in the pending entries list. For each message four attributes are returned: | ||
* <ul> | ||
* <li>The ID of the message.</li> | ||
* <li>The name of the consumer that fetched the message and has still to acknowledge it. We call it the current owner of the | ||
* message.</li> | ||
* <li>The number of milliseconds that elapsed since the last time this message was delivered to this consumer.</li> | ||
* <li>The number of times this message was delivered.</li> | ||
* </ul> | ||
* <p> | ||
* While this structure is mutable, it is highly recommended to use it as a read-only structure. | ||
*/ | ||
public class PendingMessage { | ||
private final String messageId; | ||
private final String consumer; | ||
private final Duration durationSinceLastDelivery; | ||
|
||
private final int deliveryCount; | ||
|
||
public PendingMessage(String messageId, String consumer, Duration durationSinceLastDelivery, int deliveryCount) { | ||
this.messageId = messageId; | ||
this.consumer = consumer; | ||
this.durationSinceLastDelivery = durationSinceLastDelivery; | ||
this.deliveryCount = deliveryCount; | ||
} | ||
|
||
/** | ||
* Gets the message id. | ||
* | ||
* @return the message id; | ||
*/ | ||
public String getMessageId() { | ||
return messageId; | ||
} | ||
|
||
/** | ||
* Gets the consumer name. | ||
* | ||
* @return the consumer name | ||
*/ | ||
public String getConsumer() { | ||
return consumer; | ||
} | ||
|
||
/** | ||
* Gets the duration since the last delivery attempt. | ||
* | ||
* @return the duration | ||
*/ | ||
public Duration getDurationSinceLastDelivery() { | ||
return durationSinceLastDelivery; | ||
} | ||
|
||
/** | ||
* Gets the number of delivery attempts. | ||
* | ||
* @return the number of attempts | ||
*/ | ||
public int getDeliveryCount() { | ||
return deliveryCount; | ||
} | ||
} |
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
51 changes: 51 additions & 0 deletions
51
...s/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/stream/XPendingArgs.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,51 @@ | ||
package io.quarkus.redis.datasource.stream; | ||
|
||
import java.time.Duration; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import io.quarkus.redis.datasource.RedisCommandExtraArguments; | ||
|
||
public class XPendingArgs implements RedisCommandExtraArguments { | ||
|
||
private String owner; | ||
|
||
private Duration idle; | ||
|
||
/** | ||
* Sets the specific owner of the message | ||
* | ||
* @param owner the name of the consumer | ||
* @return the current {@code XPendingArgs} | ||
*/ | ||
public XPendingArgs consumer(String owner) { | ||
this.owner = owner; | ||
return this; | ||
} | ||
|
||
/** | ||
* Filters pending stream entries by their idle-time. | ||
* | ||
* @param idle the duration | ||
* @return the current {@code XPendingArgs} | ||
*/ | ||
public XPendingArgs idle(Duration idle) { | ||
this.idle = idle; | ||
return this; | ||
} | ||
|
||
public Duration idle() { | ||
return idle; | ||
} | ||
|
||
@Override | ||
public List<String> toArgs() { | ||
List<String> args = new ArrayList<>(); | ||
|
||
if (owner != null) { | ||
args.add(owner); | ||
} | ||
|
||
return args; | ||
} | ||
} |
Oops, something went wrong.