-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ItemRequestOptions not flowing to custom RequestHandler RequestMessage when AllowBulkExecution is set to true #2741
Comments
This is by design on Bulk. When Bulk mode is on, the operation does not equal the actual network request. The network request is a grouping of operations, which Properties would be sent then? An aggregation of all the Properties of all the grouped operations? What if they have Properties with the same key? |
@ealsur should it throw an exception if bulk is enabled and properties are set to let users know it can not be passed through? |
One option is to use the request position as the key and then have a the value be the dictionary of each individual request. Dictionary<string, object>(){ |
Yeah, just like we do for the other unsupported options: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutor.cs#L128 |
Sounds good, thanks for the info, feel free to close! |
Describe the bug
I've been trying to access the
.Properties
field on theRequestMessage
in my custom type deriving fromRequestHandler
after setting theItemRequestOptions.Properties
and passing it intoContainer.ReadItemAsync()
but every time I would inspect theRequestMessage.Properties
field while debugging, it was empty.I read through the source code for
ReadItemAsync
and noticed we perform a different operation ifBulkOperationIsSupported
. When stepping into the method called in this conditional, I saw that we castRequestOptions
toItemRequestOptions
here. When I attempt this cast in my own code, the result of the cast is alwaysnull
. I suspect this could be the source of the issue.When I removed the
AllowBulkExecution=true
bool from myCosmosClientOptions
setup, theRequestMessage.Properties
in my customRequestHandler
had the properties correctly set from what I passed in fromItemRequestOptions
.To Reproduce
CosmosClient
and pass inCosmosClientOptions
withAllowBulkExcution
set to true.RequestHandler
Container.ReadItemAsync()
method and pass in an object of typeItemRequestOptions
with any properties populated..SendAsync()
method.ReadItemAsync()
method..SendAsync()
, inspectRequestMessage.Properties
.Expected behavior
I expected the fields from the
ItemRequestOptions
passed intoContainer.ReadItemAsync()
to be available on theRequestMessage
in my customRequestHandler
.Actual behavior
None of my
ItemRequestOptions
fields were being populated on theRequestMessage
when inside my customRequestHandler.SendAsync()
method.Environment summary
SDK Version: 3.21.0
OS Version: Windows
Additional context
The text was updated successfully, but these errors were encountered: