Skip to content

Commit c7453da

Browse files
Adds CustomItemSerializer to CosmsoRequestContext/CosmosRequestOptions (#48963)
* Adds CustomItemSerializer to CosmsoRequestContext/CosmosRequestOptions * Update CHANGELOG.md
1 parent 0589b50 commit c7453da

10 files changed

Lines changed: 93 additions & 9 deletions

File tree

sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/OperationPoliciesTest.java

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
package com.azure.cosmos;
88

99
import com.azure.cosmos.SuperFlakyTestRetryAnalyzer;
10+
import com.azure.cosmos.implementation.DefaultCosmosItemSerializer;
1011
import com.azure.cosmos.implementation.ImplementationBridgeHelpers;
1112
import com.azure.cosmos.implementation.InternalObjectNode;
1213
import com.azure.cosmos.implementation.OverridableRequestOptions;
1314
import com.azure.cosmos.implementation.TestConfigurations;
15+
import com.azure.cosmos.implementation.Utils;
1416
import com.azure.cosmos.models.CosmosBatch;
1517
import com.azure.cosmos.models.CosmosBatchResponse;
1618
import com.azure.cosmos.models.CosmosBulkExecutionOptions;
@@ -79,8 +81,11 @@ public class OperationPoliciesTest extends TestSuiteBase {
7981
private static final String MAX_PREFETCH_PAGE_COUNT = "maxPrefetchPageCount";
8082
private static final String QUERY_NAME = "queryName";
8183
private static final String KEYWORD_IDENTIFIERS = "keywordIdentifiers";
82-
private static final String[] optionLabels = {E2E_TIMEOUT, CONSISTENCY_LEVEL, CONTENT_RESPONSE_ON_WRITE, NON_IDEMPOTENT_WRITE_RETRIES, BYPASS_CACHE, THROUGHPUT_CONTROL_GROUP_NAME, REQUEST_CHARGE_THRESHOLD, SCAN_IN_QUERY, EXCLUDE_REGIONS, MAX_DEGREE_OF_PARALLELISM, MAX_BUFFERED_ITEM_COUNT, RESPONSE_CONTINUATION_TOKEN_LIMIT_KB, MAX_ITEM_COUNT, QUERY_METRICS, INDEX_METRICS, MAX_PREFETCH_PAGE_COUNT, QUERY_NAME, KEYWORD_IDENTIFIERS, READ_CONSISTENCY_STRATEGY};
83-
private static final String[] initialOptions = {"20", "Session", "true", "false", "false", "default", "2000", "false", "East US 2", "2", "100", "200", "30", "false", "false", "10", "QueryName", "59409493805", "Default"};
84+
private static final String CUSTOM_ITEM_SERIALIZER = "customItemSerializer";
85+
private static final String[] optionLabels = {E2E_TIMEOUT, CONSISTENCY_LEVEL, CONTENT_RESPONSE_ON_WRITE, NON_IDEMPOTENT_WRITE_RETRIES, BYPASS_CACHE, THROUGHPUT_CONTROL_GROUP_NAME, REQUEST_CHARGE_THRESHOLD, SCAN_IN_QUERY, EXCLUDE_REGIONS, MAX_DEGREE_OF_PARALLELISM, MAX_BUFFERED_ITEM_COUNT, RESPONSE_CONTINUATION_TOKEN_LIMIT_KB, MAX_ITEM_COUNT, QUERY_METRICS, INDEX_METRICS, MAX_PREFETCH_PAGE_COUNT, QUERY_NAME, KEYWORD_IDENTIFIERS, READ_CONSISTENCY_STRATEGY, CUSTOM_ITEM_SERIALIZER};
86+
private static final String[] initialOptions = {"20", "Session", "true", "false", "false", "default", "2000", "false", "East US 2", "2", "100", "200", "30", "false", "false", "10", "QueryName", "59409493805", "Default", "initial"};
87+
private static final CosmosItemSerializer INITIAL_CUSTOM_ITEM_SERIALIZER = CosmosItemSerializer.DEFAULT_SERIALIZER;
88+
private static final CosmosItemSerializer CHANGED_CUSTOM_ITEM_SERIALIZER = new DefaultCosmosItemSerializer(Utils.getSimpleObjectMapper());
8489

8590
@Factory(dataProvider = "clientBuildersWithApplyPolicies")
8691
public OperationPoliciesTest(CosmosClientBuilder clientBuilder) {
@@ -107,7 +112,8 @@ private static void createReadDeleteBatchEtcOptions(String operationType, String
107112
.setIntegratedCacheBypassed(Boolean.parseBoolean(prop.getProperty(BYPASS_CACHE))))
108113
.setThroughputControlGroupName(prop.getProperty(THROUGHPUT_CONTROL_GROUP_NAME))
109114
.setExcludeRegions(new ArrayList<>(Arrays.asList(prop.getProperty(EXCLUDE_REGIONS).split(","))))
110-
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))));
115+
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))))
116+
.setCustomItemSerializer(resolveCustomItemSerializer());
111117
}
112118
}
113119

