You don’t have this in Humble - but the connect/disconnect callback support was added in Iron and proper support was added to image_common.
- You can see an example of how this is used in image_pipeline in Jazzy along with links to the related PRs in RMW and image_common - add support for lazy subscribers by mikeferguson · Pull Request #815 · ros-perception/image_pipeline · GitHub)
- Openni2_camera also supports this in Jazzy via this PR: implement proper lazy subscribers by mikeferguson · Pull Request #136 · ros-drivers/openni2_camera · GitHub