Skip to content

Commit 1572a59

Browse files
committed
Merge remote-tracking branch 'swisspost/develop' into feature branch
Conflicts: gateleen-core/src/main/java/org/swisspush/gateleen/core/http/AbstractHttpClient.java
2 parents d6f2e56 + 16c28a5 commit 1572a59

File tree

32 files changed

+76
-40
lines changed

32 files changed

+76
-40
lines changed

.github/workflows/maven.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
redis-version: 4
3434

3535
- name: Install chromedriver
36-
uses: nanasess/setup-chromedriver@v1.1.0
37-
36+
uses: nanasess/setup-chromedriver@v2
37+
3838
- name: Install, unit test
3939
run: mvn install -Dmaven.javadoc.skip=true -PpublicRepos -B -V
4040

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ This is a list of the custom headers used by Gateleen.
144144
## Performance Tuning
145145
* The amount of max open files per process should be at least 16384. You can check your max open files per process with this command `cat /proc/<process id>/limits`.
146146
* The amount of open files depends on the amount of open Http Requests, which are holding a tcp connection which are holding a file handle.
147-
* The important number to control the open Http Requests is the pool size of the Http Client. The higher the pool size the higher the open files.
147+
* The important number to control the open HTTP requests is the pool size of the Http Client. The higher the pool size the higher the open files.
148148

