${INSTALL} -m 755 ${EXAMPLES} ${DESTDIR}${PREFIX}${prefix}/${libdir}/glite-lb/examples
        ( cd ${top_srcdir}/project && ${INSTALL} -m 644 ChangeLog package.description package.summary ${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version} )
        ${INSTALL} -m 644 ${top_srcdir}/config/msg.conf.example ${DESTDIR}${PREFIX}${sysconfdir}/glite-lb
-       ${INSTALL} -m 755 ${top_srcdir}/src/msg-brokers-openwire ${DESTDIR}${PREFIX}${prefix}/share/glite-lb
+       ${INSTALL} -m 755 ${top_srcdir}/src/msg-brokers ${DESTDIR}${PREFIX}${prefix}/share/glite-lb
 
 %.lo %.o: %.cpp
        ${COMPILEXX} -c $< -o $@
 
 
 sub list_brokers ($) {
     my($ldap, %search, $endpoint, $match, $network, $value, @uris);
+    my($proto,%uris);
     my($check) = @_;
 
     $ldap = connect_bdii();
     %search = (
-        filter => "(&(objectClass=GlueService)(GlueServiceType=msg.broker.openwire)",
+        filter => "(&(objectClass=GlueService)(GlueServiceType=msg.broker.*)",
         attrs  => [ qw(GlueServiceEndpoint GlueServiceUniqueID) ],
     );
     $search{filter} .= "(GlueServiceStatus=OK)" if ($check);
        }
        $value = $endpoint->get_value("GlueServiceEndpoint");
        if ($match) {
-           push(@uris, $value);
+            $proto = '';
+            if ($value =~ /^([^:]*):\/\/.*/) { $proto = $1; }
+            push(@{$uris{$proto}}, $value);
            debug(2, "  keep URI %s", $value);
        } else {
            debug(2, "  skip URI %s", $value);
        }
     }
+
+    foreach $proto ('stomp+ssl', 'openwire+ssl', 'stomp', 'openwire') {
+       if (exists $uris{$proto}) {
+            push(@uris,@{$uris{$proto}});
+            delete $uris{$proto};
+        }
+    }
+    foreach $proto (keys %uris) {
+            push(@uris,@{$uris{$proto}});
+    }
+    
     debug(1, "got %d broker URIs from BDII", scalar(@uris));
     warning("got an empty brokers list from BDII") unless @uris;
     return(@uris);
 
     rm -f "$GLITE_LB_LOCATION_ETC/glite-lb/msg.conf"
   else
     if [ "$GLITE_LB_MSG_BROKER" = 'true' -o "$GLITE_LB_MSG_BROKER" = 'auto' -o -z "$GLITE_LB_MSG_BROKER" ]; then
-      GLITE_LB_MSG_BROKER="`${GLITE_LB_LOCATION}/share/glite-lb/msg-brokers-openwire --bdii $LCG_GFAL_INFOSYS --network $GLITE_LB_MSG_NETWORK --sort find | head -n 1 | sed 's,openwire://,tcp://,'`";
+      GLITE_LB_MSG_BROKER="`${GLITE_LB_LOCATION}/share/glite-lb/msg-brokers --bdii $LCG_GFAL_INFOSYS --network $GLITE_LB_MSG_NETWORK --sort find | head -n 1 | sed 's,openwire://,tcp://,'`";
     fi
     if [ ! -z "$GLITE_LB_MSG_BROKER" ]; then
       cat > "$GLITE_LB_LOCATION_ETC/glite-lb/msg.conf" <<EOF