Updated API so that the id is returned when publishing messages.