1 Reply Latest reply on Apr 16, 2004 2:17 PM by belaban

    JBoss::Cluster::GetNodes.pm

    npdavis

      All,
      I am building a Jboss cluster aware perl module for our legacy apps to take advantage of JBoss clustering and failover by listening to the UDP broadcasts, to maintain a near realtime list of available nodes.

      What is the possibility of me getting the datagram spec?

      If this is inappropriate for this list, I'll re-post on the user list.

      I have a UDP client eavesdropping on the broadcasts (really cool!!!) but don't know where to start with parsing these datagrams. See below.

      This module will be extremely useful to people who want to plop a Jboss cluster in their DMZ and take advantage of the cutting edge tech in Jboss, without rewriting all of their apps.

      Once perl is done, I will be doing a php port, then a c library (with appropriate updates to the perl and php modules) If I can somehow work with this data. I could do a regex on split arrays, but need a beginning and end for each message.

      Any way of getting a spec which defines these messages, fields, and meanings?
      Or alternatively, a list of libraries so I can figure it out from the source?
      I am unsure of how to digest these messages.

      LMK,
      thx,
      Neil

      (slightly adjusted example from CPAN)
      #!/usr/bin/perl -w
       # client
      
       use strict;
       use IO::Socket::Multicast;
       use IO::Socket::INET;
       use constant GROUP => '228.3.2.1';
       use constant PORT => '45566';
      
       my $sock = IO::Socket::Multicast->new(Proto=>'udp',LocalPort=>PORT);
       $sock->mcast_add(GROUP) || die "Couldn't set group: $!\n";
      
       while (1) {
       my $data;
       next unless $sock->recv($data,1024);
       print $data;
       }
      
      


      To me it looks like a fixed width with some control characters.
      Sample from raw print:
      VT102UDPDefaultPartitionNAKACK
       0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwz
      
       UDPDefaultPartitionNAKACK
       0220¬ÃÂÂwRä±þ¡¡I%161.161.73.37:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwzÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
      VT102VT102
      pwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I%161.161.73.37:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwz
      
      pwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%16VT102VT102VT102VT102VT1021.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwzÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
      
      pwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50UDPDefaultPartitionVT102VT102VT102VT102VT102NAKACK0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwz UDPDefaultPartitionNAKACK0220¬ÃÂÂwRä±þ¡¡I%161.161.73.37:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwzÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
      pwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I%161.161.73.37:1099STABLEr[Lorg.jgroups.Address; fñQVT102VT102VT102VT102qÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%161.161.73.37:1099xspwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address;7:109fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
       xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50pwUDPDefaultPartitVT102VT102VT102VT102VT102VT102VT102VT102ion0220¬ÃÂÂwPä±þ¡¡I%161.161.73.37:1099PING
      


      Are these objects or text messages?

      thx,
      Neil

        • 1. JBoss::Cluster::GetNodes.pm
          belaban

          All,
          I am building a Jboss cluster aware perl module for our legacy apps to take advantage of JBoss clustering and failover by listening to the UDP broadcasts, to maintain a near realtime list of available nodes.

          What is the possibility of me getting the datagram spec?

          If this is inappropriate for this list, I'll re-post on the user list.

          I have a UDP client eavesdropping on the broadcasts (really cool!!!) but don't know where to start with parsing these datagrams. See below.

          This module will be extremely useful to people who want to plop a Jboss cluster in their DMZ and take advantage of the cutting edge tech in Jboss, without rewriting all of their apps.

          Once perl is done, I will be doing a php port, then a c library (with appropriate updates to the perl and php modules) If I can somehow work with this data. I could do a regex on split arrays, but need a beginning and end for each message.

          Any way of getting a spec which defines these messages, fields, and meanings?
          Or alternatively, a list of libraries so I can figure it out from the source?
          I am unsure of how to digest these messages.

          LMK,
          thx,
          Neil

          (slightly adjusted example from CPAN)
          #!/usr/bin/perl -w
           # client
          
           use strict;
           use IO::Socket::Multicast;
           use IO::Socket::INET;
           use constant GROUP => '228.3.2.1';
           use constant PORT => '45566';
          
           my $sock = IO::Socket::Multicast->new(Proto=>'udp',LocalPort=>PORT);
           $sock->mcast_add(GROUP) || die "Couldn't set group: $!\n";
          
           while (1) {
           my $data;
           next unless $sock->recv($data,1024);
           print $data;
           }
          
          


          To me it looks like a fixed width with some control characters.
          Sample from raw print:
          VT102UDPDefaultPartitionNAKACK
           0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwz
          
           UDPDefaultPartitionNAKACK
           0220¬ÃÂÂwRä±þ¡¡I%161.161.73.37:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwzÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
          VT102VT102
          pwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I%161.161.73.37:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwz
          
          pwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%16VT102VT102VT102VT102VT1021.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwzÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
          
          pwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50UDPDefaultPartitionVT102VT102VT102VT102VT102NAKACK0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwz UDPDefaultPartitionNAKACK0220¬ÃÂÂwRä±þ¡¡I%161.161.73.37:1099STABLEr[Lorg.jgroups.Address; fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50:1099xwzÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
          pwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I%161.161.73.37:1099STABLEr[Lorg.jgroups.Address; fñQVT102VT102VT102VT102qÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%161.161.73.37:1099xspwUDPDefaultPartition0220¬ÃÂÂwRä±þ¡¡I2161.161.73.50:1099STABLEr[Lorg.jgroups.Address;7:109fñQqÃÂÂ�Mxpsrrg.jgroups.stack.IpAddressÆ»ß5a0F
           xpw¡¡I%161.161.73.37:1099xsq~w¡¡I2161.161.73.50pwUDPDefaultPartitVT102VT102VT102VT102VT102VT102VT102VT102ion0220¬ÃÂÂwPä±þ¡¡I%161.161.73.37:1099PING
          


          Are these objects or text messages?

          thx,
          Neil