So from my understanding, you can use Hemlock to connect to ejabberd.
If you want to communicate with your application servers, I would
either communicate with them separately (listen to the same events as
Hemlock does and send to them directly to your app servers) OR look at
ejabberd's message announcement module for server to server
communication. The only advantage to the 2nd approach is that your
outside bandwidth/client users are using up less bandwidth to
communicate with your servers. Either way though, it scales
horizontally. :)