@@ -133,7 +139,8 @@ private static void createQueryReadAllItemsOptions(String operationType, String
133139
.setQueryName(prop.getProperty(QUERY_NAME))
134140
.setConsistencyLevel(ConsistencyLevel.fromServiceSerializedFormat(prop.getProperty(CONSISTENCY_LEVEL)))
135141
.setReadConsistencyStrategy(ReadConsistencyStrategy.fromServiceSerializedFormat(prop.getProperty(READ_CONSISTENCY_STRATEGY)))
136-
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))));
142+
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))))
143+
.setCustomItemSerializer(resolveCustomItemSerializer());
137144
}
138145
}
139146

@@ -152,15 +159,17 @@ private static void createReadManyOptions(String spanName, CosmosRequestOptions
152159
.setIndexMetricsEnabled(Boolean.parseBoolean(prop.getProperty(INDEX_METRICS)))
153160
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))))
154161
.setConsistencyLevel(ConsistencyLevel.fromServiceSerializedFormat(prop.getProperty(CONSISTENCY_LEVEL)))
155-
.setReadConsistencyStrategy(ReadConsistencyStrategy.fromServiceSerializedFormat(prop.getProperty(READ_CONSISTENCY_STRATEGY)));
162+
.setReadConsistencyStrategy(ReadConsistencyStrategy.fromServiceSerializedFormat(prop.getProperty(READ_CONSISTENCY_STRATEGY)))
163+
.setCustomItemSerializer(resolveCustomItemSerializer());
156164
}
157165
}
158166

159167
private static void createBulkOptions(String operationType, String spanName, CosmosRequestOptions cosmosRequestOptions) {
160168
if (operationType.equals("Batch") && spanName.contains("nonTransactionalBatch")) {
161169
cosmosRequestOptions.setExcludeRegions((new ArrayList<>(Arrays.asList(prop.getProperty(EXCLUDE_REGIONS).split(",")))))
162170
.setThroughputControlGroupName(prop.getProperty(THROUGHPUT_CONTROL_GROUP_NAME))
163-
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))));
171+
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))))
172+
.setCustomItemSerializer(resolveCustomItemSerializer());
164173
}
165174
}
166175

