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.
- The
INTERFACESsection 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_NUMThe following listing shows the fully qualified interface names for the two interfaces in the Production sample in which factory-based routing is used. The
FACTORYROUTINGidentifier specifies the names of the routing values, which areSTU_IDandACT_NUM, respectively. - The
ROUTINGsection specifies the parameters in the following table for each routing value.Table 2-1 Parameters Specified in the ROUTING Section
Parameter Description TYPESpecifies the type of routing. In the Production sample, the type of routing is factory-based routing. Therefore, this parameter is defined as FACTORY.FIELDSpecifies the variable name that the factory inserts in the routing value. In the Production sample, the field parameters are student_idandaccount_number, respectively.FIELDTYPESpecifies the data type of the routing value. In the Production sample, the field types for student_idandaccount_numberarelong.RANGESSpecifies the values that are routed to each group. The following code snippet shows the
ROUTINGsection of theUBBCONFIGfile used in the Production sample application.
The following listing shows thatROUTING 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"Registrarobject references for students with IDs in one range are routed to one server group, andRegistrarobject references for students with IDs in another range are routed to another group. Likewise,Tellerobject references for accounts in one range are routed to one server group, andTellerobject references for accounts in another range are routed to another group. - The groups specified by the
RANGESidentifier in theROUTINGsection of theUBBCONFIGfile need to be identified and configured. For example, the Production sample specifies four groups:APP_GRP1,APP_GRP2,ORA_GRP1, andORA_GRP2. These groups need to be configured, and the machines on which they run need to be identified.The following code snippet shows theGROUPSsection of the Production sampleUBBCONFIGfile, in which theORA_GRP1andORA_GRP2groups are configured. Notice how the names in theGROUPSsection match the group names specified in theRANGESparameter in theROUTINGsection. 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 theROUTINGsection. (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"
Parent topic: Scaling with Factory-based Routing