added onHeartbeat($consumer) method