Commit 5442903e authored by Dmitriy Novikov's avatar Dmitriy Novikov
Browse files

Added account-id and correlation-id to thread local headers

parent 62008808
......@@ -10,4 +10,6 @@ public class ThreadLocalHeaders {
private AtomicReference<String> dataPartitionId = new AtomicReference<>();
private AtomicReference<String> authorization = new AtomicReference<>();
private AtomicReference<String> userEmail = new AtomicReference<>();
private AtomicReference<String> accountId = new AtomicReference<>();
private AtomicReference<String> correlationId = new AtomicReference<>();
}
......@@ -119,17 +119,21 @@ public class IndexerServiceImpl implements IndexerService {
}
private void putAtomicHeadersFromMessages(Map<String, String> attributes) {
headers.setAuthorization(new AtomicReference<>(attributes.get("authorization")));
headers.setDataPartitionId(new AtomicReference<>(attributes.get("data-partition-id")));
headers.setAuthorization(new AtomicReference<>(attributes.get("authorization")));
headers.setUserEmail(new AtomicReference<>(attributes.get("user")));
headers.setAccountId(new AtomicReference<>(attributes.get("account-id")));
headers.setCorrelationId(new AtomicReference<>(attributes.get("correlation-id")));
}
@NotNull
private DpsHeaders convertAtomicToDpsHeaders() {
DpsHeaders dpsHeaders = new DpsHeaders();
dpsHeaders.put("authorization", headers.getAuthorization().get());
dpsHeaders.put("data-partition-id", headers.getDataPartitionId().get());
dpsHeaders.put("authorization", headers.getAuthorization().get());
dpsHeaders.put("user", headers.getUserEmail().get());
dpsHeaders.put("account-id", headers.getAccountId().get());
dpsHeaders.put("correlation-id", headers.getCorrelationId().get());
return dpsHeaders;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment