Skip to content

feat: add DaprClient.invokeHttpClient(appId) factory#1742

Draft
javier-aliaga wants to merge 3 commits into
dapr:masterfrom
javier-aliaga:chore/invoke-http-example-native-client
Draft

feat: add DaprClient.invokeHttpClient(appId) factory#1742
javier-aliaga wants to merge 3 commits into
dapr:masterfrom
javier-aliaga:chore/invoke-http-example-native-client

Conversation

@javier-aliaga
Copy link
Copy Markdown
Contributor

@javier-aliaga javier-aliaga commented May 12, 2026

Description

  • Adds DaprClient.invokeHttpClient(appId) as the SDK-native successor to the invokeMethod overloads deprecated by chore: Deprecate invoke methods #1666. Returns a DaprInvokeHttpClient pre-bound to {daprHttpEndpoint}/v1.0/invoke/{appId}/method/, reusing the SDK's shared java.net.http.HttpClient and attaching the dapr-api-token header when configured.
  • Rewrites the invoke/http example (and its README) to demonstrate the new helper alongside the raw dapr-app-id header form, replacing the deprecated invokeMethod usage.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #1743

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

The DaprClient.invokeMethod wrappers were deprecated by dapr#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>
@javier-aliaga javier-aliaga force-pushed the chore/invoke-http-example-native-client branch from 40be05a to ec97be3 Compare May 14, 2026 07:45
@javier-aliaga javier-aliaga changed the title chore: rewrite invoke/http example to use native HttpClient feat: add DaprClient.invokeHttpClient(appId) factory May 14, 2026
@javier-aliaga javier-aliaga added this to the v1.18 milestone May 14, 2026
@javier-aliaga javier-aliaga force-pushed the chore/invoke-http-example-native-client branch from 1c0578e to e19e6ef Compare May 14, 2026 08:48
Provides an SDK-native successor to the invokeMethod APIs deprecated by
dapr#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>
@javier-aliaga javier-aliaga force-pushed the chore/invoke-http-example-native-client branch from e19e6ef to 297a3a3 Compare May 14, 2026 09:26
@codecov
Copy link
Copy Markdown

codecov Bot commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.86%. Comparing base (2c038f4) to head (b2c2851).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1742      +/-   ##
============================================
+ Coverage     76.76%   76.86%   +0.09%     
- Complexity     2260     2279      +19     
============================================
  Files           241      242       +1     
  Lines          7066     7096      +30     
  Branches        740      742       +2     
============================================
+ Hits           5424     5454      +30     
  Misses         1279     1279              
  Partials        363      363              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add DaprClient.invokeHttpClient(appId) factory for service invocation

2 participants