publish loop to handle multiple events