add messaging middleware