gnodet-bot commented on code in PR #29459: URL: https://github.com/apache/camel/pull/29459#discussion_r4511775843
########## dsl/camel-cli-connector/src/main/java/org/apache/camel/cli/connector/RepeatedSend.java: ########## @@ -0,0 +1,201 @@ +/* + * 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.camel.cli.connector; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import org.apache.camel.console.DevConsole; +import org.apache.camel.util.FileUtil; +import org.apache.camel.util.json.JsonArray; +import org.apache.camel.util.json.JsonObject; + +/** + * The send action with a repeat or a folder of messages ({@code camel cmd send --repeat=50 --interval=200ms}, and + * {@code --body=file:<folder>/}): it sends the messages through the send dev console one after another, with a pause + * between them, and answers with a summary when done (CAMEL-26767). It runs on a thread of its own, so the status and + * the other actions of the connector go on meanwhile, and it stops when the client gives up the request. + * <p/> + * The messages of a folder are its files in name order, one message per file, leaving out hidden files and the + * {@code .properties} files: {@code 001.properties} has the headers of {@code 001.json}. The folder is read by the + * integration, relative to its working directory, as the file of a single body is. + */ +final class RepeatedSend { + + static final int MAX_MESSAGES = 10000; + static final long MAX_INTERVAL = 60000; Review Comment: `MAX_MESSAGES=10000` and `MAX_INTERVAL=60000` are duplicated in `CamelSendAction` (line 167 and 168 there). If either copy changes, the client and server silently disagree on limits — the CLI will accept a value the server rejects, or vice versa. Consider extracting these to a shared constants class in a module both depend on, or add a comment cross-referencing the other definition. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
