It's a tough cycle to get out of
@Markness The way out is always going to be unique to the individual. Rumination is not really something most people choose to do. In my case, I believe it's my logical, rational brain in concert with my sub conscious brain, trying to figure out a way to logically solve a problem, that is too distant in the past to have a conventional solution.
So one thing I try to do is imagine I solve the problem. Just literally that. I don't try to think about how, just Deus ex machina my way out of it. That allows my mind to move beyond it, until it notices I tricked it. But the next time I ruminate I will think of a solution, perhaps not a good one, and the process repeats until I feel like the memory isn't playing like a scratched record. Eventually I am victorious!
The "solution" can be something ridiculous, like giving yourself magic powers. It doesn't have to be realistic, just enough to persuade your subconscious that it's possible. Just imagine you did it in response to whatever is going round and round in your head.
That's what works for me for most of the rumination I experience. It does take practice and it's still a bit of a battle. But I find it helps, until, little by little, the loop stops