This paper studies a long-standing problem of risk exchange and optimal resource allocation among multiple entities in a continuous-time pure risk-exchange economy. We establish a novel risk exchange mechanism that allows entities to share and transfer risks dynamically over time. To achieve Pareto optimality, we formulate the problem as a stochastic control problem and derive explicit solutions for the optimal investment, consumption, and risk exchange strategies using a martingale method. To highlight practical applications of the solution to the proposed problem, we apply our results to a target benefit pension plan, featuring the potential benefits of risk sharing within this pension system. Numerical examples show the sensitivity of investment portfolios, the adjustment item, and allocation ratios to specific parameters. It is observed that an increase in the aggregate endowment process results in a rise in the adjustment item. Furthermore, the allocation ratios exhibit a positive correlation with the weights of the agents.