Commit c02ab76
[Backport release-1.17] feat: add DaprClient.invokeHttpClient(appId) factory (#1763)
* feat: add DaprClient.invokeHttpClient(appId) factory (#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)
* fix: Add missing implementation
Signed-off-by: Javier Aliaga <javier@diagrid.io>
---------
Signed-off-by: Javier Aliaga <javier@diagrid.io>
Co-authored-by: Javier Aliaga <javier@diagrid.io>1 parent 80687da commit c02ab76
13 files changed
Lines changed: 726 additions & 42 deletions
File tree
- dapr-spring
- dapr-spring-boot-4-autoconfigure/src/main/java/io/dapr/spring/boot4/autoconfigure/client
- dapr-spring-boot-autoconfigure/src
- main/java/io/dapr/spring/boot/autoconfigure/client
- test/java/io/dapr/spring/boot/autoconfigure/client
- examples/src/main/java/io/dapr/examples/invoke/http
- sdk/src
- main/java/io/dapr/client
- test/java/io/dapr/client
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
302 | 308 | | |
303 | 309 | | |
304 | 310 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
299 | 300 | | |
300 | 301 | | |
301 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
302 | 308 | | |
303 | 309 | | |
304 | 310 | | |
| |||
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | | - | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| |||
33 | 30 | | |
34 | 31 | | |
35 | 32 | | |
36 | | - | |
37 | 33 | | |
38 | 34 | | |
39 | 35 | | |
| |||
378 | 374 | | |
379 | 375 | | |
380 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
381 | 391 | | |
Lines changed: 52 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
| |||
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
27 | 43 | | |
28 | 44 | | |
29 | 45 | | |
| |||
32 | 48 | | |
33 | 49 | | |
34 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
35 | 56 | | |
36 | 57 | | |
37 | 58 | | |
38 | 59 | | |
39 | 60 | | |
40 | 61 | | |
41 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
42 | 69 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
47 | 78 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
51 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
52 | 95 | | |
53 | 96 | | |
Lines changed: 64 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
14 | 28 | | |
15 | 29 | | |
16 | 30 | | |
| |||
104 | 118 | | |
105 | 119 | | |
106 | 120 | | |
107 | | - | |
108 | | - | |
| 121 | + | |
| 122 | + | |
109 | 123 | | |
110 | 124 | | |
111 | 125 | | |
| |||
121 | 135 | | |
122 | 136 | | |
123 | 137 | | |
124 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
125 | 144 | | |
126 | 145 | | |
127 | 146 | | |
128 | 147 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
133 | 159 | | |
134 | | - | |
135 | | - | |
136 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
137 | 179 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 180 | | |
| 181 | + | |
| 182 | + | |
143 | 183 | | |
144 | | - | |
145 | 184 | | |
146 | 185 | | |
147 | 186 | | |
148 | | - | |
149 | | - | |
| 187 | + | |
| 188 | + | |
150 | 189 | | |
151 | 190 | | |
152 | 191 | | |
153 | 192 | | |
154 | | - | |
155 | | - | |
156 | | - | |
| 193 | + | |
157 | 194 | | |
158 | 195 | | |
159 | 196 | | |
| |||
165 | 202 | | |
166 | 203 | | |
167 | 204 | | |
168 | | - | |
| 205 | + | |
169 | 206 | | |
170 | 207 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
175 | 212 | | |
176 | | - | |
177 | 213 | | |
178 | 214 | | |
179 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
0 commit comments