3.4.5.2.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 receiving Connection is set to Idle:

    • Set the State field of the Connection to Processing Open Request.

  • Otherwise:

    • The message MUST be processed as an invalid message as specified in section 3.1.6; the implementation SHOULD perform no further processing of the message.

  • 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.<49>

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

  • If all the conditions are met:

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

    • If successful:

      • Call xa_open on the XA Switch of the XA Resource Manager object with the following arguments:

        • DSN field of the message.

        • Randomly generated integer.

        • TMNOFLAGS.

      • If the outcome of the call to xa_open is set to XA_OK:

        • Call xa_close on the XA Switch with the following arguments:

          • DSN field of the message.

          • Previously generated Resource Manager Identifier.

          • TMNOFLAGS.

        • If the outcome of the call to xa_close is set to XA_OK:

          • 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 is set to the randomly generated Resource Manager Identifier.

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

            • The State field is set to Idle.

            • The XA Switch is set to loaded XA Switch.

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

            • The Single Pipe field is set to TRUE.

            • 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 new XA Resource Manager.

            • Attempt to write the new XA Resource Manager to the XA Resource Manager Durable Log.

            • If successful:

              • Set the State of Connection to Active.

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

                • localRmId set to the XA Resource Manager Identifier of the created XA Resource Manager.

                • guidRm set to the Resource Manager Global Identifier of the created XA Resource Manager.

            • Otherwise:

          • Otherwise:

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

            • Set the State of the receiving connection to Ended.

        • Otherwise:

          • Send an XATMUSER_MTAG_E_RMOPENFAILED message on the receiving connection.

          • Set the State of the receiving connection to Ended.

      • Otherwise:

        • Send an XATMUSER_MTAG_E_RMOPENFAILED message on the receiving connection.

        • Set the State of the receiving connection to Ended.

    • Otherwise:

      • Send an XATMUSER_MTAG_E_RMOPENFAILED message on the receiving connection.

      • Set the State of the receiving connection to Ended.

  • Otherwise, the message MUST be processed as an invalid message, as specified in section 3.1.6.