Accessing IBM I data queues using IBM Java Toolbox for I

Source: Internet
Author: User
Tags message queue

Process communication is a very important part of the operating system kernel. For IBM i, data queues are a very important way of process communication. On the one hand, data queues are powerful, are not limited by programming languages, and can simultaneously support synchronous communication and asynchronous communication between processes. On the other hand, data queues are flexible and their data messages are not tied to any format, in other words, users can customize the data format according to business requirements. As the IBM I Java application programming interface, IBM Java Toolbox for I supports operations related to IBM I data queues so that communication between Java applications and other IBM I programs, such as C,rpg,cobol programs, becomes simple and easy. The goal of this article is to instruct readers how to use IBM Java Toolbox for I to implement process communication based on IBM I data queues from a programming-oriented perspective. For a basic knowledge of IBM Java Toolbox for I, see another technical document "Toolbox for Java and Jtopen."

From the structure, this article mainly divides into 3 parts. The 1th part briefly introduces the basics of data queuing, including the basic concepts of data queues, how they work, how they are used, and how they differ from other modes of communication. Part 2nd focuses on the IBM Java Toolbox for I programming support for data queues. In this section, we will combine producer and consumer problem-related examples to instruct readers how to use IBM Java Toolbox for I to complete interprocess communication. The last part is the summary.

The sample in this paper mainly consists of two parts. The 1th part is the IBM I data queue related basic operations, including queue creation, team, outbound, empty queue, queue deletion total 5 kinds. The 2nd part is a progressive chapter, which realizes the prototype of the producer and the consumer. Among them, the task of the producer process is to continuously add products to the product queue, while the consumer has been in the listening state, as long as the queue is not empty, the product is taken from the queue.

How IBM i data queues work

Unlike Unix,window, IBM I is an object-oriented operating system. From this perspective, the data queue is a system object, and the corresponding type is *dtaq. The IBM I data queue is designed to provide an efficient way of process communication.

Narrowly speaking, queues are a first-in, first-out (or FIFO) data structure, as shown in Figure 1. It only allows the delete operation (called the outbound team) to be performed on the enemy, and the insertion at the end of the team (the queue).

Figure 1. How the queues work

A column is a generalized queue, or it is a variant of queues and queues. IBM I supports 3 types of data queues according to the outbound strategy of the data queue:

Advanced First Out (or FIFO)-the first (oldest) queue message, where the team first comes out. This is equivalent to the narrow-sense FIFO queue.

Advanced (or LIFO)-the last (latest) queue message, which is the first team to start out. It is actually a stack structure.

Team out by index-each queue message corresponds to an index. Queue messages that match the index rules are out of line. Among them, the rules indexed by index include operator =,>,>=,<,<= and so on.

In addition to data queues, IBM I also supports a variety of other data storage objects, including database files, message queues, data areas, user space, and so on. But they are used in a different way than the application scenario. The main target of the data queue is process communication, the format of queue message is unrestricted, the user can be defined according to business requirement freely; The database file's service object is database related additions and deletions, the data record has strict data format; Message Queuing stores an IBM i message, The message queue itself does not have the data structure of the queue; The data area object has a limited storage space and is typically used to store shared data between IBM I jobs; user-space objects are typically used to store user-defined information to facilitate the sharing of data between processes.

Related Article

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.