2.5.2 Configuring Factory-based Routing in the UBBCONFIG File

The University Production sample application demonstrates how to implement factory-based routing. The INTERFACES, ROUTING, and GROUPS sections from the ubb_b.nt configuration file show how you can implement factory-based routing in an Oracle Tuxedo CORBA application. You can find the ubb_p.nt or ubb_p.mk UBBCONFIG files for this sample in the directory where the Oracle Tuxedo software is installed (see the \samples\corba\university\production subdirectory).

The UBBCONFIG file must specify the following data in the INTERFACES and ROUTING sections, as well as how groups and machines are identified.

  1. The INTERFACES section lists the names of the interfaces for which you want to enable factory-based routing. For each interface, this section specifies the kinds of criteria on which the interface routes. This section specifies the routing criteria via an identifier, FACTORYROUTING, as shown in the following code snippet.
    INTERFACES
    "IDL:beasys.com/UniversityP/Registrar:1.0"
    FACTORYROUTING = STU_ID
    "IDL:beasys.com/BillingP/Teller:1.0"
    FACTORYROUTING = ACT_NUM

    The following listing shows the fully qualified interface names for the two interfaces in the Production sample in which factory-based routing is used. The FACTORYROUTING identifier specifies the names of the routing values, which are STU_ID and ACT_NUM, respectively.

  2. The ROUTING section specifies the parameters in the following table for each routing value.

    Table 2-1 Parameters Specified in the ROUTING Section

    Parameter Description
    TYPE Specifies the type of routing. In the Production sample, the type of routing is factory-based routing. Therefore, this parameter is defined as FACTORY.
    FIELD Specifies the variable name that the factory inserts in the routing value. In the Production sample, the field parameters are student_id and account_number, respectively.
    FIELDTYPE Specifies the data type of the routing value. In the Production sample, the field types for student_id and account_number are long.
    RANGES Specifies the values that are routed to each group.

    The following code snippet shows the ROUTING section of the UBBCONFIG file used in the Production sample application.

    ROUTING
        STU_ID
            FIELD     = "student_id"
            TYPE      = FACTORY
            FIELDTYPE = LONG
            RANGES    = "100001-100005:ORA_GRP1,100006-100010:ORA_GRP2"
        ACT_NUM
            FIELD     = "account_number"
            TYPE      = FACTORY
            FIELDTYPE = LONG
            RANGES    = "200010-200014:APP_GRP1,200015-200019:APP_GRP2"
    The following listing shows that Registrar object references for students with IDs in one range are routed to one server group, and Registrar object references for students with IDs in another range are routed to another group. Likewise, Teller object references for accounts in one range are routed to one server group, and Teller object references for accounts in another range are routed to another group.
  3. The groups specified by the RANGES identifier in the ROUTING section of the UBBCONFIG file need to be identified and configured. For example, the Production sample specifies four groups: APP_GRP1, APP_GRP2, ORA_GRP1, and ORA_GRP2. These groups need to be configured, and the machines on which they run need to be identified.
    The following code snippet shows the GROUPS section of the Production sample UBBCONFIG file, in which the ORA_GRP1 and ORA_GRP2 groups are configured. Notice how the names in the GROUPS section match the group names specified in the RANGES parameter in the ROUTING section. This is critical for factory-based routing to work correctly. Furthermore, any change in the way groups are configured in an application must be reflected in the ROUTING section. (

    Note:

    The Production sample packaged with the Oracle Tuxedo software is configured to run entirely on one machine. However, you can easily configure this application to run on multiple machines.)
    *GROUPS
        APP_GRP1
            LMID      = SITE1
            GRPNO     = 2
            TMSNAME   = TMS
        APP_GRP2
            LMID      = SITE1
            GRPNO     = 3
            TMSNAME   = TMS
        ORA_GRP1
            LMID      = SITE1
            GRPNO     = 4
            OPENINFO = "ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SesTm=100+LogDir=.+MaxCur=5"
            CLOSEINFO = ""
            TMSNAME   = "TMS_ORA"
        ORA_GRP2
            LMID      = SITE1
            GRPNO     = 5
    OPENINFO = "ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SesTm=100+LogDir=.+MaxCur=5"
            CLOSEINFO = ""
            TMSNAME   = "TMS_ORA"