Queries db only as needed

Queries db only as needed and puts in message type