mattrpav commented on code in PR #1377: URL: https://github.com/apache/activemq/pull/1377#discussion_r1946851053
########## activemq-broker/src/main/java/org/apache/activemq/store/MessageRecoveryContext.java: ########## @@ -0,0 +1,174 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.store; + +import java.util.concurrent.atomic.AtomicInteger; +import org.apache.activemq.command.Message; +import org.apache.activemq.command.MessageId; + +public class MessageRecoveryContext implements MessageRecoveryListener { + + public static final int DEFAULT_MAX_MESSAGE_COUNT_RETURNED = 100; + public static final boolean DEFAULT_USE_DEDICATED_CURSOR = true; + + // Config + private boolean useDedicatedCursor; + private int maxMessageCountReturned; + private Long offset = null; + private String startMessageId = null; + private String endMessageId = null; + private final MessageRecoveryListener messageRecoveryListener; + + // State + private Long endSequenceId = Long.MAX_VALUE; + + // Stats + private AtomicInteger recoveredCount = new AtomicInteger(0); + + MessageRecoveryContext(final MessageRecoveryListener messageRecoveryListener, final String startMessageId, final String endMessageId, final Long offset, final Integer maxMessageCountReturned, final Boolean useDedicatedCursor) { + if(maxMessageCountReturned != null && maxMessageCountReturned < 0) { + throw new IllegalArgumentException("maxMessageCountReturned must be a positive integer value"); + } + if(messageRecoveryListener == null) { + throw new IllegalArgumentException("MessageRecoveryListener must be specified"); + } + if(offset != null) { + if(offset < 0L) { Review Comment: Error message updated to be consistent -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact