I would like to have my POE client recoever from a variety of IKC
failure scenarios. For example, detect that the IKC server has gone
away and reconnect when it joins.
Here is how I call the client:
POE::Component::IKC::Client->spawn(
host=>'locahost',
port=>5200,
name=>'Counter',
on_error => \&ikc_error,
on_connect=> sub { Logger->log('counter_gui connected to
radio') },
);
POE::Component::IKC::Responder->spawn();
sub ikc_error {
Logger->log('counter_gui could not connect via IKC to Radio');
}
However, if the server goes down this handler is not hit either at
initial drop or when I attempt to post to the remote kernel. It does
get hit if server is not there at time client is executed.
Here is how the client posts:
$kernel->post('IKC', 'post', "poe://Radio/radio/set_freq", $freq);
What does happen after I post to down server are messages such as:
23855: MSG TO $VAR1 = {
'kernel' => 'Radio',
'session' => 'radio',
'state' => 'set_freq'
};
23855: Unknown kernel 'Radio'.
23855: Known kernels: at
/usr/lib/perl5/vendor_perl/5.12.3/POE/Component/IKC/Responder.pm line 761.
So I looked at documentation for POE::Component::IKC::Responder and it
appears there is something in there that should do what I want (for
example "monitor"). So I added this code after spawning the Responder:
$poe_kernel->post('IKC', 'monitor', '*', {
register=>'remote_register'
});
sub remote_register {
Logger->log('counter_gui just detected IKC register');
}
However, this code code does not get hit on a connection (I figured I
would add unregister later if that was what I needed).
So, what steps am I missing? Or, is what I want to do not feasible?
Thanks,
John