[
https://issues.apache.org/jira/browse/AMQ-9646?focusedWorklogId=954403&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-954403
]
ASF GitHub Bot logged work on AMQ-9646:
---------------------------------------
Author: ASF GitHub Bot
Created on: 27/Jan/25 20:55
Start Date: 27/Jan/25 20:55
Worklog Time Spent: 10m
Work Description: cshannon commented on code in PR #1377:
URL: https://github.com/apache/activemq/pull/1377#discussion_r1931149205
##########
activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java:
##########
@@ -733,35 +733,95 @@ public void execute(Transaction tx) throws Exception {
}
@Override
- public void recoverNextMessages(final int offset, final int
maxReturned, final MessageRecoveryListener listener) throws Exception {
+ public void recoverNextMessages(final long offset, final int
maxReturned, final MessageRecoveryListener listener) throws Exception {
+ recoverNextMessages(offset, maxReturned, listener, false);
Review Comment:
I think the default should be true for a separate cursor, I think it's a bad
idea to be changing the state by default for a backup
##########
activemq-console/src/main/java/org/apache/activemq/console/command/store/StoreBackup.java:
##########
@@ -178,7 +194,19 @@ public boolean recoverMessage(Message message) throws
IOException {
return true;
}
};
- if(offset != null) {
+ if(startMsgId != null || endMsgId != null) {
+ System.out.println("Backing up from startMsgId: " +
startMsgId + " to endMsgId: " + endMsgId);
Review Comment:
I am thinking for System.out it may be better to use slf4j and log4j2 and
configure that for writing to stdout vs directly using System.out.println
##########
activemq-console/src/main/java/org/apache/activemq/console/command/store/StoreBackup.java:
##########
@@ -88,6 +96,14 @@ public void execute() throws Exception {
throw new Exception("optional --offset and --count must be
specified together");
}
+ if ((startMsgId != null || endMsgId != null) && queue == null) {
+ throw new Exception("optional --queue must be specified when using
startMsgId or endMsgId");
Review Comment:
All these exceptions should be more specific, such as
IllegalArgumentException.
All the checks here would benefit from something like
[Preconditions](https://guava.dev/releases/snapshot/api/docs/com/google/common/base/Preconditions.html)
and the checkArgument() methods if we can use guava.
##########
activemq-console/src/main/java/org/apache/activemq/console/command/store/StoreBackup.java:
##########
@@ -178,7 +194,19 @@ public boolean recoverMessage(Message message) throws
IOException {
return true;
}
};
- if(offset != null) {
+ if(startMsgId != null || endMsgId != null) {
+ System.out.println("Backing up from startMsgId: " +
startMsgId + " to endMsgId: " + endMsgId);
+ queue.recoverNextMessages(startMsgId, endMsgId, (count !=
null ? count : Integer.MAX_VALUE), queueRecoveryListener, true);
+ } else if(indexesList != null) {
+ System.out.println("Backing up using indexes count: " +
indexesList.size());
+ for(int idx : indexesList) {
+ if(idx < 0) {
Review Comment:
Why would there be a negative index? I would think this should be an
exception and not just a continue
Issue Time Tracking
-------------------
Worklog Id: (was: 954403)
Time Spent: 1.5h (was: 1h 20m)
> Support selecting specific messages for command line backup
> -----------------------------------------------------------
>
> Key: AMQ-9646
> URL: https://issues.apache.org/jira/browse/AMQ-9646
> Project: ActiveMQ Classic
> Issue Type: Improvement
> Reporter: Matt Pavlovich
> Assignee: Matt Pavlovich
> Priority: Minor
> Fix For: 6.2.0, 5.19.0
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact