12/23/2023 0 Comments State spending on masstransit![]() Error: 0 : Rescuing exception, System.InvalidOperationException: The object cannot be deleted because it was not found in the ObjectStateManager.Īt .(Object entity, EntitySet expectedEntitySet)Īt 1.Remove(TEntity entity) at 2.d_6.MoveNext() one thing I had noticed in the test out put dump was that it looks like it is throwing some exception that is just swallowed. I wrote a unit test to validate this and it does pass as well. Thanks for taking time to respond to my questions, your suggestion does work to stop the repository from persisting the saga to the database. I hope all these makes some sense and thank you so much for you help. Is there anything in the existing implementation that would allow me to achieve this? or at least is there any utility I can tap into to run a custom code before the framework proceeds to persist a saga instance that is created by default (when an event is received with no matching saga instance). like if(m.Message.Agenda="Simple") return m.AutoCreateInstance() based on the content of the event decide what to do return a new instance of the sage here But right now the parameter passed to the OnMissingInstance delegate doesn't contain the event message and doesn't have an option to proceed with default behavior. So I was expecting to do something like the code below. It is this behavior I want to customize to our need, I want to be able to make a decision based on what is contained in the event whether to create an instance and proceed or ignore the event (or fault for that matter). Ī default behavior I have observed in the state machine is that, if you don't specify "onMissingInstance" handler, when it receives an event with no matching saga instance, the framework tends to create a new instance of the saga (and adds it to the saga repository by default). I am attaching a simple unit test that demonstrates this issueīut I do have a follow up question on it tho. If this feature (OnMissingInstance) is not intended for this purpose, is there any support for such scenario? or something), the event has no meaning and should just be discarded. I would like to ensure that if there is no saga instance (might have been deleted.I would like to use a shared event among multiple state machines and allow the state machines to make the determination on if they wish to use the.I needed this feature to achieve these goals : (The default behavior I assume here is to create a new instance of the saga)īut unfortunately, not only does it create an new instance of the saga, it attempts to insert it to the saga repository. And hence in my implementation I added this line to tell it to ignore the event if there is no matching instance. I might be wrong here, but I was assuming that the "OnMissingInstance" method on the correctionation configiurator is used to tell the framework to act on missing instances for an incoming event. In my state machine definition I am trying to use EventCorrelationConfigurator to ensure that if an event is published and it doesn't have any correlated saga instance it should just be ignored with no action.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |