I'm curious if MassTransit Peek () consumers will be able to queue the MSMQ before actually retrieving the messages.
What steps / process:
1) Msg sent to the queue
2) Consumers receive it and must do a database update - it takes about 5 seconds
3) The consumer must make a second round of updates if the first worked.
My problem is how can I handle the case if during the first update of the database the message remains in the queue (i.e. the problem is with the network and cannot get to db).
Currently, as soon as he reads the message from the queue, he deletes it, and then it just disappears if the database updates do not work.
In addition, how can I deal with a power outage - I mean, if halfway through the βtaskβ the consumer has, whatever it is (db update or something else), and the power dies, etc., how can i restart the process on msg in queue? Let's say that the job (in my current instance anyway) causes a new row in the table. I mean, I can write code to first check if a line exists, and if it then discards the message, and if not, it starts the task, but how can I get it to restart the whole process in the first place?
I read that the Peek() queue could, and then run the task, and then read the msg message queue for the real one and delete it, but I canβt figure out for life whether this works with mass transit. bit is lost ...
In addition, I know that Masstransit has a .RetryLater , but then I use it in this process? Is it Initially β When β Then β .RetryLater in the saga?
Any pointers will be involved
Regards Robin
EDIT
PS: I use the saga ....
Define(() => { RemoveWhen(saga => saga.CurrentState == Completed); Initially( When(NewAC) .Then((saga, message) => saga.ProcessPSM(message), InCaseOf<Exception>() .TransitionTo(Problem) ) .Then((saga, message) => saga.PostProcessPSM()) .Complete() ); During(Problem, When(Waiting)
RetryLater throws an error: "Message cannot be accepted by an existing saga"
I'm not sure how else I can access RetryLater.