I should probably redo 6ae00a936b again. We probably do want to have some sort of MercuryConnectionRegistry, that does know each account and does react to enable/disable/delete events by connecting/disconnecting the connection.
Right now it is a little bit tidy to sort out events as
observeAllAccounts only returns a list (Observable<List>) of all accounts on each change, but there is no convenient way to transform that list into events like account XYZ added, account ABC deleted etc.
above technique would also collide with the way we currently add new accounts, as we would run into twice-connected accounts that way.
Observing changed accounts as Observable does not work either, as there is no emission for deleted accounts.
What we probably need is a registry where existing accounts are registred on startup. Registered accounts are observed on a per-account basis, so that each account has its own subscriber that acts on enabled-changes by connecting/disconnecting. These subscribers also do initial connection if needed.
This would allow usecases to register accounts after inserting them into the database and/or connecting, which would allow fine-grade control.