The following is from Midrash Pesiqta Rabba 36 involving a conversation between HaShem and Moshiach Ben Yosef:
Their sins will be upon you like a yoke of iron. They will choke your spirit. Because of their sins, your tongue will cleave to the roof of your mouth. Do you accept this? If not, I will remove the decree from you.
Master of the worlds, how long will this last?
Ephraim, my true Messiah, ever since the six days of creation you have taken this ordeal upon yourself. At this moment, your pain is my pain.
Master of the worlds, accept this with gladness in my soul, and joy in my heart, so that not a single one of the house of Israel should perish. Not only for those alive, but also the dead. It is enough that the servant be like the Master.
==================================================
==========================================
Midrash Pesiqta Rabbati Chapter 27 describes Moshiach Ben Yosef's triumph and the glory which he receives as a due reward for his humiliation and suffering on behalf of Israel.
It is based on Isaiah 41:10:
"The fathers of the world (the patriarchs) will rise again in the month of Nisan and will say to him, Ephraim, our righteous Messiah, though we are your fathers, yet you are greater than we, because you have borne the sins of our children, and hard and evil measure has passed upon you, such as has not been passed either upon those before or upon those after. And you have been for laughter and derision to the nations for the sake of Israel, and you have dwelled in darkness and in gloominess, and your eyes have not seen light, and your skin was cleaving to your bones, and your body was dry as wood, and your eyes were darkened through fasting, and your strength was dried up like a potsherd. And all this on account of the sins of our children. Is it your pleasure that our sons should enjoy the good things which the Holy One, blessed be He, has poured out so abundantly upon Israel? Or, perhaps, on account of the anguish which you have suffered so much for them, and because they have chained you in the prison house (i.e., this would indicate that he also suffered at the hands of his own people), perhaps you are not pleased with them?"He says to them, Fathers of the world, whatever I have done I have done only for your sakes, and for the sake of your children, for the sake of your honor and that of your children, and that they may enjoy the goodness which the Holy One, blessed be He, has poured out over Israel. Then the fathers say to him, Ephraim, our righteous Messiah, let your mind be at rest, as you have put the mind of your Maker at rest and also our mind."
==================================================
==========================================
"Rabbi Simeon, the son of Rabbi Pasi, said:
In that hour the Holy One, blessed be He, exalts the Messiah to the heaven of heavens, and spreads over him the splendor of His glory. . . And the Holy One says: You righteous ones of the world, Ephraim, the Messiah of My righteousness, has not yet received even one half for all he has suffered. . ."
---Midrash Pesiqta Rabbati 27
==================================================
==========================================
R. Berekiah said in the name of R. Isaac: As it is written, And the Lord showed me four craftsmen (Zech. II, 3), namely, Elijah, the Messiah, Melchizedek, and the War Messiah.
[Lit.,the priest anointed for war', an expression originally applied to the priest who accompanied the troops. Cf. Suk. 52a, where instead of ' War Messiah ' we have ' Messiah son of Joseph'. The two are probably identical, Messiah the son of Joseph being regarded as the forerunner of the Messiah during the wars that will precede his advent.]
---Song of Songs Rabbah 2:33
..."the sceptre shall not depart from Judah nor the ruler's staff from between his feet", "the sceptre" referring to the Messiah of the house of Judah, and "the staff" to the Messiah of the house of Joseph.
---Zohar, Volume 1, Page 25b
==================================================
==========================================
"Mysteries of R. Shim'on ben Yohai (Midrash, date uncertain):
And Armilaus will join battle with Messiah, the son of Ephraim, in the East gate . . .; and Messiah, the son of Ephraim, will die there, and Israel will mourn for him. And afterwards the Holy One will reveal to them Messiah, the son of David, whom Israel will desire to stone, saying, Thou speakest falsely; already is the Messiah slain, and there is non other Messiah to stand up (after him): and so they will despise him, as it is written, "Despised and forlorn of men;" but he will turn and hide himself from them, according to the words, "Like one hiding his face from us."
---The Suffering Servant of Isaiah
By Driver and Neubauer
Page 32
==================================================
==========================================
This is also hinted at in the verse "the sceptre shall not depart from Judah nor the ruler's staff from between his feet", "the sceptre" referring to the Messiah of the house of Judah, and "the staff" to the Messiah of the house of Joseph. "Until Shiloh cometh": this is Moses, the numerical value of the two names Shiloh and Moses being the same.
---Zohar, Volume 1, Page 25b
==================================================
==========================================
The Rabbis maintained: OX is an allusion to the one anointed for battle,2 as it says, His firstling bullock, majesty is his (Deut. XXXIII, 17)3; *** refers to the royal Messiah, for it says of him, Lowly, and riding upon an *** (Zech. IX, 9); FLOCKS refers to Israel, as it says, And ye are My sheep, the sheep of My pasture (Ezek. XXXIV, 31);
AND MEN-SERVANTS AND MAID-SERVANTS [likewise alludes to Israel, as it says], Behold, as the eyes of the servants unto the hand of their master (Ps. CXXIII, 2).THAT I MAY FIND FAVOUR [GRACE]-as it says, Be gracious unto us (ib. 3).
(2) The Messiah who would conduct the final war; according to tradition he would be descended from Joseph, and would be the forerunner of the real Messiah, descended from David.
(3) This refers to Joseph, and is understood to allude to the Messiah descended from him.
---Genesis Rabbah 75:6
R. Johanan also said: The son of David will come only in a generation that is either altogether righteous or altogether wicked. 'in a generation that is altogether righteous,' as it is written, Thy people also shall be all righteous: they shall inherit the land for ever. 'Or altogether wicked,' as it is written, And he saw that there was no man, and wondered that there was no intercessor; and it is [elsewhere] written, For mine own sake, even for mine own sake, will I do it.
---Talmud, Sanhedrin 98a
==================================================
==========================================
Our Rabbis taught: in the seven year cycle at the end of which the son of David will come-in the first year, this verse will be fulfilled: And I will cause it to rain upon one city and cause it not to rain upon another city; (2) in the second, the arrows of hunger will be sent forth; (3) in the third, a great famine, in the course of which men, women, and children, pious men and saints (4) will die, and the Torah will be forgotten by its students; in the fourth, partial plenty; (5) in the fifth, great plenty, when men will eat, drink and rejoice, and the Torah will return to its disciples; in the sixth, [Heavenly] sounds; (6) in the seventh, wars; and at the conclusion of the septennate the son of David will come.
(2) ibid. IV, 7.
(3) I.e., not actual famine, but the first signs thereof, no one being completely satisfied.
(4) Lit., 'men on whose behalf miracles occur.' - Jast.
(5) Lit., 'plenty and no plenty'.
(6) Either Heavenly voices announcing the advent of Mashiach, or the blasts of the great Shofar; cf. Yeshayahu (Isa.) 27:13.
---Talmud, Sanhedrin 97a
==================================================
==========================================
"Raba replied: Because they [Yisra'el] are destined to be redeemed in the seventh year [of the coming of the Messiah], (22) therefore the mention of redemption was placed in the seventh blessing. The Master said: "In the sixth year [of Messianic septenary], sounds will be heard; in the seventh, there will be wars, and at the end of the seventh, the Son of David will come. Wars are the beginning of Redemption."
---Talmud, Megila 17b
==================================================
==========================================
"And this is for you the sign [of the coming of the Mashiach]: that you see a septenary which begins with rain; in the second year, arrows of famine are sent out; in the third, there is great famine; and in the fourth - neither hunger nor plenty; in the sixth - great plenty, and a star will grow from the east with a staff on its head, and that is the star of Yisra'el...and if it lights up, it is for the benefit of Yisra'el, and then will sprout up Mashiach ben David. And this is the sign for you: When you see the eastern Nero (i.e., emperor) in Damascus has fallen, and the kingdom of the Children of the East has fallen, then will salvation sprout up for Yisra'el, and Mashiach ben David will come, and they will ascend to Yerushalayim and enjoy it...May Elohim in His mercy send us the Redeemer rapidly in our days, Amen."
---Nistarot R. Shim'on ben
Yohai, BhM 3:82
==================================================
==========================================
This is also hinted at in the verse "the sceptre shall not depart from Judah nor the ruler's staff from between his feet", "the sceptre" referring to the Messiah of the house of Judah, and "the staff" to the Messiah of the house of Joseph. "Until Shiloh cometh": this is Moses, the numerical value of the two names Shiloh and Moses being the same.
---Zohar, Volume 1, Page 25b
==================================================
==========================================
Wherewith thine enemies have reproached, O Lord,' wherewith they have reproached the footsteps of thine anointed.]8 it has been taught, R. Judah said: in the generation when the son of David comes, the house of assembly9 will be for harlots, Galilee in ruins, Gablan lie desolate,10 the border inhabitants11 wander about from city to city, receiving no hospitality, the wisdom of scribes in disfavour, God-fearing men despised, people12 be dog-faced,13 and truth entirely lacking, as it is written, Yea, truth faileth, and he that departeth from evil maketh himself a prey.14 What is meant by 'yea, truth faileth [ne'edereth15 ]'? The Scholars of the School of Rab16 said: This teaches that it will split up into separate groups17 and depart.18 What is the meaning of 'and he that departeth from evil maketh himself a prey [mishtollel19 ]'? The School of R. Shila said: He who departs from evil will be dubbed a fool by his fellow-men.20
(8) Ps. LXXXIX, 52.
(9) Where scholars assemble.
(10) [Gaulan, E. of the Sea of Galilee and the upper Jordan].
(11) The Jews living by the borders of Palestine. ,hzd habt the men of (the Hall of) Hewn Stones, I.e., the Sanhedrin.
(12) Lit., 'the face of the generation.'
(13) I.e., brazen, without shame of each other.
(14) Isa. LIX, 15.
(15) ,rsgb
(16) V. p. 387, n. 7.
(17) ohrsg ohrsg 'Adarim, 'adarim. ,rsgb is connected with rsg, meaning 'drove,' 'group.'
(18) Probably meaning that there will be so many conflicting opinions as to what is the truth as to render it, for all practical purposes, inaccessible.
(19) kku,an
(20) Cf. Job XII, 17: He leadeth counsellors away spoiled (kkua) and maketh the judges fools. Sholal being parallel to 'fools', it bears the same connotation.
---Talmud, Sanhedrin 97a
==================================================
==========================================
Finally, of the royal Messiah it is written, And the spirit of the Lord shall rest upon him, the spirit of wisdom and understanding, the spirit of counsel and might, the spirit of knowledge and of the fear of the Lord (Isa. XI, 2).
---Genesis Rabbah 97