BEA Tuxedo Application Development notes

Source: Internet
Author: User

1. Create a customer program for BEA Tuxedo

The customer program for creating BEA Tuxedo is the same as creating other applications in C and C ++ programming languages. BEA Tuxedo provides a C programming interface, that is, the application transaction monitoring interface atmi, which is easy to use for developing customer programs and service programs. In addition to the C language interface, BEA Tuxedo also provides the COBOL interface.

The customer program generally performs the following tasks:

(1). Call tpchkauth () to determine the security level required to join an application. Possible responses include: no security level, application password, application authorization, access control list, connection-level encryption, public key encryption, and audit. These can be selected based on your needs;

(2) Call tpinit () to connect to a BEA Tuxedo application. The required security information is passed to the application as a tpinit () parameter;

(3) execute a service request;

(4). Call tpterm () to disconnect the BEA Tuxedo application.

2. Created service programs

Although developers use the atmi programming interface to create BEA Tuxedo client programs and service programs, not all service programs are written by developers. Developers only need to write some commercial functions called services, then, it associates with some BEA Tuxedo binaries to form an executable service program. After the BEA Tuxedo service program is started, it always keeps running until it receives a shutdown message. A typical BEA Tuxedo service program executes thousands of services before shutdown or reboot.

A Service generally performs the following tasks:

(1). When the BEA Tuxedo service program starts, run the tpsvrinit () function to open resources such as databases for future use;

(2) When the BEA Tuxedo service program is closed, run the tpsvrdown () function to disable the Information opened in tpsvrinit;

