The CustomerRepository uses a CustomerRegistry which will cache entities on load. If the updates happen in a
different thread, there is a possibility that stale data is returned.
However, we still want to use the repository instead of using the resource model to preserve modifications
added by plugins.
There are two solutions to this
Instead of publishing the ID to the queue, publish it as serialized JSON and create a new service interface (StaticServiceInterface etc) with a get which will do nothing except take in the input and return it as is (unserialize maybe required)
Recreate the customer repository's get just for the sake of publishing but do not use the internal cache and always load from DB. I can provide an example of this if you'd like. However with this approach, you might lose custom plugins that modify data on it.
The CustomerRepository uses a CustomerRegistry which will cache entities on load. If the updates happen in a different thread, there is a possibility that stale data is returned. However, we still want to use the repository instead of using the resource model to preserve modifications added by plugins.
There are two solutions to this
Please see https://github.com/aligent/magento2-default-async-events/pull/1#discussion_r904450099
https://github.com/aligent/magento2-default-async-events/blob/54c2943b0f08a31e56527a5c21e90f259c7d9db0/Model/AsyncCustomerManagement.php#L39