The legend has it that one night when Lü Yan was in Chang'an or Handan, he dozed off as his yellow millet was cooking in a hotel.
He dreamed that he took the imperial exam and excelled, and thus was awarded a prestigious office and soon promoted to the position of vice minister (侍郎 shìláng).
He then married the daughter of a prosperous household and had a son and a daughter.
He was promoted again and again, and finally became the prime minister.
However, his success and luck attracted jealousy of others, so he was accused of crimes that caused him to lose his office.
 His wife then betrayed him, his children were killed by bandits, and he lost all his wealth.
As he was dying on the street in the dream, he woke up.

Although in the dream, eighteen years had passed, the whole dream actually happened in the time it took his millet to cook.
The characters from his dream were actually played by Zhongli Quan in order to make him realize that one should not put too much importance on transient glory and success.
 As a result, Lü went with Zhongli to discover and cultivate the Tao.
 This dream is known as "Dream of the Yellow Millet" (黃粱夢 Huáng Liáng Mèng) and is described in a writing compiled by Ma Zhiyuan of the Yuan Dynasty.

In volume 82 of Song Dynasty scholar Li Fang's Extensive Records of the Taiping Era, an earlier version of the story, Lü Dongbin was replaced by Student Lu (盧生 Lú Shēng), and Zhongli Quan by Elder Lü  (呂翁 Lǚ Wēng).

The exact age of Lü Yan when this incident occurred varies in the tellings, from 20 years of age to 40.
The legend has it that one night when Lü Yan was in Chang'an or Handan, he dozed off as his yellow millet was cooking in a hotel. He dreamed that he took the imperial exam and excelled, and thus was awarded a prestigious office and soon promoted to the position of vice minister (侍郎 shìláng). He then married the daughter of a prosperous household and had a son and a daughter. He was promoted again and again, and finally became the prime minister. However, his success and luck attracted jealousy of others, so he was accused of crimes that caused him to lose his office.  His wife then betrayed him, his children were killed by bandits, and he lost all his wealth. As he was dying on the street in the dream, he woke up.
Although in the dream, eighteen years had passed, the whole dream actually happened in the time it took his millet to cook. The characters from his dream were actually played by Zhongli Quan in order to make him realize that one should not put too much importance on transient glory and success.  As a result, Lü went with Zhongli to discover and cultivate the Tao.  This dream is known as "Dream of the Yellow Millet" (黃粱夢 Huáng Liáng Mèng) and is described in a writing compiled by Ma Zhiyuan of the Yuan Dynasty.
In volume 82 of Song Dynasty scholar Li Fang's Extensive Records of the Taiping Era, an earlier version of the story, Lü Dongbin was replaced by Student Lu (盧生 Lú Shēng), and Zhongli Quan by Elder Lü  (呂翁 Lǚ Wēng).
The exact age of Lü Yan when this incident occurred varies in the tellings, from 20 years of age to 40.
Lü Dongbin