I'm trying to adopt the Ruby event example from here https://www.libvirt.org/ruby/examples/event_test.rb to use EventMachine (a library for writing event driven programs).

I have attached my attempt, which appears subscribe to events but never executes the callbacks I provide. I know this because when I reset domains (virsh reset VM) I see messages appear from the Handlers::notify_readable(), which should then invoke Libvirt::event_invoke_handle_callback() - but the output from the callbacks never appears. Typical output from the program looks like:
add_handle fd=11 events=1
add_timer interval=-1
:notify_readable id=0 fd=11 events=1
update_timer id=0 interval=0
:notify_readable id=0 fd=11 events=1
:notify_readable id=0 fd=11 events=1

When I enabled debugging by setting LIBVIRT_DEBUG to 1 the output from libvirt appears to be the same as event_test.rb (excluding memory addresses). Can anyone see where I'm going wrong?

Many thanks
Jonathan Barber <jonathan.barber@gmail.com>