We develop a flexible model to value longevity bonds which incorporates several important sources of risk, namely, interest rate risk, mortality risk and the risk due to structural changes in economic and environmental conditions. In particular, Markov, regime-switching, jump-diffusion models are used to describe stochastic movements of short-term interest rate and force of mortality. These models capture jumps in short rate and mortality rate and the impacts of economic and environmental fundamentals on their movements over time. Using the concept of stochastic flows, we derive an exponential affine form of the longevity bond price in the proposed joint stochastic interest rate and mortality models. In particular, a representation for the exponential affine form of the longevity bond price is obtained in terms of fundamental matrix solutions of linear, matrix-valued, ordinary differential equations.