Skip to content

Commit

Permalink
Merge pull request #157 from hiddenalpha/FixBadHabitsInRedisquesHttpR…
Browse files Browse the repository at this point in the history
…equestHandler-20240327-1252
  • Loading branch information
hiddenalpha authored Apr 2, 2024
2 parents e7b4c46 + b9d47aa commit b8a8eca
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ public class RedisquesHttpRequestHandler implements Handler<HttpServerRequest> {
private final QueueStatisticsCollector queueStatisticsCollector;

public static void init(Vertx vertx, RedisquesConfiguration modConfig, QueueStatisticsCollector queueStatisticsCollector) {
log.info("Enable http request handler: " + modConfig.getHttpRequestHandlerEnabled());
log.info("Enabling http request handler: {}", modConfig.getHttpRequestHandlerEnabled());
if (modConfig.getHttpRequestHandlerEnabled()) {
if (modConfig.getHttpRequestHandlerPort() != null && modConfig.getHttpRequestHandlerUserHeader() != null) {
RedisquesHttpRequestHandler handler = new RedisquesHttpRequestHandler(vertx, modConfig, queueStatisticsCollector);
// in Vert.x 2x 100-continues was activated per default, in vert.x 3x it is off per default.
HttpServerOptions options = new HttpServerOptions().setHandle100ContinueAutomatically(true);
vertx.createHttpServer(options).requestHandler(handler).listen(modConfig.getHttpRequestHandlerPort(), result -> {
if (result.succeeded()) {
log.info("Successfully started http request handler on port " + modConfig.getHttpRequestHandlerPort());
log.info("Successfully started http request handler on port {}", modConfig.getHttpRequestHandlerPort());
} else {
log.error("Unable to start http request handler.", result.cause());
}
Expand Down Expand Up @@ -710,7 +710,8 @@ private void listQueueItems(RoutingContext ctx) {
} else {
ctx.response().setStatusCode(StatusCode.NOT_FOUND.getStatusCode());
ctx.response().end(replyBody.getString(MESSAGE));
log.warn("Error in routerMatcher.getWithRegEx. Command = '" + (replyBody.getString("command") == null ? "<null>" : replyBody.getString("command")) + "'.");
log.warn("Error in routerMatcher.getWithRegEx. Command = '{}'.",
replyBody.getString("command") == null ? "<null>" : replyBody.getString("command"));
}
});
});
Expand Down Expand Up @@ -869,7 +870,7 @@ private void bulkDeleteQueues(RoutingContext ctx) {

private void respondWith(StatusCode statusCode, String responseMessage, HttpServerRequest request) {
final HttpServerResponse response = request.response();
log.info("Responding with status code " + statusCode + " and message: " + responseMessage);
log.info("Responding with status code {} and message: {}", statusCode, responseMessage);
response.setStatusCode(statusCode.getStatusCode());
response.setStatusMessage(statusCode.getStatusMessage());
response.putHeader(CONTENT_TYPE, TEXT_PLAIN);
Expand Down Expand Up @@ -939,7 +940,7 @@ private int extractLimit(RoutingContext ctx) {
return Integer.parseInt(limitParam);
} catch (NumberFormatException ex) {
if (limitParam != null) {
log.warn("Non-numeric limit parameter value used: " + limitParam);
log.warn("Non-numeric limit parameter value used: {}", limitParam);
}
return Integer.MAX_VALUE;
}
Expand Down

0 comments on commit b8a8eca

Please sign in to comment.