0001 TPENQUEUE(3)
0002 ============
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 tpenqueue, tpenqueueex - Enqueue message to persistent storage
0009
0010
0011 SYNOPSIS
0012 --------
0013 #include <atmi.h>
0014
0015 int tpenqueue (char *'qspace', char *'qname', TPQCTL *'ctl', char *'data', long 'len', long 'flags');
0016
0017 int tpenqueueex (short 'nodeid', short 'srvid', char *'qname', TPQCTL *'ctl', char *'data', long 'len', long 'flags');
0018
0019
0020 For XATMI client link with '-latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm'
0021
0022 For XATMI server link with '-latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm'
0023
0024 DESCRIPTION
0025 -----------
0026 Enqueue message to transactional message queue. Queue subsystem (see *tmqueue(8)*
0027 and *persistent_message_queues_overview(guides)*) must be configured before using
0028 this function. 'qspace' is queue space name (logical queue sub-system name,
0029 that can be shared between multiple *tmqueue* servers). 'qname' is queue name,
0030 'ctl' is control structure that contains various details for message, how it
0031 shall be enqueued. Also 'ctl' returns some diagnostics information. 'data'/'len'
0032 pair is XATMI buffer containing the message that must be enqueued. *tpenqueueex()*
0033 allows to specify exactly which *tmqueue* server will process the request,
0034 by giving the Enduro/X cluster node id in 'nodeid' field and 'srvid'
0035 from *ndrxconfig.xml(5).
0036
0037 Functions are transactional and can participate in user's global transaction.
0038 It is not possible to enqueue and dequeue message within same global transaction.
0039
0040 In case of error, global transaction (if associated with current thread) is marked for
0041 abort, except if *TPNOABORT* flag was specified or particular error code
0042 indicates that global transaction is not marked for abort.
0043
0044 *Valid flags*
0045
0046 *TPNOTRAN* Do not run the enqueue in the users global transaction.
0047 In this case *tmqueue(8)* will open it's own transaction, and will commit
0048 transaction upon return.
0049
0050 *TPSIGRSTRT* Restart the system call in progress if interrupted by signal handler.
0051 This affects only underlaying mq_* function calls.
0052
0053 *TPNOTIME* Ignore timeout setting (*NDRX_TOUT* env variable).
0054 Wait for reply for infinitely.
0055
0056 *TPNOBLOCK* In case of queue server request, if request IPC queue is full,
0057 do not wait on queue, but return error. The error code for this
0058 situation is *TPEBLOCK*. This affects only request part of the call.
0059 This flag does not affect waiting for response from the TMQ server.
0060
0061 *TPNOABORT* Do not abort global transaction, even if queue failed.
0062
0063 The *TPQCTL* structure is following:
0064
0065 --------------------------------------------------------------------------------
0066
0067 /* Queue support structure: */
0068 struct tpqctl_t
0069 {
0070 long flags; /* indicates which of the values are set */
0071 long deq_time; /* absolute/relative time for dequeuing */
0072 long priority; /* enqueue priority */
0073 long diagnostic; /* indicates reason for failure */
0074 char diagmsg[NDRX_QDIAG_MSG_SIZE]; /* diagnostic message */
0075 char msgid[TMMSGIDLEN]; /* id of message before which to queue */
0076 char corrid[TMCORRIDLEN];/* correlation id used to identify message */
0077 char replyqueue[TMQNAMELEN+1]; /* queue name for reply message */
0078 char failurequeue[TMQNAMELEN+1];/* queue name for failure message */
0079 CLIENTID cltid; /* client identifier for originating client */
0080 long urcode; /* application user-return code */
0081 long appkey; /* application authentication client key */
0082 long delivery_qos; /* delivery quality of service */
0083 long reply_qos; /* reply message quality of service */
0084 long exp_time; /* expiration time */
0085 };
0086 typedef struct tpqctl_t TPQCTL;
0087
0088 --------------------------------------------------------------------------------
0089
0090 Valid *'TPQCTL.flags'*
0091
0092 *TPNOFLAGS* No flags set.
0093
0094 *TPQCORRID* Use the correlator ID set in 'TPQCTL.corrid'.
0095 Note that each byte in 'corrid' is significant. When working with corrid, it
0096 establishes sub-queue for given 'qname'. The message ordering settings are kept
0097 the same as for queue definition. Several messages with the same corrid can be
0098 enqueued in the same or different queues.
0099
0100 *TPQREPLYQ* Use the 'replyqueue' for submitting response messages of services
0101 which were invoked for automatic queues. If this flag is set, with
0102 response buffer message will be enqueued to 'replyqueue'.
0103
0104 *TPQFAILUREQ* Send the message to 'failurequeue' if *tpcall()* for
0105 service invoke for automatic queues failed.
0106
0107 *TPQTIME_ABS* Use absolute time to process message in time specified in `TPQCTL.deq_time` field.
0108 The `TPQCTL.deq_time` fiel in absolute time format generated by *time()* function.
0109 `TPQCTL.deq_time` field is set in number of seconds since epoch (1970-01-01 00:00:00 +0000 (UTC)).
0110
0111 *TPQTIME_REL* Use relative time to process message delayed by time specified in `TPQCTL.deq_time` field.
0112 The `TPQCTL.deq_time` field value set in number of seconds to delay the message processing.
0113 *TPQTIME_ABS* and *TPQTIME_REL* are mutually exclusive.
0114
0115 Fields 'TPQCTL.priority', 'TPQCTL.urcode', 'TPQCTL.appkey',
0116 'TPQCTL.delivery_qos', 'TPQCTL.reply_qos', 'TPQCTL.exp_time' are reserved
0117 for future use. 'TPQCTL.cltid' is
0118 automatically set by Enduro/X system when passing message to *tmqueue* server.
0119
0120 RETURN VALUE
0121 ------------
0122 On success, *tpenqueue()* return 0; on error, -1 is returned, with
0123 *tperrno* set to indicate the error. Also 'TPQCTL.diagnostic' and
0124 'TPQCTL.diagmsg' will contain additional information.
0125
0126 ERRORS
0127 ------
0128 Note that *tpstrerror()* returns generic error message plus custom message
0129 with debug info from last function call.
0130
0131 *TPEINVAL* 'data' is NULL, 'qspace' is NULL, or 'nodeid' and 'srvid' is 0.
0132 Error can be generate in case if 'qname' is empty or NULL. 'ctl' is NULL or
0133 'data' does not point to *tpalloc()* allocated buffer. Global transaction is
0134 not marked for abort only, if one was associated with current thread.
0135
0136 *TPENOENT* *tmqueue(8)* server is not available. Global transaction is
0137 not marked for abort only, if one was associated with current thread.
0138
0139 *TPETIME* Service did not reply in given time ('NDRX_TOUT').
0140
0141 *TPEDIAGNOSTIC* More information is provided in 'TPQCTL.diagnostic' field.
0142
0143 *TPESVCFAIL* *tmqueue(8)* Service returned 'TPFAIL'. This is application level failure.
0144
0145 *TPESVCERR* *tmqueue(8)* service got system level failure. Server died during the
0146 message presence in service queue.
0147
0148 *TPESYSTEM* Enduro/X internal error occurred. See logs for more info.
0149
0150 *TPEOS* System failure occurred during serving. See logs i.e. user log, or
0151 debugs for more info.
0152
0153 *TPEBLOCK* XATMI IPC Service request queue was full and *TPNOBLOCK*
0154 flag was specified. Global transaction is not marked for abort only,
0155 if one was associated with current thread.
0156
0157 *TPETRAN* Failed to join global transaction.
0158
0159 *Values for 'TPQCTL.diagnostic'*
0160
0161 *QMEINVAL* Invalid request buffer / *TPQCTL*. Global transaction is
0162 not marked for abort only, if one was associated with current thread.
0163
0164 *QMEOS* Operating system problems. Might be insufficient memory.
0165
0166 *QMESYSTEM* Enduro/X internal problems. Might be issues with saving
0167 messages to disk.
0168
0169 *QMEBADQUEUE* Queue not defined and default (@) queue settings are not defined too.
0170 Global transaction is not marked for abort only, if one was associated with current thread.
0171
0172
0173 EXAMPLE
0174 -------
0175 See *atmitest/test028_tmq/atmiclt28.c* for sample code.
0176
0177 BUGS
0178 ----
0179 Report bugs to support@mavimax.com
0180
0181 SEE ALSO
0182 --------
0183 *tpdequeue(3)* *tpdequeueex(3)* *tmqueue(8)* *persistent_message_queues_overview(guides)*
0184
0185 COPYING
0186 -------
0187 (C) Mavimax, Ltd
0188