Use generics in message handlers.