@@ -171,8 +180,25 @@ private static void createChangeFeedOptions(String spanName, CosmosRequestOption
171180
.setDiagnosticsThresholds(new CosmosDiagnosticsThresholds().setRequestChargeThreshold(Float.parseFloat(prop.getProperty(REQUEST_CHARGE_THRESHOLD))))
172181
.setMaxPrefetchPageCount(Integer.parseInt(prop.getProperty(MAX_PREFETCH_PAGE_COUNT)))
173182
.setMaxItemCount(Integer.parseInt(prop.getProperty(MAX_ITEM_COUNT)))
174-
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))));
183+
.setKeywordIdentifiers(new HashSet<>(Arrays.asList(prop.getProperty(KEYWORD_IDENTIFIERS).split(","))))
184+
.setCustomItemSerializer(resolveCustomItemSerializer());
185+
}
186+
}
187+
188+
private static CosmosItemSerializer resolveCustomItemSerializer() {
189+
String value = prop.getProperty(CUSTOM_ITEM_SERIALIZER);
190+
if ("changed".equals(value)) {
191+
return CHANGED_CUSTOM_ITEM_SERIALIZER;
192+
}
193+
return INITIAL_CUSTOM_ITEM_SERIALIZER;
194+
}
195+
196+
private static CosmosItemSerializer resolveExpectedCustomItemSerializer(String[] options) {
197+
String value = options[19];
198+
if ("changed".equals(value)) {
199+
return CHANGED_CUSTOM_ITEM_SERIALIZER;
175200
}
201+
return INITIAL_CUSTOM_ITEM_SERIALIZER;
176202
}
177203

