T.J. Rivera may have lost his shot at becoming the Mets’ starting second baseman when Neil Walker accepted a one-year, $17.2-million qualifying offer earlier this week, but obstacles are nothing new to a player who had to wait until he was 27 to make it to the major leagues.

As the Mets added five players, including top shortstop prospect Amed Rosario, to their 40-man roster on Friday, protecting them from the Rule 5 draft, Rivera was delivering Thanksgiving dinners to families in Elmhurst. It was easy to think back a year, to not being put on the roster, to not being a Rule 5 pick — and seeing his dream come true anyway.

“I try to stay positive with everything that happens in life,” said Rivera, the Bronx kid who became a sensation in Queens in 2016. “I guess the situation was a little different last year.”

Rivera changed his own situation, earning his way to Flushing by hitting .353 with 11 homers and a .909 OPS for Triple-A Las Vegas. After making his major-league debut in August, Rivera had a .333/.345/.476 slash line with three homers in 33 games to solidify second base in place of the injured Walker and help the Mets reach the playoffs. In the wild-card game against the Giants, Rivera was one of four Mets to manage a hit against Madison Bumgarner.

Having shown the ability to hit at the major-league level, Rivera just needs a place to play. Walker has second base, and if David Wright is healthy, he’s got third. Jose Reyes figures to be the utility infielder. The logical fit is the outfield, though Rivera has only nine games of minor-league experience at the position.

“I’m always open to learning new things,” he said. “If it has to be the outfield, I’ll absolutely put some work in there . . . I was getting comfortable out there. If that’s an option and something I have to do, I’m willing to.”

advertisement | advertise on newsday

In the meantime, all Rivera can do is wait and see, knowing that Walker’s return makes the Mets better while making his own professional role worse.

“It’s a weird situation, because he is going to help the team, but he plays my position,” Rivera said. “I’m not going to let that affect me in any way. I’ve got to keep doing my job and hope for the best.”