-
Processing streaming JSON asynchronously is a piece of cake with YAJL and EventMachine
At work we are planning a redesign of our architecture into a services oriented style. It makes a lot of sense for us and will enable us to scale the areas of the application that need it while avoiding us wasting extra resources on areas of the application that are doing just fine as they are. It’s some seriously sexy shit, trust me. That and working with insanely smart cats has me jumping out of bed every morning.
One of the first things I needed to do was find away to consume a stream of data asynchronously. Since the data is a stream is delivered in arbitrary chunk sizes, not as discrete JSON objects I had a problem. Somehow I had to parse this.
Turns out it isn’t a problem. Thanks to YAJL and EventMachine
Check the Beautiful, simple, sweet, sweet code
P.S. If you run the code, observe the general asininity of Twitter’s user base… Fuck Twitter.
Love
S
Sat17Jul