I added distribution database to the alwaysOn group of dist1 and dist2 server. I setup replication for the database which are part of AAG and act as a publisher( node 1 and node2) and subscriber resides on node2. replication works fine when pub db gets failover from node 1 to node 2 or vice versa. However, If i failover distribution database from DIST1 to DIS2 then changes are not getting replicated. There's a SQL agent job(monitor and sync replication jobs) that crates all replication related SQL agent jobs on new primary post-failover but it's not creating any of the replication jobs. I tried to run steps manually but it throws following error.
Error 22022: SQL agent job 'XXXXXXXXXXX' does not exist in cache.
I tried to recreate replication jobs manually on on new primary but it didn't help. What could be reason for jobs couldn't find in cache.