149149
## Dependencies
150150
* [vertx-rest-storage](https://github.com/swisspush/vertx-rest-storage) at least release [v2.0.2](https://github.com/swisspush/vertx-rest-storage/releases/tag/v2.0.2)

gateleen-cache/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-cache</artifactId>

gateleen-core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-core</artifactId>

gateleen-core/src/main/java/org/swisspush/gateleen/core/http/AbstractHttpClient.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import java.util.List;
1212
import java.util.function.Function;
1313

14+
import static io.vertx.core.Future.succeededFuture;
15+
1416
/**
1517
* Base class with empty method implementations.
1618
*
@@ -81,7 +83,7 @@ public Future<HttpClientRequest> request(RequestOptions requestOptions) {
8183

8284
@Override
8385
public void request(HttpMethod httpMethod, int i, String s, String s1, Handler<AsyncResult<HttpClientRequest>> handler) {
84-
Future.succeededFuture(doRequest(httpMethod, s1)).onComplete(handler);
86+
vertx.runOnContext(v -> succeededFuture(doRequest(httpMethod, s1)).onComplete(handler));
8587
}
8688

8789
@Override
@@ -101,7 +103,7 @@ public Future<HttpClientRequest> request(HttpMethod httpMethod, String s, String
101103

102104
@Override
103105
public void request(HttpMethod method, String requestURI, Handler<AsyncResult<HttpClientRequest>> handler) {
104-
throw new UnsupportedOperationException();
106+
vertx.runOnContext(v -> succeededFuture(doRequest(method, requestURI)).onComplete(handler));
105107
}
106108

107109
@Override
@@ -163,4 +165,4 @@ public Future<WebSocket> webSocketAbs(String s, MultiMap multiMap, WebsocketVers
163165
public boolean isMetricsEnabled() {
164166
throw new UnsupportedOperationException();
165167
}
166-
}
168+
}

gateleen-delegate/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-delegate</artifactId>

gateleen-delta/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-delta</artifactId>

gateleen-expansion/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-expansion</artifactId>

gateleen-hook-js/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.swisspush.gateleen</groupId>
66
<artifactId>gateleen</artifactId>
7-
<version>2.0.1-SNAPSHOT</version>
7+
<version>2.0.3-SNAPSHOT</version>
88
</parent>
99
<artifactId>gateleen-hook-js</artifactId>
1010
<packaging>jar</packaging>

gateleen-hook/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-hook</artifactId>

gateleen-kafka/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-kafka</artifactId>

gateleen-logging/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-logging</artifactId>

gateleen-logging/src/main/java/org/swisspush/gateleen/logging/LoggingHandler.java

+17-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.vertx.core.http.HttpMethod;
88
import io.vertx.core.http.HttpServerRequest;
99
import io.vertx.core.json.DecodeException;
10+
import io.vertx.core.json.JsonArray;
1011
import io.vertx.core.json.JsonObject;
1112
import org.apache.logging.log4j.LogManager;
1213
import org.apache.logging.log4j.core.Appender;
@@ -294,17 +295,29 @@ public void log(String uri, HttpMethod method, int statusCode, String statusMess
294295
requestLog.put(HEADERS, headersAsJson(requestHeaders));
295296
responseLog.put(HEADERS, headersAsJson(responseHeaders));
296297
if (requestPayload != null) {
298+
String requestPayloadString = requestPayload.toString("UTF-8");
297299
try {
298-
requestLog.put(BODY, new JsonObject(requestPayload.toString("UTF-8")));
300+
requestLog.put(BODY, new JsonObject(requestPayloadString));
299301
} catch (DecodeException e) {
300-
// ignore, bogus JSON
302+
// maybe payload was a JsonArray
303+
try {
304+
requestLog.put(BODY, new JsonArray(requestPayloadString));
305+
} catch (DecodeException ex) {
306+
log.info("request payload could not be parsed and will not be logged");
307+
}
301308
}
302309
}
303310
if (responsePayload != null) {
311+
String responsePayloadString = responsePayload.toString("UTF-8");
304312
try {
305-
responseLog.put(BODY, new JsonObject(responsePayload.toString("UTF-8")));
313+
responseLog.put(BODY, new JsonObject(responsePayloadString));
306314
} catch (DecodeException e) {
307-
// ignore, bogus JSON
315+
// maybe payload was a JsonArray
316+
try {
317+
responseLog.put(BODY, new JsonArray(responsePayloadString));
318+
} catch (DecodeException ex) {
319+
log.info("response payload could not be parsed and will not be logged");
320+
}
308321
}
309322
}
310323

gateleen-merge/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-merge</artifactId>

gateleen-monitoring/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-monitoring</artifactId>

gateleen-packing/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-packing</artifactId>

gateleen-player/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-player</artifactId>

gateleen-playground/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-playground</artifactId>

gateleen-playground/src/main/java/org/swisspush/gateleen/playground/Server.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,15 @@ public void start() {
181181

182182
String redisHost = (String) props.get("redis.host");
183183
Integer redisPort = (Integer) props.get("redis.port");
184+
boolean redisEnableTls = props.get("redis.enableTls") != null ? (Boolean) props.get("redis.enableTls") : false;
184185

185186
props.put(ExpansionHandler.MAX_EXPANSION_LEVEL_HARD_PROPERTY, "100");
186187
props.put(ExpansionHandler.MAX_EXPANSION_LEVEL_SOFT_PROPERTY, "50");
187188

188189
RunConfig.deployModules(vertx, Server.class, props, success -> {
189190
if (success) {
190-
redisClient = new RedisClient(vertx, new RedisOptions().setConnectionString("redis://" + redisHost + ":" + redisPort));
191+
String protocol = redisEnableTls ? "rediss://" : "redis://";
192+
redisClient = new RedisClient(vertx, new RedisOptions().setConnectionString(protocol + redisHost + ":" + redisPort));
191193
redisApi = RedisAPI.api(redisClient);
192194
RedisProvider redisProvider = () -> Future.succeededFuture(redisApi);
193195

gateleen-qos/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-qos</artifactId>

gateleen-queue/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-queue</artifactId>

gateleen-routing/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-routing</artifactId>

gateleen-runconfig/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-runconfig</artifactId>

gateleen-runconfig/src/main/java/org/swisspush/gateleen/runconfig/RunConfig.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,17 @@ public RunConfig build(Vertx vertx, RedisProvider redisProvider, Class verticleC
382382
* Builds redis properties configuration.
383383
*/
384384
public static Map<String, Object> buildRedisProps(String redisHost, int redisPort) {
385+
return buildRedisProps(redisHost, redisPort, false);
386+
}
387+
388+
/**
389+
* Builds redis properties configuration.
390+
*/
391+
public static Map<String, Object> buildRedisProps(String redisHost, int redisPort, boolean redisEnableTls) {
385392
final Map<String, Object> props = new HashMap<>();
386393
props.put("redis.host", redisHost);
387394
props.put("redis.port", redisPort);
395+
props.put("redis.enableTls", redisEnableTls);
388396
props.put("redis.encoding", "UTF-8");
389397
return props;
390398
}
@@ -393,9 +401,17 @@ public static Map<String, Object> buildRedisProps(String redisHost, int redisPor
393401
* Builds a standard mod redis configuration.
394402
*/
395403
public static JsonObject buildModRedisConfig(String redisHost, int redisPort) {
404+
return buildModRedisConfig(redisHost, redisPort, false);
405+
}
406+
407+
/**
408+
* Builds a standard mod redis configuration.
409+
*/
410+
public static JsonObject buildModRedisConfig(String redisHost, int redisPort, boolean redisEnableTls) {
396411
JsonObject config = new JsonObject();
397412
config.put("host", redisHost);
398413
config.put("port", redisPort);
414+
config.put("enableTls", redisEnableTls);
399415
config.put("encoding", "UTF-8");
400416
return config;
401417
}
@@ -480,7 +496,8 @@ public static void deployModules(final Vertx vertx, Class verticleClass, Map<Str
480496
final Logger log = LoggerFactory.getLogger(verticleClass);
481497
String redisHost = (String) props.get("redis.host");
482498
Integer redisPort = (Integer) props.get("redis.port");
483-
log.info("deploying redis module with host:" + redisHost + " port:" + redisPort);
499+
boolean redisEnableTls = props.get("redis.enableTls") != null ? (Boolean) props.get("redis.enableTls") : false;
500+
log.info("deploying redis module with host: {}, port: {}, TLS: {}", redisHost, redisPort, redisEnableTls);
484501

485502
// redisques module
486503
vertx.deployVerticle("org.swisspush.redisques.RedisQues", new DeploymentOptions().setConfig(RunConfig.buildRedisquesConfig()).setInstances(4), event -> {

gateleen-scheduler/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-scheduler</artifactId>

gateleen-security/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-security</artifactId>

gateleen-test/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111
<artifactId>gateleen-test</artifactId>
1212
<packaging>jar</packaging>

gateleen-test/src/test/java/org/swisspush/gateleen/AbstractTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,15 @@ public static void setupBeforeClass(TestContext context) {
135135

136136
String redisHost = (String) props.get("redis.host");
137137
Integer redisPort = (Integer) props.get("redis.port");
138+
boolean redisEnableTls = props.get("redis.enableTls") != null ? (Boolean) props.get("redis.enableTls") : false;
138139

139140
props.put(ExpansionHandler.MAX_EXPANSION_LEVEL_HARD_PROPERTY, "100");
140141
props.put(ExpansionHandler.MAX_EXPANSION_LEVEL_SOFT_PROPERTY, "4");
141142

142143
RunConfig.deployModules(vertx, AbstractTest.class, props, success -> {
143144
if (success) {
144-
RedisClient redisClient = new RedisClient(vertx, new RedisOptions().setConnectionString("redis://" + redisHost + ":" + redisPort));
145+
String protocol = redisEnableTls ? "rediss://" : "redis://";
146+
RedisClient redisClient = new RedisClient(vertx, new RedisOptions().setConnectionString(protocol + redisHost + ":" + redisPort));
145147
RedisAPI redisAPI = RedisAPI.api(redisClient);
146148
RedisProvider redisProvider = () -> Future.succeededFuture(redisAPI);
147149

gateleen-testhelper/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-testhelper</artifactId>

gateleen-user/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-user</artifactId>

gateleen-validation/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.swisspush.gateleen</groupId>
88
<artifactId>gateleen</artifactId>
9-
<version>2.0.1-SNAPSHOT</version>
9+
<version>2.0.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>gateleen-validation</artifactId>

0 commit comments

Comments
 (0)