3.4.5.1.1 Receiving an XATMUSER_MTAG_RMOPEN Message

When the XA Resource Manager Bridge Facet receives an XATMUSER_MTAG_RMOPEN message (section 2.2.3.2.5), it MUST perform the following actions:

  • If the State field of the receiving Connection is set to Idle:

    • Set the State field of the receiving Connection to Processing Open Request (section 3.4.1.1.2).

  • Otherwise:

    • The message MUST be processed as an invalid message as specified in section 3.1.6 and processing of this message halted.

  • Test if all of the following conditions are satisfied:

    • SHOULD check if the lenDSN field of the message is less than an implementation-specific value.<44>

    • SHOULD check if the lenXaDll field of the message is less than an implementation-specific value.<45>

  • If all the conditions are met:

    • Attempt to find an XA Resource Manager object in the XA Resource Manager Table that meets the following conditions:

      • The Data Source Name field is set to the value of the DSN field of the message.

    • If an XA Resource Manager object is found:

      • If the State field of the found XA Resource Manager object is set to Recovering:

        • Set the XA Resource Manager object referenced by the receiving connection to the located XA Resource Manager object.

        • Increment the Call Count field of the XA Resource Manager object.

        • Add the receiving connection to the Pending Open Connections Table referenced by the located XA Resource Manager object.

        • Set the state of the receiving connection to Active.

      • Otherwise, if the State field of XA Resource Manager object is set to Active:

        • If the Call Count field of the XA Resource Manager object is greater than 0:

          • Increment the Call Count field of the XA Resource Manager object.

          • Set the State field of the Connection to Active.

          • Add the receiving connection to Request Connections Table referenced by the found XA Resource Manager object.

          • Set the XA Resource Manager object of the receiving connection to the located XA Resource Manager object.

          • Send an XATMUSER_MTAG_RMOPENOK message (section 2.2.3.2.6) on the receiving connection with the following settings:

            • localRmId is set to the XA Resource Manager Identifier field of the located XA Resource Manager object.

            • guidRm is set to the Resource Manager Global Identifier field of the located XA Resource Manager object.

        • Otherwise:

          • Send an XATMUSER_MTAG_RMNONEXISTENT message (section 2.2.3.2.1) on the receiving connection.

          • Set the connection state to Ended.

      • Otherwise:

        • Send an XATMUSER_MTAG_E_RMNOTAVAILABLE message (section 2.2.3.2.2) on the receiving connection.

        • Set the connection state to Ended.

    • Otherwise:

      • Attempt to load XA Switch for XA Resource Manager using the XaDllFileName field of the message:

      • If successful:

        • Attempt to create a new XA Resource Manager object with the following values:

          • The Resource Manager Global Identifier field is set to newly created GUID.

          • The XA Resource Manager Identifier field is set to the value of the incremented XA Resource Manager Identifier Index.

          • The Data Source Name field is set to the DSN field of the message.

          • The State field is set to Idle.

          • The XA Switch set to loaded XA Switch.

          • The Recovery Interval field SHOULD be set to XaTmMinWarmRecoveryInterval.<46>

          • The Single Pipe field set to FALSE.

          • The Call Count field is set to 1.

          • The XA DLL Name field is set to the XaDllFileName field of the message.

        • If successful:

          • Set the XA Resource Manager of the receiving connection to the created XA Resource Manager object.

          • Call xa_open function on the XA Switch referenced by the new XA Resource Manager object with the following arguments:

            • Data Source Name of the created XA Resource Manager object.

            • XA Resource Manager Identifier of the created XA Resource Manager object.

            • TMNOFLAGS.

          • If the outcome is set to XA_OK:

            • Write the created XA Resource Manager object to the XA Resource Manager Durable Log.

            • Add the created XA Resource Manager object to the XA Resource Manager Table referenced by the XA Resource Manager Bridge Facet.

            • Set the State field of the XA Resource Manager object to Active.

            • Add receiving connection to Request Connections Table referenced by the XA Resource Manager object.

            • Set the State of Connection to Active.

            • Send an XATMUSER_MTAG_RMOPENOK message on the receiving connection with the following arguments:

              • The XA Resource Manager Identifier field of the created XA Resource Manager.

              • The Resource Manager Global Identifier field of the created XA Resource Manager.

          • Otherwise if outcome is set to XAER_PROTO:

            • Set the State field of the created XA Resource Manager object to Ended.

            • Send an XATMUSER_MTAG_E_RMPROTOCOL message (section 2.2.3.2.4) on the receiving connection.

            • Set the connection state to Ended.

          • Otherwise:<47>

            • Set the State field of the created XA Resource Manager object to Ended.

            • Send an XATMUSER_MTAG_E_RMOPENFAILED message (section 2.2.3.2.3) on the receiving connection.

            • Set connection state to Ended.

        • Otherwise:

          • Send an XATMUSER_MTAG_E_RMOPENFAILED message using the receiving connection.

          • Set connection state to Ended.

      • Otherwise:

        • Send an XATMUSER_MTAG_E_RMOPENFAILED message using the receiving connection.

        • Set connection state to Ended.

  • Otherwise:

    • XA Resource Manager Bridge Facet MAY:<48>

      • Send an XATMUSER_MTAG_E_RMOPENFAILED message (section 2.2.3.2.3) using the receiving connection.

      • Set the connection state to Ended.

Show: