Skip to content

Commit

Permalink
Merge branch 'trunk' into release/5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
YoEight committed Oct 16, 2024
2 parents 62160b2 + 658dc56 commit 7015bcc
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
# Changelog
All notable changes to this project will be documented in this file.

## [5.4.0] - 2024-05-23
## [Unreleased]

## [5.4.2] - 2024-10-16
### Added
- Support custom headers. [EventStoreDB-Client-Java#289](https://github.com/EventStore/EventStoreDB-Client-Java/pull/289)

### Changed
- Extract tracing metadata from Event. [EventStoreDB-Client-Java#284](https://github.com/EventStore/EventStoreDB-Client-Java/pull/284)

## [5.4.1] - 2024-07-16
### Changed
- Add user certificates and otel samples. [EventStoreDB-Client-Java#274](https://github.com/EventStore/EventStoreDB-Client-Java/pull/274)
- Support different runtime environments out-of-the-box. [EventStoreDB-Client-Java#279](https://github.com/EventStore/EventStoreDB-Client-Java/pull/279)
- Remove expectation oriented tests. [EventStoreDB-Client-Java#279](https://github.com/EventStore/EventStoreDB-Client-Java/pull/279)
- Fixed bug in the ClientTelemetry whereby injection logic forces all events to have JSON content type. [EventStoreDB-Client-Java#281](https://github.com/EventStore/EventStoreDB-Client-Java/pull/281)

### Fixed
- Use connection string in user certificate sample. [EventStoreDB-Client-Java#276](https://github.com/EventStore/EventStoreDB-Client-Java/pull/276)
- Fix connection service skipping discovery interval sleeps. [EventStoreDB-Client-Java#278](https://github.com/EventStore/EventStoreDB-Client-Java/pull/278)

## [5.4.0] - 2024-05-23
### Added
- new connection settings to provide an x.509 certificate for user authentication. [EventStoreDB-Client-Java#266](https://github.com/EventStore/EventStoreDB-Client-Java/pull/266)

Expand Down
2 changes: 1 addition & 1 deletion db-client-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tasks.withType(JavaCompile) {
}

group = 'com.eventstore'
version = '5.4.1'
version = '5.4.2'

java {
withJavadocJar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import io.grpc.Metadata;

import java.util.Map;

class ConnectionMetadata {
private Metadata metadata;

Expand All @@ -27,6 +29,13 @@ public ConnectionMetadata requiresLeader() {
return this;
}

public ConnectionMetadata headers(Map<String, String> headers) {
for (Map.Entry<String, String> entry : headers.entrySet())
this.metadata.put(Metadata.Key.of(entry.getKey(), Metadata.ASCII_STRING_MARSHALLER), entry.getValue());

return this;
}

public Metadata build() {
return this.metadata;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ static public <S extends AbstractAsyncStub<S>, O> S configureStub(S stub, EventS
metadata.requiresLeader();
}

metadata.headers(options.getHeaders());

return finalStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata.build()));
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.eventstore.dbclient;

import java.util.HashMap;
import java.util.Map;

class OptionsBase<T> {
private Long deadline;
private final OperationKind kind;
private UserCredentials credentials;
private boolean requiresLeader;
private Map<String, String> headers = new HashMap<>();

protected OptionsBase() {
this(OperationKind.Regular);
Expand Down Expand Up @@ -83,6 +87,15 @@ public T deadline(long durationInMs) {
return (T)this;
}

/**
* Adds a custom HTTP header that will be added to the request.
*/
@SuppressWarnings("unchecked")
public T header(String key, String value) {
headers.put(key, value);
return (T)this;
}

Long getDeadline() {
return deadline;
}
Expand All @@ -98,4 +111,8 @@ boolean isLeaderRequired() {
UserCredentials getCredentials() {
return this.credentials;
}

Map<String, String> getHeaders() {
return this.headers;
}
}

0 comments on commit 7015bcc

Please sign in to comment.