Q

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

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

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:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close