I had the same task and it was done as a mix of your two workflows:
- App A registers the user and the event is generated.
- App A sends the event which has
ttl
set to non-zero value directly to B through a queue provided by RabbitMQ. - App B receive event and send welcome message to user and store flag that welcome message sent.
- There are background script which check whether there are newly registered users from last
ttl + 1
time interval who doesn't receive messages.
You can remove background script and flag storing and stick with first workflow from you q. The cases when messages lost or any other cases are damn rare (with welcome messages sending it might be 1 failure per 1billion users) and unnecessary application complication may give you more errors.
The second workflow looks also stable, but why you are using RabbitMQ then?