Search code examples
biztalkbiztalk2006r2receive-location

Biztalk - can I change the receive port of an existing receive location?


I have two different receive ports and two receive locations - one location assigned to each port. The ports are set to receive the exact same type of file - I ended up with both because I consolidated two different applications that did the same thing.

I want to combine both locations into a single receive port, but I don't seem to be able to change the location that either belongs to - there's no option to do this that I can find. Essentially, I just want to take one location (either - I don't care), and assign it to the other port, so that one port has two locations and the other has none.

Does somebody know of a way to change the receive port of an existing location?


Solution

  • I resorted to the dark side, and updated the SQL table manually. I'd still welcome anybody who has a legitimate, supported way to do this, but to any others who need an answer, here's the script I wrote to fix this problem (no side-effects so far, though it's only been a day):

    DECLARE @AppName             VARCHAR(255),
            @ReceiveLocationName VARCHAR(255),
            @NewReceivePortName  VARCHAR(255)
    
    SET @AppName = 'Your application name'
    SET @ReceiveLocationName = 'Name of your existing receive location'
    SET @NewReceivePortName = 'Name of receive port to move location to'
    
    DECLARE @NewPortID INT
    DECLARE @ReceiveLocationID INT
    
    SELECT @NewPortID = rp.[nID]
      FROM [BizTalkMgmtDb].[dbo].[bts_application] a
      JOIN [BizTalkMgmtDb].[dbo].[bts_receiveport] rp
        ON a.nID = rp.nApplicationID
     WHERE a.nvcName = @AppName
       AND rp.nvcName = @NewReceivePortName
    
    SELECT @ReceiveLocationID = Id
      FROM [BizTalkMgmtDb].[dbo].[adm_receivelocation]
     WHERE Name = @ReceiveLocationName
    
    UPDATE [BizTalkMgmtDb].[dbo].[adm_receivelocation]
       SET ReceivePortId = @NewPortID,
           IsPrimary = 0
     WHERE Id = @ReceiveLocationID