In MAME, you can make either work. However, they won't control like the original. I use MAME Analog+ for all my rotary games since it has MC Escher's hack. This makes one rotary click = one turn of the character in MAME. If you use the vanilla build of MAME, I'm not sure if you will get the same response. There were changes to the code recently that were supposed to fix things so they would work like this, but I haven't tried it yet.
As for optical rotary sticks, these work basically like a spinner more or less. You can use the analog settings to make it work, but again it will not feel authentic. If all you care about is making it work, you will probably have better luck with the optical stick IMO.
u_rebelscum is probably the best person to give advice on this, so hopefully he will pop in with some words of wisdom.