"And Jacob lived in the land of Egypt seventeen years" (Beresheet 47:28). Rabbi Yosi said, Jacob's heart saw through prophecy in Egypt that his descendants would suffer many exiles - from then until now, until the End, and the time of the Coming of Messiah.
Jacob Sees Every Exile Before Messiah Comes
Zohar, Vayechi 1:1