Share this page

# lrt_tpenqueue

Communication Functions

Stores a message in the queue.

int lrt_tpenqueue( char *qspace, char *qname, TPQCTL *ctl, char *data, long len, long flags );

qspace | Queue space.
qname | Queue name.
ctl | Additional information about queueing the message, for example overriding the default message placement.
data | Pointer to the message buffer.
len | Length of the message.
flags | Valid flags: TPNOTRAN- if caller is in transaction mode and this flag is set, the message is not enqueued within the same transaction, TPNOBLOCK - request not sent if blocking condition exists, TPNOTIME - caller immune to blocking timeouts, TPSIGRSTRT - any interrupted system calls are re-issued after lrt_tpenqueue.

The lrt_tpenqueue function stores a message for processing on the queue specified by qname.

## Return Values

If lrt_tpenqueue ends successfully, the function returns NULL. If the function ends with an error, it returns -1 and sets the error code in tperrno.

## Parameterization

The following argument(s) can be parameterized using standard parameterization: qspace, qname

## Example

In the following example data is put on a queue with an application defined user code, the code is read, and the message is taken off the queue.

Copy code

    TPQCTL         qCtrl;     /* Control structure needed to reference item on queue */
                    long         myAppcURCode;        /* Application defined return code */
                    long         myRecovedURCode;    /* To read the UR Code */
                    int         rc;             /* return code */
                    char         * myQSpace;            /* Name of queue space */
                    char         * myQName;             /* Name of queue */
                    char         * myDataPtr;             /* The data */
                    long         myDataLen;            /* Length */
                        myQSpace = "qspace";
                        myQName = "qname";
                        myDataPtr = lrt_tpalloc("STRING", "", 100);
                        strcpy(myDataPtr, "theData");
                        myAppcURCode = 100;
                        /* Put an application defined user code in the control structure */
                        qCtrl.urcode = myAppcURCode;
                        /* Put the data and control structure on a queue */
                        rc = lrt_tpenqueue( myQSpace,
                                            myQName,
                                            &qCtrl,
                                            myDataPtr,
                                            myDataLen,
                                            TPNOTRAN);
                        /* Recover the application defined user code */
                        myRecovedURCode = lrt_gettpurcode ();
                        /* Take the message off the queue by using the same control structure */
                        rc =  lrt_tpdequeue( myQSpace,
                                            myQName,
                                            &qCtrl,
                                            &myDataPtr,
                                            &myDataLen,
                                TPNOTRAN );

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: