Wednesday, January 11, 2012

Bill Bejeck writes on Guava EventBus. This is very similar to the "MagicBus" code I wrote for a client while at ThoughtWorks in the mid-naughts. Essentially it is an in-process event bus respecting Java method signatures rather than a string-based topic space. You can write decoupled code in a pub-sub style within your own application.

In some weird sense it is an implementation of the COMEFROM instruction. When a "caller" publishes the right parameter list, subscribing methods are invoked as if called directly. Adding new subscribers changes the meaning of the call site. The difference is that control returns to the publisher after all subscribers run; COMEFROM is a complete transfer of control and does not multiplex.

Long live INTERCAL!

Post a Comment