Branching processes and queueing systems with repeated orders or with random discipline