|
50 | 50 | import io.dapr.utils.TypeRef;
|
51 | 51 | import reactor.core.publisher.Flux;
|
52 | 52 | import reactor.core.publisher.Mono;
|
| 53 | +import reactor.util.context.Context; |
53 | 54 |
|
54 | 55 | import java.io.IOException;
|
55 | 56 | import java.util.ArrayList;
|
@@ -177,7 +178,7 @@ public Mono<Void> publishEvent(PublishEventRequest request) {
|
177 | 178 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "publish", pubsubName, topic };
|
178 | 179 |
|
179 | 180 | Map<String, List<String>> queryArgs = metadataToQueryArgs(metadata);
|
180 |
| - return Mono.subscriberContext().flatMap( |
| 181 | + return Mono.deferContextual( |
181 | 182 | context -> this.client.invokeApi(
|
182 | 183 | DaprHttp.HttpMethods.POST.name(), pathSegments, queryArgs, serializedEvent, headers, context
|
183 | 184 | )
|
@@ -237,7 +238,7 @@ public <T> Mono<T> invokeMethod(InvokeMethodRequest invokeMethodRequest, TypeRef
|
237 | 238 | } else {
|
238 | 239 | headers.put(Metadata.CONTENT_TYPE, objectSerializer.getContentType());
|
239 | 240 | }
|
240 |
| - Mono<DaprHttp.Response> response = Mono.subscriberContext().flatMap( |
| 241 | + Mono<DaprHttp.Response> response = Mono.deferContextual( |
241 | 242 | context -> this.client.invokeApi(httpMethod, pathSegments.toArray(new String[0]),
|
242 | 243 | httpExtension.getQueryParams(), serializedRequestBody, headers, context)
|
243 | 244 | );
|
@@ -309,7 +310,7 @@ public <T> Mono<T> invokeBinding(InvokeBindingRequest request, TypeRef<T> type)
|
309 | 310 |
|
310 | 311 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "bindings", name };
|
311 | 312 |
|
312 |
| - Mono<DaprHttp.Response> response = Mono.subscriberContext().flatMap( |
| 313 | + Mono<DaprHttp.Response> response = Mono.deferContextual( |
313 | 314 | context -> this.client.invokeApi(
|
314 | 315 | httpMethod, pathSegments, null, payload, null, context)
|
315 | 316 | );
|
@@ -349,7 +350,7 @@ public <T> Mono<List<State<T>>> getBulkState(GetBulkStateRequest request, TypeRe
|
349 | 350 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "state", stateStoreName, "bulk" };
|
350 | 351 |
|
351 | 352 | Map<String, List<String>> queryArgs = metadataToQueryArgs(metadata);
|
352 |
| - return Mono.subscriberContext().flatMap( |
| 353 | + return Mono.deferContextual( |
353 | 354 | context -> this.client
|
354 | 355 | .invokeApi(DaprHttp.HttpMethods.POST.name(), pathSegments, queryArgs, requestBody, null, context)
|
355 | 356 | ).flatMap(s -> {
|
@@ -394,7 +395,7 @@ public <T> Mono<State<T>> getState(GetStateRequest request, TypeRef<T> type) {
|
394 | 395 |
|
395 | 396 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "state", stateStoreName, key };
|
396 | 397 |
|
397 |
| - return Mono.subscriberContext().flatMap( |
| 398 | + return Mono.deferContextual( |
398 | 399 | context -> this.client
|
399 | 400 | .invokeApi(DaprHttp.HttpMethods.GET.name(), pathSegments, queryParams, null, context)
|
400 | 401 | ).flatMap(s -> {
|
@@ -452,7 +453,7 @@ public Mono<Void> executeStateTransaction(ExecuteStateTransactionRequest request
|
452 | 453 |
|
453 | 454 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "state", stateStoreName, "transaction" };
|
454 | 455 |
|
455 |
| - return Mono.subscriberContext().flatMap( |
| 456 | + return Mono.deferContextual( |
456 | 457 | context -> this.client.invokeApi(
|
457 | 458 | DaprHttp.HttpMethods.POST.name(), pathSegments, null, serializedOperationBody, null, context
|
458 | 459 | )
|
@@ -500,7 +501,7 @@ public Mono<Void> saveBulkState(SaveStateRequest request) {
|
500 | 501 |
|
501 | 502 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "state", stateStoreName };
|
502 | 503 |
|
503 |
| - return Mono.subscriberContext().flatMap( |
| 504 | + return Mono.deferContextual( |
504 | 505 | context -> this.client.invokeApi(
|
505 | 506 | DaprHttp.HttpMethods.POST.name(), pathSegments, null, serializedStateBody, null, context)
|
506 | 507 | ).then();
|
@@ -543,7 +544,7 @@ public Mono<Void> deleteState(DeleteStateRequest request) {
|
543 | 544 |
|
544 | 545 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "state", stateStoreName, key };
|
545 | 546 |
|
546 |
| - return Mono.subscriberContext().flatMap( |
| 547 | + return Mono.deferContextual( |
547 | 548 | context -> this.client.invokeApi(
|
548 | 549 | DaprHttp.HttpMethods.DELETE.name(), pathSegments, queryParams, headers, context)
|
549 | 550 | ).then();
|
@@ -631,7 +632,7 @@ public Mono<Map<String, String>> getSecret(GetSecretRequest request) {
|
631 | 632 | Map<String, List<String>> queryArgs = metadataToQueryArgs(metadata);
|
632 | 633 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "secrets", secretStoreName, key };
|
633 | 634 |
|
634 |
| - return Mono.subscriberContext().flatMap( |
| 635 | + return Mono.deferContextual( |
635 | 636 | context -> this.client
|
636 | 637 | .invokeApi(DaprHttp.HttpMethods.GET.name(), pathSegments, queryArgs, (String) null, null, context)
|
637 | 638 | ).flatMap(response -> {
|
@@ -667,7 +668,7 @@ public Mono<Map<String, Map<String, String>>> getBulkSecret(GetBulkSecretRequest
|
667 | 668 | Map<String, List<String>> queryArgs = metadataToQueryArgs(metadata);
|
668 | 669 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "secrets", secretStoreName, "bulk" };
|
669 | 670 |
|
670 |
| - return Mono.subscriberContext().flatMap( |
| 671 | + return Mono.deferContextual( |
671 | 672 | context -> this.client
|
672 | 673 | .invokeApi(DaprHttp.HttpMethods.GET.name(), pathSegments, queryArgs, (String) null, null, context)
|
673 | 674 | ).flatMap(response -> {
|
@@ -709,7 +710,7 @@ public <T> Mono<QueryStateResponse<T>> queryState(QueryStateRequest request, Typ
|
709 | 710 | } else {
|
710 | 711 | throw new IllegalArgumentException("Both query and queryString fields are not set.");
|
711 | 712 | }
|
712 |
| - return Mono.subscriberContext().flatMap( |
| 713 | + return Mono.deferContextual( |
713 | 714 | context -> this.client
|
714 | 715 | .invokeApi(DaprHttp.HttpMethods.POST.name(), pathSegments,
|
715 | 716 | queryArgs, serializedRequest, null, context)
|
@@ -739,7 +740,7 @@ public void close() {
|
739 | 740 | @Override
|
740 | 741 | public Mono<Void> shutdown() {
|
741 | 742 | String[] pathSegments = new String[]{ DaprHttp.API_VERSION, "shutdown" };
|
742 |
| - return Mono.subscriberContext().flatMap( |
| 743 | + return Mono.deferContextual( |
743 | 744 | context -> client.invokeApi(DaprHttp.HttpMethods.POST.name(), pathSegments,
|
744 | 745 | null, null, context))
|
745 | 746 | .then();
|
@@ -810,7 +811,7 @@ public Mono<Map<String, ConfigurationItem>> getConfiguration(GetConfigurationReq
|
810 | 811 | queryParams.putAll(queryArgs);
|
811 | 812 |
|
812 | 813 | String[] pathSegments = new String[] {DaprHttp.ALPHA_1_API_VERSION, "configuration", configurationStoreName };
|
813 |
| - return Mono.subscriberContext().flatMap( |
| 814 | + return Mono.deferContextual( |
814 | 815 | context -> this.client
|
815 | 816 | .invokeApi(
|
816 | 817 | DaprHttp.HttpMethods.GET.name(),
|
@@ -871,7 +872,7 @@ public Flux<SubscribeConfigurationResponse> subscribeConfiguration(SubscribeConf
|
871 | 872 |
|
872 | 873 | String[] pathSegments =
|
873 | 874 | new String[] { DaprHttp.ALPHA_1_API_VERSION, "configuration", configurationStoreName, "subscribe" };
|
874 |
| - SubscribeConfigurationResponse res = Mono.subscriberContext().flatMap( |
| 875 | + SubscribeConfigurationResponse res = Mono.deferContextual( |
875 | 876 | context -> this.client.invokeApi(
|
876 | 877 | DaprHttp.HttpMethods.GET.name(),
|
877 | 878 | pathSegments, queryParams,
|
@@ -913,7 +914,7 @@ public Mono<UnsubscribeConfigurationResponse> unsubscribeConfiguration(Unsubscri
|
913 | 914 | String[] pathSegments = new String[]
|
914 | 915 | { DaprHttp.ALPHA_1_API_VERSION, "configuration", configStoreName, id, "unsubscribe" };
|
915 | 916 |
|
916 |
| - return Mono.subscriberContext().flatMap( |
| 917 | + return Mono.deferContextual( |
917 | 918 | context -> this.client
|
918 | 919 | .invokeApi(
|
919 | 920 | DaprHttp.HttpMethods.GET.name(),
|
|
0 commit comments