fix apm build
basic publish and subscribe seems to work
minor cleanup
add sending glue for apm