I would like to be able to use pgsql for application lock but the api of advisory lock is not good for that un my opinion:
There is no namespace or table for that. Meaning that the single common locking space will be shared by all the users/apps of your database.
The key has to be an int with a quite low limit (like 30k) if my memory is good. So you can't use the key to use for namespacing.