Recent plane passengers, hostel residents, hospital and medical centre patients are among those at risk of developing measles following confirmed cases of the highly contagious disease in Sydney in late March and early April.

NSW Health has issued a community alert after four people with measles are known to have been in close contact with large groups of people while they were still infectious but before they were diagnosed.

Two travellers spent time in hostels in Cairns and Magnetic Island while they were infectious and then respectively travelled to Sydney on a Virgin Airlines flight on March 28 and a Tiger Airlines flight the following day, the health department said.

One of them also spent time in the Royal North Shore Hospital Emergency Department.