[subject] + 马上 / 立即 / 当即 + [verb phrase]
马上 + 就要 + [verb phrase] + 了
立即, 马上 and 当即 all mean "at once" and go before the verb. 马上 is the spoken word and is loose about timing; 立即 is written and means no delay at all; 当即 is written narrative about the past.
马上 can stretch to minutes or even days, as long as the speaker feels it is close. With 就要…了 it says something is about to happen, which the other two can't do.
立即 says the action follows straight after something else, with nothing in between. It fits instructions, notices and reports. 立刻 is close to it and slightly less formal.
当即 tells what someone did at the moment a past event happened. It reports a past action and can't give an instruction or describe a plan.