Ask the Expert

Data queue from Java

How does one address a data queue from Java?

Here's a sample code:

 
         // Access an existing non-empty data queue 
         KeyedDataQueue dq = new KeyedDataQueue(systemObject_, "/QSYS.LIB/MYLIB.LIB/MYDQ.DTAQ"); 
         // Create a metadata object. 
         ListMetaData metaData = new ListMetaData(2); 
         
         // Set first column to be the customer ID. 
         metaData.setColumnName(0, "Customer ID"); 
         metaData.setColumnLabel(0, "Customer ID"); 
         metaData.setColumnType(0, RowMetaDataType.STRING_DATA_TYPE); 
         
         // Set second column to be the order to be processed. 
         metaData.setColumnName(1, "Order Number"); 
         metaData.setColumnLabel(1, "Order Number"); 
         metaData.setColumnType(1, RowMetaDataType.STRING_DATA_TYPE); 
         
         // Create a ListRowData object. 
         ListRowData rowData = new ListRowData(); 
         rowData.setMetaData(metaData); 
         
         // Get the entries off the data queue. 
         KeyedDataQueueEntry data = dq.read(key, 0, "EQ"); 
         while (data != null) 
         { 
            // Add queue entry to row data object. 
            Object[] row = new Object[2]; 
            row[0] = new String(key); 
            row[1] = new String(data.getData()); 
            rowData.addRow(row); 
            // Get another entry from the queue. 
            data = dq.read(key, 0, "EQ"); 
         } 
// finish program here *** 

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.


This was first published in July 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: