3.1.5.3 GetNextHopsForSiteGate

GetNextHopsForSiteGate defines the algorithm that a QueueManager ADM element uses to determine the next possible hops for a message to get from the source QueueManager (identified by the SourceMachine parameter) to the ultimate destination (identified by the DestinationMachine parameter), and the source queue manager is an MSMQ Site Gate. 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.

 GetNextHopsForSiteGate(SourceMachine of type QueueManager,
                       DestinationMachine of type QueueManager)
  
 INIT NextHops of type List of GUID         ;Next hop QueueManager.Identifier 
 SET NextHops to an empty list
  
  
 IF SourceMachine.Identifier 
    is one of DestinationMachine.InRoutingServerIdentifierList
 THEN
    ADD DestinationMachine.Identifier to NextHops
 ELSE IF intersection of SourceMachine.SiteIdentifierList AND
 DestinationMachine.SiteIdentifierList in not empty THEN
    IF DestinationMachine.InRoutingServerIdentifierList is not empty THEN
       SET NextHops to DestinationMachine.InRoutingServerIdentifierList
    ELSE
       ADD DestinationMachine.Identifier to NextHops
    ENDIF
 ELSE
    INIT NextSite of type GUID
    INIT Entry of type RECORD of RoutingTable
  
    SET NextSite to Nothing
  
    FOREACH Entry FROM RoutingTable DO
       IF Entry.DestinationSiteID in
  DestinationMachine.SiteIdentifierList THEN
          SET NextSite = Entry.NextHopSiteID
       ENDIF
    END FOREACH
  
    IF NextSite <> Nothing THEN
       
       ADD the return of CALL GetSiteGateForSite(NextSite) to NextHops
  
    ENDIF
  
 ENDIF
  
 RETURN with NextHops