Skip to content

[Backport release-1.17] feat: add DaprClient.invokeHttpClient(appId) factory#1763

Open
dapr-bot wants to merge 1 commit into
release-1.17from
backport-1742-to-release-1.17
Open

[Backport release-1.17] feat: add DaprClient.invokeHttpClient(appId) factory#1763
dapr-bot wants to merge 1 commit into
release-1.17from
backport-1742-to-release-1.17

Conversation

@dapr-bot

@dapr-bot dapr-bot commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Backport 9539d70 from #1742.

* chore: rewrite invoke/http example to use native HttpClient

The DaprClient.invokeMethod wrappers were deprecated by #1666. Rewrite
the invoke/http sample to use java.net.http.HttpClient through the Dapr
sidecar, demonstrating both URL forms accepted by the sidecar — the
dapr-app-id header against the sidecar base URL, and the explicit
/v1.0/invoke/<app-id>/method/<method> path.

Update the matching README snippet and reduce expected_stdout_lines to
'Done' — the previous expected lines never matched what DemoService
returns (a timestamp).

Signed-off-by: Javier Aliaga <javier@diagrid.io>

* feat: add DaprClient.invokeHttpClient(appId) factory

Provides an SDK-native successor to the invokeMethod APIs deprecated by
#1666. DaprClient.invokeHttpClient(appId) returns a DaprInvokeHttpClient
pre-bound to {daprHttpEndpoint}/v1.0/invoke/{appId}/method/ that reuses
the SDK's shared java.net.http.HttpClient and attaches the dapr-api-token
header when configured.

Update the invoke/http example and README to demonstrate the new helper
alongside the raw dapr-app-id header form.

Signed-off-by: Javier Aliaga <javier@diagrid.io>

* feat: add DaprBodyPublishers.json helper and invokeHttpClient migration notes

Adds an opt-in DaprBodyPublishers.json(Object) helper backed by the SDK's
default Jackson serializer, matching the JSON encoding the deprecated
DaprClient.invokeMethod APIs applied internally. Eases migration without
re-introducing auto-serialization into the raw HttpClient surface exposed
by invokeHttpClient.

Also fixes the invoke/http example README expected_stdout_lines to match
the new plain-text body sent by the refactored example (Server: message
one instead of Server: "message one"), and adds migration notes to the
DaprClient.invokeHttpClient and DaprInvokeHttpClient Javadoc as well as
the example README.

Signed-off-by: Javier Aliaga <javier@diagrid.io>

---------

Signed-off-by: Javier Aliaga <javier@diagrid.io>
(cherry picked from commit 9539d70)
@dapr-bot dapr-bot requested review from a team as code owners June 8, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants