magento2.4 – How to set source quantity (MSI) from my own custom backend module in Magento 2.4?

I’m new to M2, and I am in a hurry to migrate my site from M1. In M1 I made my own MSI functionality, but now I would like to use the built in MSI functionality in M2.
For some of the backend logic (like moving item stock from one source to another when needed), I have created my own module. The logic works, but I need to be able to update the quantity on a specific source.

I would like to know how to set new qty to a specific source for a specific sku in a custom module.

I’ve been at it for a week with no success. I have found answers to similar questions, but the answers are quote code, but do not say specifically where to put the code.

Seems like I should be able to use SourceItemsProcessor, but I don’t know the basics in M2 on how to set it up.