Skip to content

Commit

Permalink
Issue 30128 system table clusterwide (#30146)
Browse files Browse the repository at this point in the history
Now the system table updates are cluster wide

---------

Co-authored-by: freddyDOTCMS <[email protected]>
Co-authored-by: Jose Castro <[email protected]>
Co-authored-by: freddyDOTCMS <[email protected]>
  • Loading branch information
4 people authored Sep 26, 2024
1 parent 34b682f commit a0dcbe6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions dotCMS/src/main/java/com/dotcms/business/SystemTableImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.dotcms.business;

import com.dotcms.api.system.event.Payload;
import com.dotcms.api.system.event.SystemEventType;
import com.dotcms.rest.api.v1.maintenance.JVMInfoResource;
import com.dotmarketing.business.APILocator;
import com.dotmarketing.business.FactoryLocator;
Expand Down Expand Up @@ -79,7 +81,15 @@ public void delete(String key) {
Try.run(()-> this.systemTableFactory.delete(key))
.getOrElseThrow((e)-> new DotRuntimeException(e.getMessage(), e));

Try.run(()->HibernateUtil.addCommitListener(()->
APILocator.getLocalSystemEventsAPI().asyncNotify(new SystemTableUpdatedKeyEvent(key))));
Try.run(()->HibernateUtil.addCommitListener(()-> {

final SystemTableUpdatedKeyEvent systemTableUpdatedKeyEvent = new SystemTableUpdatedKeyEvent(key);
// first notify the local system events
APILocator.getLocalSystemEventsAPI().asyncNotify(systemTableUpdatedKeyEvent);
// then notify the cluster wide events
Try.run(()->APILocator.getSystemEventsAPI() // CLUSTER WIDE
.push(SystemEventType.CLUSTER_WIDE_EVENT, new Payload(systemTableUpdatedKeyEvent)))
.onFailure(e -> Logger.error(SystemTableImpl.class, e.getMessage()));
}));
}
}

0 comments on commit a0dcbe6

Please sign in to comment.