Marcus Eriksson: Drizzle replication to WebSockets
I just pushed a WebSocket applier to RabbitReplication, and yes, it is as crazy as it sounds. It works pretty much like all appliers - it consumes drizzle transactions from RabbitMQ, converts them into objects by inspecting annotations, marshalls the object to JSON, and then stores the JSON string. In this case it stores it to a set of websockets. RabbitReplication is deployed as a war file to Jetty 7.01 which supports websockets.I set the demo up on my server at home (in Sweden) on a DSL line, so it might be slow, but it should show the idea, all operations are instant when latency is low (if anyone wants to host it at a better place, please let me know. Of course, it requires a WebSocket capable browser and the only one I know of is Google Chro! me.
It works like this:
- INSERT is executed from the "drizzle client" webapp - totally separate webapp that uses drizzle jdbc to insert/update/delete data.
- Drizzle stores the transaction in the database and in the transaction log.
- Master extractor extracts the transaction and publishes it to RabbitMQ
- Slave applier consumes the transaction from RabbitMQ
- Applier transforms the transaction to JSON
- Applier writes the JSON to a set of websockets
- _javascript_ voodoo is performed to make it visible
Possible real usecases
The demo app just shows what is possible, but a real use case could be that someone has a drizzle backed forum and want to add some real time post-updates to some front page somewhere. This would be real easy, simply start a new slave configured for WebSocket application (of course RabbitReplication
is already used for other replication needs :) ), convert the JSON to something that makes sense and they are set! If someone has a cool usecase, please let me know and i'll build a more realistic demo app!
URL: http://developian.blogspot.com/2009/12/drizzle-replication-to-websockets.html
_______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

