The two men became acquainted while Kafka was indifferently studying law at the University of Prague. He received his doctorate in 1906, and in 1907 he took up regular employment with an insurance company. The long hours and exacting requirements of the Assicurazioni Generali, however, did not permit Kafka to devote himself to writing. In 1908 he found in Prague a job in the seminationalized Workers' Accident Insurance Institute for the Kingdom of Bohemia. There he remained until 1917, when tuberculosis forced him to take intermittent sick leaves and, finally, to retire (with a pension) in 1922, about two years before he died. In his job he was considered tireless and ambitious; he soon became the right hand of his boss, and he was esteemed and liked by all who worked with him.
In fact, generally speaking, Kafka was a charming, intelligent, and humorous individual, but he found his routine office job and the exhausting double life into which it forced him (for his nights were frequently consumed in writing) to be excruciating torture, and his deeper personal relationships were neurotically disturbed. The conflicting inclinations of his complex and ambivalent personality found expression in his sexual relationships. Inhibition painfully disturbed his relations with Felice Bauer, to whom he was twice engaged before their final rupture in 1917. Later his love for Milena Jesenská Pollak was also thwarted. His health was poor and office work exhausted him. In 1917 he was diagnosed as having tuberculosis, and from then onward he spent frequent periods in sanatoriums.
In 1923 Kafka went to Berlin to escape from his paternal family and devote himself to writing. In Berlin he found new hope in the companionship of a young Jewish socialist, Dora Dymant, but his stay was cut short by a decisive deterioration of his health during the winter of 1924. After a brief final stay in Prague, where Dora Dymant joined him, he died in a clinic near Vienna. --encyclopedia Britannica