Skip to content
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

When re-using SendOptions delayed delivery settings are discarded #5147

Closed
dbelcham opened this issue Apr 17, 2018 · 2 comments · Fixed by #5235
Closed

When re-using SendOptions delayed delivery settings are discarded #5147

dbelcham opened this issue Apr 17, 2018 · 2 comments · Fixed by #5235
Assignees
Labels
Milestone

Comments

@dbelcham
Copy link
Contributor

It's not clear that SendOptions cannot be re-used, and to me it seems that there is disagreement on the topic since we fixed a bug ( #4613 ) that allows to re-use SendOptions in some scenarios.

@ramonsmits discovered that the following scenario fails:

var o = new SendOptions();
o.DelayDeliveryWith(TimeSpan.FromSeconds(10));
o.SetDestination("Samples.SqlServer.SimpleReceiver");

await endpointInstance.Send(new MyMessage(), o).ConfigureAwait(false);
await endpointInstance.Send(new MyMessage(), o).ConfigureAwait(false);
await endpointInstance.Send(new MyMessage(), o).ConfigureAwait(false);

Only the first send is delayed, subsequent sent messages are sent immediately ignoring the DelayDeliveryWith configuration. What happens is that we're silently removing the delivery constraint changing the SendOptions instance and at the same time allowing the user to re-use it.

@dbelcham dbelcham added the Bug label Apr 17, 2018
@dbelcham
Copy link
Contributor Author

This should be considered for the next maintenance release

@timbussmann
Copy link
Contributor

I had a quick look at the other extensions and while some add objects to the context as well (which are vulnerable to leaking modifications because we only copy the reference, not the object itself), there are no other usages which change the state of these objects.

The only notable, potential issue is the routing API which does not guarantee cleanup, e.g. see this sample:

var sendOptions = new SendOptions();
sendOptions.SetDestination("test");
sendOptions.RouteToThisEndpoint(); // overrides the SetDestination setting
sendOptions.GetDestination(); // would still return "test"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants