Honestly, it happens-- and if they understand that they were out of hand, then at least you made your point.
Last poster is right-- I did something similar with 2nd grade middle schoolers last year when they were absolutely disrespectful, and after a lecture, I made them sit in the classroom silently through part of their break. While I didn't yell at them, I did kind of go overboard. They resented that longer than I expected, but eventually they got over it.
For the most part, being absolutely silent worked for my students, or telling them at the beginning of class that I'll make them stay in the class during their break for 1-minute EACH time they get out of hand. That often worked for me... along with showing interest in their general lives.
Again, I'm sure if it's a one time thing, they'll eventually get over it and the more they get back to knowing you as a teacher and person, the less they are likely to be rude and put you over the edge.