3.1.5.2 GetNextHopsForRouter

GetNextHopsForRouter defines the algorithm that a QueueManager ADM element uses to determine the next hops for a message to get from the source QueueManager ADM element (identified by the SourceMachine parameter) to the ultimate destination (identified by the DestinationMachine parameter), and the source queue manager is an MSMQ Routing Server. The return value is the list of identifiers of the QueueManager ADM elements that can be used as the possible next hop. It returns Nothing on failure.

 GetNextHopsForRouter(SourceMachine of type QueueManager,
                     DestinationMachine of type QueueManager)
  
 INIT NextHops of type List of GUID         ;Next hop QueueManager.Identifier 
 INIT IsSourceSiteGate of type Boolean
  
 SET NextHops to an empty list
  
  
 SET IsSourceSiteGate to result of
     CALL IsSiteGate(SourceMachine.Identifier)
  
 IF IsSourceSiteGate = 1 THEN
      SET NextHops to result of
          CALL GetNextHopsForSiteGate(SourceMachine, DestinationMachine)
 ELSE IF SourceMachine.Identifier is one of 
      DestinationMachine.InRoutingServerIdentifierList THEN
      ADD DestinationMachine.Identifier to NextHops
 ELSE IF intersection of SourceMachine.SiteIdentifierList AND  
            DestinationMachine.SiteIdentifierList is not empty THEN
         IF DestinationMachine.InRoutingServerIdentifierList is not 
 empty THEN
            SET NextHops to DestinationMachine.InRoutingServerIdentifierList
         ELSE
            ADD DestinationMachine.Identifier to NextHops
         ENDIF
 ELSE
    ADD the return of 
        CALL GetSiteGate(SourceMachine.Identifier) to NextHops
 ENDIF
  
 RETURN with NextHops