(3. the BEA Tuxedo service program responds to the request of the customer program in the form of a service. The customer program calls the service instead of calling the service program by name, the client program does not know the location of the service program that processes the request;

(4). The service program calls the tpreturn () function to end the service request and returns a buffer zone. If necessary, it passes it to the customer program;

3. Use the type buffer in the Application

All communication processes in BEA Tuxedo system are completed through the Type Buffer. BEA Tuxedo system provides a large number of type buffers for developers to use. All types of buffers must be allocated and recycled through the tpalloc (), tprealloc (), tpfree () atmi of BEA Tuxedo. They all have specific headers.

A uniformly defined type buffer can enable uniform processing between different networks, protocols, CPU architectures, and operating systems, this allows developers to effectively avoid the differences between heterogeneous networks and heterogeneous computer systems in a distributed computing environment, and focus on the development of business logic.

BEA Tuxedo system provides multiple communication modes:

(1). synchronous request/response mode;

(2) asynchronous request/response mode;

(3) nested call;

(4) call forwarding;

Listener. Session communication;

Notify. Active Message announcement;

Events. Event-based communication;

Queue. queue-based communication;

Transactions. Use transactions.

2. A simple tuxedo application simpapp

This chapter introduces a simple example of BEA Tuxedo. The simpapp written in C language contains a client program and a server. The server executes only one service: receiving lowercase letters from the client program, convert it into a large write and return it to the client program. Before using this example, you must install the C language compiler in the system.

Prepare the files and resources of the simpapp:

Before preparing the simpapp example, the BEA Tuxedo software must be installed in the system, and the $ tuxdir environment variable must be set. The value under the NT platform is % tuxdir %, add % tuxdir % bin to path, and make sure that your working directory has write permission. After completing these tasks, follow these steps to prepare the simpapp program:

(1). Copy all the files required by the simpapp. They are located in the $ tuxdir/samples/atmi/simpapp directory;

(2) Check and compile the customer program;

(3) Check and compile the service program;

(4). Edit and load the configuration file;

Startup. Start the application;

Runtime. Run the running application;

Runtime. Monitor the running application;

Disabled. Close the application.

After completing this example, you should understand the tasks executed by the customer program and the server, write a configuration file according to your environment, and check the application activity through tmadmin. At the same time, you should understand the basic components of BEA Tuxedo applications: customer programs, server programs, configuration files, and which commands of BEA Tuxedo system are used to manage your applications.

1. Copy the relevant files of the simpapp example.

(1). Create a directory:

Mkdir simpdir

CD simpdir

(2) Set and export environment variables

Tuxdir = BEA Tuxedo system root directory. For example, you can set it:

Tuxdir = "/usr/tuxedo", which can be set:

Tuxdir = "G: Program filesbea systemtuxedo"

Tuxconfig = Add/tuxconfig to the current working directory. For example, you can set it:

Tuxconfig = "/usr/ME/simpdir/tuxconfig", which can be set:

Tuxconfig = "G: simpdirtuxconfig"

Path = $ path: $ tuxdir/bin

LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ tuxdir/lib

Export tuxdir tuxconfig path LD_LIBRARY_PATH

Tuxdir and path are used to access BEA Tuxedo system files and execute commands. in Sun Solaris systems,/usr/5bin must be placed first in path and on AIx in rs6000, replace LD_LIBRARY_PATH with libpath, and replace LD_LIBRARY_PATH with shlib_path on the HP-UX in hp9000.

The purpose of setting tuxconfig is to load the configuration file.

(3) copy the simpapp file,

CP $ tuxdir/samples/atmi/simpapp /*.

(4). view files

$ Ls

Readme env simpapp. nt ubbmp wsimpcl

Readme. as400 setenv. CMD simpcl. c ubbsimple

Readme. nt simpapp. mk simpserv. c ubbws

File description:

Source code of simpcl. c client program

Source code of the simpserv. C service program

Ubbsimple application configuration file in plain text format

2. Check and compile the client program

(1). Check the customer Program

$ More simpcl. c

(2) Compile the client program

$ Buildclient-O simpcl-F simpcl. c

-O indicates the output target file name, and-F indicates the source file name.

3. Check and compile the Service Program

(1). Check service procedures

$ More simpserv. c

(2) Compile the server

$ Buildserver-O simpserv-F simpserv. C-s toupper

-S toupper indicates the service to be provided when the server is started.

4. Edit and add the configuration file

(1). How to edit the configuration file

(2) load the configuration file

$ Tmloadcf ubbsimple

Initialize tuxconfig file:/usr/ME/simpdir/tuxconfig [y, q]? Y

$

5. Start the application

(1) execute tmboot to start the application

$ Tmboot

Boot all admin and server processes? (Y/N): Y

Booting all admin and server processes in

/Usr/ME/simpdir/tuxconfig

Booting all admin processes ....

Exec BBL-:

Process id = 24223... started.

Booting server processes...

Exec simpserv-:

Process id = 24257... started.

2 processes started.

BBL is a management process that monitors the shared memory structure in applications. simpserv is a continuously running simpapp service program, waiting to process requests.

6. How to run the runtime Application

$ Simpcl "Hello, world"

Returned string is: Hello, world

8. How to close the application

(1). Run the tmshutdown command to close the application

(2) Check the ulog File

$ Cat ulog *

7. How to monitor runtime applications

As a manager, you can use the tmadmin command interpreter to detect an application and make some dynamic changes. To run this command, you must set the tuxconfig environment variable. Tmadmin can explain more than 50 commands. For the complete list, see tmadmin (1). Here we use two tadmin commands.

(1). Enter the following command:

$ Tmadmin

Display:

Tmadmin-copyright (c) 1999 BEA Systems, Inc. All rights

Reserved.

>

(2) enter the printserver (PSR) command, and the following command is displayed:

> SRS

A. Out name queue name GRP name ID rqdone load done current service

-------------------------------------------------------------------------------------

BBL 531993 simple 0 0 0 (idle)

Simpserv 00001.00001 group1 1 0 0 (idle)

(3) enter the printservice (PSC) command and display:

Service name routine name A. out name GRP name id machine # Done status

-----------------------------------------------------------------------------------------

Toupper simpserv group1 1 simple-avail

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.