keith_k

Subscribing to messages from a hub over a tunnel

Discussion created by keith_k on Dec 1, 2009
Latest reply on Dec 7, 2009 by keith_k
I want to create a script that works like Dr.NimBUS for subscribing to messages from a hub, but I want it to run from the command line and dump some information about the messages to a text file.  (I am currently troubleshooting a problem with a high volume of messages going through a hub, but Dr.NimBUS is unable to keep up with the messages.)

I wanted to use Lua, but probe.subscribe() requires probe.register() to be run first.  I do not want this script to register as a probe, so I gave up on Lua.  (The NSA also has a disadvantage that it does not pass along normal arguments to the script; you have to preface them with the -a option.)

Then I tried using Perl.  I had to resolve the NimBUS address of the hub to an IP and port, which was new to me.  Here is the code I came up with:
my($rc, $ip, $port) = nimGetNameToIp("/Berbee/$hub/$hubrobot/hub");

my $sess = Nimbus::smileyfrustrated:ession->new($prgname);
$sess->setInfo($version,"Nimbus Software AS");
$rc = $sess->subscribe("alarm", $ip, $port);
if ( $rc ) {
    die "Failed to subscribe to $ip:$port - ", nimError2Txt($rc), "\n";
}
$sess->dispatch();
When I run the script, I get the following on stderror:
Failed to subscribe to 192.168.43.132:50018 - invalid argument
Does anyone have any idea what I am doing wrong?  Is this even possible the way I am trying to do it?  I do not have to use Perl for this, although it is the language with which I would be the most comfortable.

Thanks,
Keith

Outcomes