Set source input for every message. Fixes #794.

Uses a cache to avoid looking up inputs in the InputRegistry for every
message.