178204
@DataProvider
@@ -242,8 +268,8 @@ public void afterMethod() {
242268
@DataProvider(name = "changedOptions")
243269
private String[][] createChangedOptions() {
244270
return new String[][] {
245-
{ "8", "ConsistentPrefix", "true", "false", "true", "defaultChanged", "1000", "true", "West US 2", "4", "200", "400", "100", "false", "true", "20", "QueryNameChanged", "112", "LatestCommitted" },
246-
{ "4", "Eventual", "false", "true", "true", "defaultChanged", "1000", "true", "West US 2", "4", "200", "400", "100", "true", "false", "20", "QueryNameChanged", "221", "LatestCommitted" },
271+
{ "8", "ConsistentPrefix", "true", "false", "true", "defaultChanged", "1000", "true", "West US 2", "4", "200", "400", "100", "false", "true", "20", "QueryNameChanged", "112", "LatestCommitted", "changed" },
272+
{ "4", "Eventual", "false", "true", "true", "defaultChanged", "1000", "true", "West US 2", "4", "200", "400", "100", "true", "false", "20", "QueryNameChanged", "221", "LatestCommitted", "changed" },
247273
initialOptions
248274
};
249275
}
@@ -699,6 +725,7 @@ private void validateOptions(String[] options, CosmosItemResponse<?> response, b
699725
assertThat(requestOptions.getDiagnosticsThresholds().getRequestChargeThreshold()).isEqualTo(Float.parseFloat(options[6]));
700726
assertThat(requestOptions.getExcludedRegions()).isEqualTo(new ArrayList<>(Arrays.asList(options[8].split(","))));
701727
assertThat(requestOptions.getKeywordIdentifiers()).isEqualTo(new HashSet<>(Arrays.asList(options[17].split(","))));
728+
assertThat(requestOptions.getCustomItemSerializer()).isSameAs(resolveExpectedCustomItemSerializer(options));
702729
}
703730

704731
private void validateOptions(String[] options, CosmosBatchResponse response) {
@@ -708,6 +735,7 @@ private void validateOptions(String[] options, CosmosBatchResponse response) {
708735
assertThat(requestOptions.getDiagnosticsThresholds().getRequestChargeThreshold()).isEqualTo(Float.parseFloat(options[6]));
709736
assertThat(requestOptions.getExcludedRegions()).isEqualTo(new ArrayList<>(Arrays.asList(options[8].split(","))));
710737
assertThat(requestOptions.getKeywordIdentifiers()).isEqualTo(new HashSet<>(Arrays.asList(options[17].split(","))));
738+
assertThat(requestOptions.getCustomItemSerializer()).isSameAs(resolveExpectedCustomItemSerializer(options));
711739
}
712740

713741
private void validateOptions(String[] options, CosmosBulkItemResponse response) {
@@ -716,6 +744,7 @@ private void validateOptions(String[] options, CosmosBulkItemResponse response)
716744
assertThat(requestOptions.getExcludedRegions()).isEqualTo(new ArrayList<>(Arrays.asList(options[8].split(","))));
717745
assertThat(requestOptions.getThroughputControlGroupName()).isEqualTo(options[5]);
718746
assertThat(requestOptions.getKeywordIdentifiers()).isEqualTo(new HashSet<>(Arrays.asList(options[17].split(","))));
747+
assertThat(requestOptions.getCustomItemSerializer()).isSameAs(resolveExpectedCustomItemSerializer(options));
719748
}
720749

721750
private void validateOptions(String[] changedOptions, FeedResponse<InternalObjectNode> response, boolean isChangeFeed, boolean isReadMany) {
@@ -757,6 +786,7 @@ private void validateOptions(String[] changedOptions, FeedResponse<InternalObjec
757786
assertThat(requestOptions.getQueryNameOrDefault("")).isEqualTo(changedOptions[16]);
758787
}
759788
assertThat(requestOptions.getKeywordIdentifiers()).isEqualTo(new HashSet<>(Arrays.asList(changedOptions[17].split(","))));
789+
assertThat(requestOptions.getCustomItemSerializer()).isSameAs(resolveExpectedCustomItemSerializer(changedOptions));
760790
}
761791

762792
private void changeProperties(String[] values) {

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Added new `readManyByPartitionKeys` API on `CosmosAsyncContainer` / `CosmosContainer` to bulk-query all documents matching a list of partition key values with better efficiency than issuing individual queries. See [PR 48801](https://github.com/Azure/azure-sdk-for-java/pull/48801)
88
* Added `CosmosReadManyByPartitionKeysRequestOptions` - a dedicated request-options type for `readManyByPartitionKeys` that exposes `setContinuationToken(String)` for resuming previous invocations and `setMaxConcurrentBatchPrefetch(int)` to bound per-call prefetch parallelism. See [PR 48801](https://github.com/Azure/azure-sdk-for-java/pull/48801)
99
* Added `CosmosReadManyByPartitionKeysRequestOptions.setMaxBatchSize(Integer)` to set the max. number of partition keys used for a single batch. See [PR 48930](https://github.com/Azure/azure-sdk-for-java/pull/48930)
10+
* Added `getCustomItemSerializer()` to `CosmosRequestContext` and `setCustomItemSerializer(CosmosItemSerializer)` to `CosmosRequestOptions` to allow overriding the custom item serializer via operation policies. - See [PR 48963](https://github.com/Azure/azure-sdk-for-java/pull/48963)
1011

1112
#### Breaking Changes
1213

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosRequestContext.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ public Set<String> getKeywordIdentifiers() {
203203
return requestOptions.getKeywordIdentifiers();
204204
}
205205

206+
/**
207+
* Gets the custom item serializer.
208+
*
209+
* @return the custom item serializer. It could be null if not defined or called on an irrelevant operation.
210+
*/
211+
public CosmosItemSerializer getCustomItemSerializer() {
212+
return requestOptions.getCustomItemSerializer();
213+
}
214+
206215
///////////////////////////////////////////////////////////////////////////////////////////
207216
// the following helper/accessor only helps to access this class outside of this package.//
208217
///////////////////////////////////////////////////////////////////////////////////////////

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosBulkExecutionOptionsImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public void setMinTargetMicroBatchSize(int minTargetMicroBatchSize) {
139139
this.minTargetMicroBatchSize = minTargetMicroBatchSize;
140140
}
141141

142+
@Override
142143
public CosmosItemSerializer getCustomItemSerializer() {
143144
return this.customSerializer;
144145
}
@@ -357,6 +358,7 @@ public void override(CosmosRequestOptions cosmosRequestOptions) {
357358
this.excludeRegions = overrideOption(cosmosRequestOptions.getExcludedRegions(), this.excludeRegions);
358359
this.throughputControlGroupName = overrideOption(cosmosRequestOptions.getThroughputControlGroupName(), this.throughputControlGroupName);
359360
this.keywordIdentifiers = overrideOption(cosmosRequestOptions.getKeywordIdentifiers(), this.keywordIdentifiers);
361+
this.customSerializer = overrideOption(cosmosRequestOptions.getCustomItemSerializer(), this.customSerializer);
360362
}
361363

362364
}

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosChangeFeedRequestOptionsImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public Integer getResponseContinuationTokenLimitInKb() {
216216
return null;
217217
}
218218

219+
@Override
219220
public CosmosItemSerializer getCustomItemSerializer() {
220221
return this.customSerializer;
221222
}
@@ -421,6 +422,7 @@ public void override(CosmosRequestOptions cosmosRequestOptions) {
421422
this.throughputControlGroupName = overrideOption(cosmosRequestOptions.getThroughputControlGroupName(), this.throughputControlGroupName);
422423
this.thresholds = overrideOption(cosmosRequestOptions.getDiagnosticsThresholds(), this.thresholds);
423424
this.keywordIdentifiers = overrideOption(cosmosRequestOptions.getKeywordIdentifiers(), this.keywordIdentifiers);
425+
this.customSerializer = overrideOption(cosmosRequestOptions.getCustomItemSerializer(), this.customSerializer);
424426
}
425427

426428
}

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosQueryRequestOptionsBase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ public CosmosEndToEndOperationLatencyPolicyConfig getCosmosEndToEndLatencyPolicy
511511
* Gets the custom item serializer defined for this instance of request options
512512
* @return the custom item serializer
513513
*/
514+
@Override
514515
public CosmosItemSerializer getCustomItemSerializer() {
515516
return this.customSerializer;
516517
}
@@ -556,6 +557,7 @@ public void override(CosmosRequestOptions cosmosRequestOptions) {
556557
this.queryMetricsEnabled = overrideOption(cosmosRequestOptions.isQueryMetricsEnabled(), this.queryMetricsEnabled);
557558
this.responseContinuationTokenLimitInKb = overrideOption(cosmosRequestOptions.getResponseContinuationTokenLimitInKb(), this.responseContinuationTokenLimitInKb);
558559
this.keywordIdentifiers = overrideOption(cosmosRequestOptions.getKeywordIdentifiers(), this.keywordIdentifiers);
560+
this.customSerializer = overrideOption(cosmosRequestOptions.getCustomItemSerializer(), this.customSerializer);
559561
}
560562

561563
public RequestOptions applyToRequestOptions(RequestOptions requestOptions) {

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/CosmosTransactionalBulkExecutionOptionsImpl.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public CosmosTransactionalBulkExecutionOptionsImpl() {
7272
this.customOptions = new HashMap<>();
7373
}
7474

75+
@Override
7576
public CosmosItemSerializer getCustomItemSerializer() {
7677
return this.customSerializer;
7778
}
@@ -286,6 +287,7 @@ public void override(CosmosRequestOptions cosmosRequestOptions) {
286287
this.excludeRegions = overrideOption(cosmosRequestOptions.getExcludedRegions(), this.excludeRegions);
287288
this.throughputControlGroupName = overrideOption(cosmosRequestOptions.getThroughputControlGroupName(), this.throughputControlGroupName);
288289
this.keywordIdentifiers = overrideOption(cosmosRequestOptions.getKeywordIdentifiers(), this.keywordIdentifiers);
290+
this.customSerializer = overrideOption(cosmosRequestOptions.getCustomItemSerializer(), this.customSerializer);
289291
}
290292

291293
}

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ReadOnlyRequestOptions.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.azure.cosmos.ConsistencyLevel;
66
import com.azure.cosmos.CosmosDiagnosticsThresholds;
77
import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfig;
8+
import com.azure.cosmos.CosmosItemSerializer;
89
import com.azure.cosmos.ReadConsistencyStrategy;
910
import com.azure.cosmos.models.DedicatedGatewayRequestOptions;
1011

@@ -156,4 +157,11 @@ public interface ReadOnlyRequestOptions {
156157
* @return the custom correlated ids.
157158
*/
158159
Set<String> getKeywordIdentifiers();
160+
161+
/**
162+
* Gets the custom item serializer.
163+
*
164+
* @return the custom item serializer. It could be null if not defined or called on an irrelevant operation.
165+
*/
166+
CosmosItemSerializer getCustomItemSerializer();
159167
}

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RequestOptions.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,12 +654,18 @@ public void override(CosmosRequestOptions cosmosCommonRequestOptions) {
654654
this.thresholds = overrideOption(cosmosCommonRequestOptions.getDiagnosticsThresholds(), this.thresholds);
655655
this.endToEndOperationLatencyConfig = overrideOption(cosmosCommonRequestOptions.getCosmosEndToEndLatencyPolicyConfig(), this.endToEndOperationLatencyConfig);
656656
this.keywordIdentifiers = overrideOption(cosmosCommonRequestOptions.getKeywordIdentifiers(), this.keywordIdentifiers);
657+
this.effectiveItemSerializer = overrideOption(cosmosCommonRequestOptions.getCustomItemSerializer(), this.effectiveItemSerializer);
657658
}
658659

659660
public CosmosItemSerializer getEffectiveItemSerializer() {
660661
return this.effectiveItemSerializer;
661662
}
662663

664+
@Override
665+
public CosmosItemSerializer getCustomItemSerializer() {
666+
return this.effectiveItemSerializer;
667+
}
668+
663669
public void setEffectiveItemSerializer(CosmosItemSerializer serializer) {
664670
this.effectiveItemSerializer = serializer;
665671
}

sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosRequestOptions.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.azure.cosmos.ConsistencyLevel;
66
import com.azure.cosmos.CosmosDiagnosticsThresholds;
77
import com.azure.cosmos.CosmosEndToEndOperationLatencyPolicyConfig;
8+
import com.azure.cosmos.CosmosItemSerializer;
89
import com.azure.cosmos.ReadConsistencyStrategy;
910
import com.azure.cosmos.implementation.apachecommons.collections.list.UnmodifiableList;
1011
import com.azure.cosmos.util.Beta;
@@ -40,6 +41,7 @@ public final class CosmosRequestOptions {
4041
private String queryName;
4142
private Set<String> keywordIdentifiers;
4243
private ReadConsistencyStrategy readConsistencyStrategy;
44+
private CosmosItemSerializer customItemSerializer;
4345
private static final Set<String> EMPTY_KEYWORD_IDENTIFIERS = Collections.unmodifiableSet(new HashSet<>());
4446

4547
/**
@@ -453,4 +455,24 @@ public CosmosEndToEndOperationLatencyPolicyConfig getCosmosEndToEndLatencyPolicy
453455
public Set<String> getKeywordIdentifiers() {
454456
return this.keywordIdentifiers;
455457
}
458+
459+
/**
460+
* Gets the custom item serializer.
461+
*
462+
* @return the custom item serializer.
463+
*/
464+
public CosmosItemSerializer getCustomItemSerializer() {
465+
return this.customItemSerializer;
466+
}
467+
468+
/**
469+
* Sets the custom item serializer.
470+
*
471+
* @param customItemSerializer the custom item serializer.
472+
* @return current CosmosRequestOptions.
473+
*/
474+
public CosmosRequestOptions setCustomItemSerializer(CosmosItemSerializer customItemSerializer) {
475+
this.customItemSerializer = customItemSerializer;
476+
return this;
477+
}
456478
}

0 commit comments

Comments
 (0)