From b81bf13dc7e3fe444c56c3e815287a25d18b3cac Mon Sep 17 00:00:00 2001 From: YoEight Date: Mon, 7 Oct 2024 10:44:54 -0400 Subject: [PATCH 1/5] Fix CHANGELOG.md format. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eedc7ae..eefe716c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog All notable changes to this project will be documented in this file. +## [Unreleased] + ## [5.4.0] - 2024-05-23 ### Added From 4f6ed729604de50a3a8d0e1cbec692e87adeec7b Mon Sep 17 00:00:00 2001 From: YoEight Date: Mon, 7 Oct 2024 11:00:25 -0400 Subject: [PATCH 2/5] Added mixing 5.4.1 changelog section. --- CHANGELOG.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eefe716c..0c79299a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,21 @@ All notable changes to this project will be documented in this file. ## [Unreleased] -## [5.4.0] - 2024-05-23 +### 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) From 14b8c4f0ec77d10ce4b8d8ecb5fbdc8760f29d98 Mon Sep 17 00:00:00 2001 From: YoEight Date: Mon, 7 Oct 2024 11:04:59 -0400 Subject: [PATCH 3/5] Prepare 5.4.2 release. --- db-client-java/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db-client-java/build.gradle b/db-client-java/build.gradle index c7ec2cfb..fc822dd7 100644 --- a/db-client-java/build.gradle +++ b/db-client-java/build.gradle @@ -19,7 +19,7 @@ tasks.withType(JavaCompile) { } group = 'com.eventstore' -version = '5.4.1' +version = '5.4.2' java { withJavadocJar() From fa8117b87393946aff006c1254c888663997b296 Mon Sep 17 00:00:00 2001 From: Yo Eight Date: Wed, 16 Oct 2024 16:49:45 -0400 Subject: [PATCH 4/5] Support custom headers. (#289) --- .../eventstore/dbclient/ConnectionMetadata.java | 9 +++++++++ .../java/com/eventstore/dbclient/GrpcUtils.java | 2 ++ .../com/eventstore/dbclient/OptionsBase.java | 17 +++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/db-client-java/src/main/java/com/eventstore/dbclient/ConnectionMetadata.java b/db-client-java/src/main/java/com/eventstore/dbclient/ConnectionMetadata.java index 08b303c3..23b9d6d8 100644 --- a/db-client-java/src/main/java/com/eventstore/dbclient/ConnectionMetadata.java +++ b/db-client-java/src/main/java/com/eventstore/dbclient/ConnectionMetadata.java @@ -2,6 +2,8 @@ import io.grpc.Metadata; +import java.util.Map; + class ConnectionMetadata { private Metadata metadata; @@ -27,6 +29,13 @@ public ConnectionMetadata requiresLeader() { return this; } + public ConnectionMetadata headers(Map headers) { + for (Map.Entry 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; } diff --git a/db-client-java/src/main/java/com/eventstore/dbclient/GrpcUtils.java b/db-client-java/src/main/java/com/eventstore/dbclient/GrpcUtils.java index a61d2072..08111bdb 100644 --- a/db-client-java/src/main/java/com/eventstore/dbclient/GrpcUtils.java +++ b/db-client-java/src/main/java/com/eventstore/dbclient/GrpcUtils.java @@ -150,6 +150,8 @@ static public , O> S configureStub(S stub, EventS metadata.requiresLeader(); } + metadata.headers(options.getHeaders()); + return finalStub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(metadata.build())); } } \ No newline at end of file diff --git a/db-client-java/src/main/java/com/eventstore/dbclient/OptionsBase.java b/db-client-java/src/main/java/com/eventstore/dbclient/OptionsBase.java index 08c0d316..97536c4a 100644 --- a/db-client-java/src/main/java/com/eventstore/dbclient/OptionsBase.java +++ b/db-client-java/src/main/java/com/eventstore/dbclient/OptionsBase.java @@ -1,10 +1,14 @@ package com.eventstore.dbclient; +import java.util.HashMap; +import java.util.Map; + class OptionsBase { private Long deadline; private final OperationKind kind; private UserCredentials credentials; private boolean requiresLeader; + private Map headers = new HashMap<>(); protected OptionsBase() { this(OperationKind.Regular); @@ -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; } @@ -98,4 +111,8 @@ boolean isLeaderRequired() { UserCredentials getCredentials() { return this.credentials; } + + Map getHeaders() { + return this.headers; + } } \ No newline at end of file From 658dc56b34d074fef21fa98f46d7e1c38a61b8d4 Mon Sep 17 00:00:00 2001 From: YoEight Date: Wed, 16 Oct 2024 16:56:54 -0400 Subject: [PATCH 5/5] Update v5.4.2 release. --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c79299a..90424666 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. ## [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)