Reactor incorporating a heat exchanger