Lately I've encountered a similar problem in a few different circumstances, and every time it has required quite a bit of extra code to work around it.
The problem I'm talking about is the one where one application or device needs to send something to another application or device (usually a server). The thing being sent can be identified by a unique ID, but this ID is not known at the time of sending. It is instead generated or calculated by the receiver. Sort of a chicken-and-the-egg type of situation.
A common example is inserting a record into a database, and not knowing the ID of the newly inserted record until it has been inserted. My latest encounter was a situation where a mobile app needed to send an image and an accompanying textfile to a server, but the textfile couldn't be sent until the image had been received and an ID returned and inserted into the textfile. Pretty straightforward, until you start taking mobile network error handling into account...
This has cropped up in various forms lately, and I've noticed that usually it requires a lot more complexity to let the receiver generate an ID than would be required if I could just let the sender generate a UUID/GUID/whatever and send it along with whatever I'm sending.
So I'm curious - does this problem have a common name? And am I right in thinking that the best/least complex approach usually is to let the sender set the ID instead of the receiver?