jesse.gonzalez

Java SDK NimSubscribe.subscribeForQueue()

Discussion created by jesse.gonzalez on Jun 19, 2009
Latest reply on Feb 3, 2012 by Huamin
We are working on an external connector that will get messages from an 'attach' queue configured on a hub. The network layout is most likely to blame, but I wanted to see if anyone here has a work around or solution. We have an isolated dev environment behind a firewall with a static NAT defined for the hub.

With the following Perl I can subscribe to the attach queue defined on the hub and it works:

#!/usr/bin/perl

use strict;
use Nimbus::smileyfrustrated:ession;

my $prgname = "subscribe";
my $sess;
my $version = "0.01";
my $loglevel = 5;
my $logfile  = "$prgname.log";

###########################################################
sub hubpost {
    my $hMsg  = shift;     # Message handle
    my $udata = shift;     # User data/message
    my $full  = shift;     # Full message (inkl. header)

    my $subject = pdsGet_PCH($full,"subject");
    nimLog (1,"(hubpost) - incoming message received - subject: $subject");
    pdsDump($full);

    #
    # The magic happens here
    #

    nimSendReply($hMsg);
    exit;
}

sub ctrlc {
  exit;
}

###########################################################
# MAIN ENTRY
#
$SIG{INT} = \&ctrlc;

nimLogSet($logfile,$prgname,$loglevel,0);
nimLog(0,"----------------- Starting  (pid: $$) ------------------");

$sess = Nimbus::smileyfrustrated:ession->new("$prgname");

if ($sess->attach("alarm", "x.x.x.x")) {
    nimLog(0,"subscribe failed: alarm, exiting");
    exit;
}

$sess->dispatch();
exit;


When using the JAVA SDK and NimSubscribe.subscribeForQueue(), I am not successful. Logging from my java source shows the following:

Jun 18 16:38:39:574  com.nimsoft.nimbus.NimClientSession: try to open socket for x.x.x.x:48000
Jun 18 16:38:39:619  com.nimsoft.nimbus.NimSessionBase:     --> pdshead = : seq=0, cmd=gethub, mtype=100
Jun 18 16:38:39:620  com.nimsoft.nimbus.NimSessionBase:     --> pdsdata = :
Jun 18 16:38:39:620  com.nimsoft.nimbus.NimSessionBase: socket = Socket
Jun 18 16:38:39:621  com.nimsoft.nimbus.NimSessionBase: Send buffer; (56) buf = nimbus/1.0 39 0
seq
Jun 18 16:38:39:636  com.nimsoft.nimbus.NimSessionBase:     <-- pdshead = : status=0, seq=0, mtype=200
Jun 18 16:38:39:637  com.nimsoft.nimbus.NimSessionBase:     <-- pdsdata = : phub_name=MHub, phub_ip=y.y.y.y, phub_port=48002, phub_robotname=nimmgr, hubrobotname=nimmgr, hubip=y.y.y.y, phub_domain=Domain, domain=Domain, hubdomain=Domain, robotname=nimmgr, hubname=MHub, hubport=48002
Jun 18 16:38:39:637  com.nimsoft.nimbus.NimSubscribe: contacting HUB at y.y.y.y:48002
Jun 18 16:38:39:637  com.nimsoft.nimbus.NimClientSession: try to open socket for y.y.y.y:48002

So from here I gather that the controller responds to the client with the HUB IP as registered, in this case the private IP y.y.y.y.

So, is it possible to the connect to hub directly? or define the hubport somehow so that the controller is not involved?

Outcomes