The interaction between the consumer and the producer must leave the stability of the producer unaffected. That requires that producer and consumer be separate processes. Communication between the processes should be limited; unless there is good reason, it should be restricted to files written by the producer and read by the consumer.
file names; sample data;
configuration socket