Skip to content

Commit

Permalink
Make application properties of tenant client requests customizable.
Browse files Browse the repository at this point in the history
Signed-off-by: Karsten Frank <Karsten.Frank@bosch-si.com>
  • Loading branch information
sysexcontrol committed Apr 20, 2018
1 parent e66c143 commit 3ad4b37
Showing 1 changed file with 11 additions and 2 deletions.
Expand Up @@ -15,6 +15,7 @@

import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.Map;
import java.util.UUID;

import javax.security.auth.x500.X500Principal;
Expand Down Expand Up @@ -165,7 +166,7 @@ public final Future<TenantObject> get(final String tenantId) {
return getResponseFromCache(key).recover(t -> {
final Future<TenantResult<TenantObject>> tenantResult = Future.future();
final JsonObject payload = new JsonObject().put(TenantConstants.FIELD_PAYLOAD_TENANT_ID, tenantId);
createAndSendRequest(TenantConstants.TenantAction.get.toString(), null, payload,
createAndSendRequest(TenantConstants.TenantAction.get.toString(), customizeRequestApplicationProperties(), payload,
tenantResult.completer(), key);
return tenantResult;
}).map(tenantResult -> {
Expand All @@ -189,7 +190,7 @@ public final Future<TenantObject> get(final X500Principal subjectDn) {
return getResponseFromCache(key).recover(t -> {
final Future<TenantResult<TenantObject>> tenantResult = Future.future();
final JsonObject payload = new JsonObject().put(TenantConstants.FIELD_PAYLOAD_SUBJECT_DN, subjectDn.getName(X500Principal.RFC2253));
createAndSendRequest(TenantConstants.TenantAction.get.toString(), null, payload, tenantResult.completer(), key);
createAndSendRequest(TenantConstants.TenantAction.get.toString(), customizeRequestApplicationProperties(), payload, tenantResult.completer(), key);
return tenantResult;
}).map(tenantResult -> {
switch(tenantResult.getStatus()) {
Expand All @@ -200,4 +201,12 @@ public final Future<TenantObject> get(final X500Principal subjectDn) {
}
});
}

/**
* Customize AMQP application properties of the request by overwriting this method.
* @return The map that holds the properties to include in the AMQP 1.0 message, or null (if nothing is customized).
*/
protected Map<String, Object> customizeRequestApplicationProperties() {
return null;
}
}

0 comments on commit 3ad4b37

Please sign in to comment.