Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 7 Using TIBCO Object Service Broker SDK (C/C++) : Sample Application Using the SDK (C/C++)

Sample Application Using the SDK (C/C++)
Compiling and Running the Sample Program
The sample program is available in the \install_folder\RemoteCLI\src folder.
In Windows
The Microsoft Visual C++ 6.0 compiler should be available. Microsoft provides a script file (VCVARS32.BAT) to initialize environment variables for the development environment. The following instructions assume that the OS_ROOT environment variable is initialized and the following directories exist:
1.
2.
CALL "msvc-install-bin\VCVARS32.BAT"
@REM Search in the standard TIBCO Object Service Broker libraries for '.h' files.
@REM Search in the standard TIBCO Object Service Broker libraries for unsatisfied external references.
@REM (The following is one command, appearing here on several lines for readability.)
CL    /I "%OS_ROOT%\RemoteCLI\INCLUDE"
      /I "%OS_ROOT%\EXTRC\INCLUDE"
      /I "%OS_ROOT%\SRC\ENCRYPT"
      /I "%OS_ROOT%\SRC\SECURITY"
      /nologo /TP
      /Fo"E:\obj\RCLISAMP.obj" "E:\src\RCLISAMP.cpp"
      /link /DEFAULTLIB:"%OS_ROOT%\RemoteCLI\LIB\OSCLI"
      /DEFAULTLIB:"%OS_ROOT%\EXTRC\LIB\OSEXTUSR"
      /out:"E:\bin\RCLISAMP.EXE"
3.
4.
5.
E:\bin\RCLISAMP CLIHOST=localhost,CLIPORT=9068
The parameter string “CLIHOST=localhost,CLIPORT=9068” contains no white space. Therefore it is passed to the program as a single parameter. The sample assumes that the PORT parameter supplied to the osMon process is defined as, or defaulted to, 9068.
In Solaris
The g++ compiler should be available in /usr/local/bin. The following instructions assume that the OS_ROOT environment variable is initialized and the following directories exist:
1.
2.
g++ -D_POSIX_C_SOURCE=199506L -U_XOPEN_SOURCE \
   -D_XOPEN_SOURCE -D__EXTENSIONS__ -D_REENTRANT \
   -I$OS_ROOT/RemoteCLI/include \
   -L$OS_ROOT/sharedlib \
   -loscli -losextusr -losscalar -loscs -losdobext \
   -losmisc -losmsgs -losencryp -lossecur -lsocket \
   -losbrand -lnsl -lpthread \
   -lrt \
   -o$HOME/bin/RCLISAMP \
   $HOME/src/RCLISAMP.cpp
3.
4.
5.
$HOME/bin/RCLISAMP CLIHOST=localhost,CLIPORT=8302
The parameter string “CLIHOST=localhost,CLIPORT=8032” contains no white space. Therefore it is passed to the program as a single parameter. The sample assumes that the PORT parameter supplied to the osMon process is defined as 8032.
Rule Called by C Program
This is a sample of a rule that creates an occurrence of the LOG TDS table, generates an end message, and returns a value. On completion of the rule, the changes are not committed because the transaction is still active. The SDK (C/C++) program explicitly stops the transaction by issuing STOPTR with a COMMIT flag or a ROLLBACK flag to indicate whether the changes are to be committed.

 
RULE EDITOR ===> SCROLL: P
TC007113RU02;
_
_ ---------------------------------------------------------------------------
_ ------------------------------------------------------------+--------------
_ TC007113TA01.TEXT = 'RULE "TC007113RU02" IS CALLED'; ¦ 1
_ INSERT TC007113TA01; ¦ 2
_ CALL ENDMSG('END MESSAGE GENERATED BY RULE "TC007113RU02"');¦ 3
_ RETURN('RETURN VALUE OF RULE "TC007113RU02"'); ¦ 4
_ ---------------------------------------------------------------------------
_

 
Table Referenced by a Rule
The table TC007113TA01 is defined as follows:

 
COMMAND==> TABLE DEFINITION
Table: TC007113TA01 Type: TDS Unit: TC07113 IDgen: Y
Source:
Parameter Name Typ Syn Len Dec Class ' Event Rule Typ Acc
---------------- - - --- -- - ' ---------------- - -
_ LOCATION I C 16 0 L ' _
_ ' _
Field Name Typ Syn Len Dec Key Ord Rqd Default Reference
---------------- - - ---- -- - - - ---------------- ----------------
_ KEY I B 4 0 P
_ TEXT S C 50 0
_
_
_
_
_
_
_
_
_
_
PFKEYS: 3=END 12=CANCEL 22=DELETE 13=PRINT 14=FIELDS 21=DATA 2=DOC
New table definition

 
Output from C Program
The output from the C program is as follows:
STARTSS completed. Session User ID = HURON1
STARTTR completed.
CALLRULE completed, return value: 'RETURN VALUE OF RULE "TC007113RU002"'
Rule end message: 'END MESSAGE GENERATED BY RULE "TC007113RU002"'
STOPTR completed.
STOPSS completed.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved