add callback for spm.publish