Explicitly define message class on register

Make Codec an interface