A finite-horizon insurance model is studied where the risk/reserve process can be controlled by reinsurance and investment in the financial market. Our setting is innovative in the sense that we describe in a unified way the timing of the events, that is, the arrivals of claims and the changes of the prices in the financial market, by means of a continuous-time semi-Markov process which appears to be more realistic than, say, classical diffusion-based models. Obtaining explicit optimal solutions for the minimizing ruin probability is a difficult task. Therefore we derive a specific methodology, based on recursive relations for the ruin probability, to obtain a reinsurance and investment policy that minimizes an exponential bound (Lundberg-type bound) on the ruin probability.