ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/dtaq.htm

110 lines
6.4 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Data queues" />
<meta name="abstract" content="The DataQueue classes allow the Java program to interact with server data queues." />
<meta name="description" content="The DataQueue classes allow the Java program to interact with server data queues." />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="dtaq" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Data queues</title>
</head>
<body id="dtaq"><a name="dtaq"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Data queues</h1>
<div><p>The DataQueue classes allow the Java™ program to interact with server data
queues. </p>
<div class="section"><p>Data queues on iSeries™ servers have the following characteristics:</p>
<ul><li>The data queue allows for fast communications between jobs. Therefore,
it is an excellent way to synchronize and pass data between jobs.</li>
<li>Many jobs can simultaneously access the data queues.</li>
<li>Messages on a data queue are free format. Fields are not required as they
are in database files.</li>
<li>The data queue can be used for either synchronous or asynchronous processing.</li>
<li>The messages on a data queue can be ordered in one the following ways:
<ul><li>Last-in first-out (LIFO). The last (newest) message that is placed on
the data queue is the first message that is taken off the queue.</li>
<li>First-in first-out (FIFO). The first (oldest) message that is placed on
the data queue is the first message that is taken off the queue.</li>
<li>Keyed. Each message on the data queue has a key associated with it. A
message can be taken off the queue only by specifying the key that is associated
with it.</li>
</ul>
</li>
</ul>
<p>The data queue classes provide a complete set of interfaces for accessing
server data queues from your Java program. It is an excellent way to
communicate between Java programs and programs on the server
that are written in any programming language.</p>
<p>A required parameter of
each data queue object is the <a href="javadoc/com/ibm/as400/access/AS400.html#NAVBAR_TOP">AS400</a> object that represents the server that has the
data queue or where the data queue is to be created.</p>
<p>Using the data
queue classes causes the AS400 object to connect to the server. See <a href="mngcon.htm#mngcon">managing connections</a> for information about
managing connections.</p>
<p>Each data queue object requires the integrated
file system path name of the data queue. The type for the data queue is DTAQ.
See <a href="ifspath.htm#ifspath"> integrated file system path names</a> for
more information. </p>
</div>
<div class="section" id="dtaq__sequentialandkeyeddataqueues"><a name="dtaq__sequentialandkeyeddataqueues"><!-- --></a><h4 class="sectiontitle">Sequential and keyed data
queues</h4><p>The data queue classes support the following data queues:</p>
<ul><li><a href="dtaqseq.htm#dtaqseq">Sequential data queues</a></li>
<li><a href="dtaqkey.htm#dtaqkey">Keyed data queues</a></li>
</ul>
<p>Methods common to both types of queues are in the <a href="javadoc/com/ibm/as400/access/BaseDataQueue.html#NAVBAR_TOP">BaseDataQueue</a> class.
The <a href="javadoc/com/ibm/as400/access/DataQueue.html#NAVBAR_TOP"> DataQueue</a> class extends the BaseDataQueue class in order
to complete the implementation of sequential data queues. The BaseDataQueue
class is extended by the <a href="javadoc/com/ibm/as400/access/KeyedDataQueue.html#NAVBAR_TOP"> KeyedDataQueue</a> class to complete the implementation
of keyed data queues.</p>
<p>When data is read from a data queue, the data
is placed in a <a href="javadoc/com/ibm/as400/access/DataQueueEntry.html#NAVBAR_TOP"> DataQueueEntry</a> object. This object holds the data for
both keyed and sequential data queues. Additional data available when reading
from a keyed data queue is placed in a <a href="javadoc/com/ibm/as400/access/KeyedDataQueueEntry.html#NAVBAR_TOP"> KeyedDataQueueEntry</a> object that extends the DataQueueEntry
class.</p>
<p>The data queue classes do not alter data that is written to or
is read from the server data queue. The Java program must correctly format the data.
The <a href="dtad.htm#dtad">data conversion classes</a> provide methods
for converting data.</p>
</div>
<div class="section" id="dtaq__dqex1"><a name="dtaq__dqex1"><!-- --></a><h4 class="sectiontitle">Example: Using DataQueue and DataQueueEntry</h4><div class="p">The
following example creates a DataQueue object, reads data from the DataQueueEntry
object, and then disconnects from the system. <div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm#codedisclaimer">Code
example disclaimer</a> for important legal information.</div>
</div>
<pre> // Create an AS400 object
AS400 sys = new AS400("mySystem.myCompany.com");
// Create the DataQueue object
DataQueue dq = new DataQueue(sys, "/QSYS.LIB/MYLIB.LIB/MYQUEUE.DTAQ");
// read data from the queue
DataQueueEntry dqData = dq.read();
// get the data out of the DataQueueEntry object.
byte[] data = dqData.getData();
// ... process the data
// Disconnect since I am done using data queues
sys.disconnectService(AS400.DATAQUEUE);</pre>
</div>
</div>
</body>
</html>