BEA Logo BEA MessageQ Release 5.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   MessageQ Doc Home   |   Reference Manual   |   Previous Topic   |   Next Topic   |   Contents   

MessageQ/TUXEDO Bridge Functions

 

TMQUEUE_BMQ

Name

TMQUEUE_BMQ - MessageQ / TUXEDO Messaging Bridge Server

Synopsis

TMQUEUE_BMQ
SRVGRP="identifier"
SRVID="number" CLOPT=" [ -A ] [ servopts options ] --
[-b bmq_bus_id] [-g bmq_group_id] [-t timeout]
[-U user] [-G group] [-E errorqueuename]"

Description

The MessageQ / TUXEDO messaging bridge manager is a System/T-supplied server that enqueues and dequeues messages from BEA MessageQ queues on behalf of programs calling tpenqueue(3c) and tpdequeue(3c), respectively. The server also performs the required data and semantic transformations between MessageQ and TUXEDO. The application administrator enables message enqueuing and dequeuing for the application by specifying this server as an application server in the *SERVERS section of the BEA TUXEDO ubbconfig file.

Messages originating from BEA TUXEDO have the MessageQ class of MSG_CLAS_TUXEDO. Reply messages from BEA TUXEDO have either the MessageQ class of MSG_CLAS_TUXEDO_TPSUCCESS or MSG_CLAS_TUXEDO_TPFAIL.

The location, server group, server identifier and other generic server related parameters are associated with the server using the already defined configuration file mechanisms for servers. The following is a list of additional command line options that are available for customization:

-b bmq_bus_id

The MessageQ bus with which the server communicates. The bmq_bus_id option is used instead of the DMQ_BUS_ID environment variable.

-g bmq_group_id

The MessageQ group with which the server communicates. The bmq_group_id option is used instead of the DMQ_GROUP_ID environment variable.

-t timeout

The time in seconds at which an operation specified with flags:TPNOTIME will timeout. If no value is specified, the default value is 60 seconds.This option provides consistency with the transaction timeout in TUXEDO.

-U user

The user name or user identification number (UID) for all messages handled by TMQUEUE_BMQ. The user argument is used for access control list (ACL) checks when security is configured for a TUXEDO application.

-G group

The group name or group identification number (GID) for all messages handled by TMQUEUE_BMQ. The group argument is used for access control list (ACL) checks when security is configured for a TUXEDO application.

If the TUXEDO default security mechanism is used, and the user option is specified as a user name, the group option is not required and should not be specified.

-E errorqueuename

The name of the MessageQ error queue. Each MessageQ group includes a reserved queue (queue 97) which is used to store error messages. Specifying the errorqueuename option allows BEA TUXEDO and BEA M3 applications and processes to address the error queue by name.

The TMQUEUE_BMQ server must be located on the same physical machine as the BEA MessageQ group from which it dequeues messages. The machine must be configured to run servers on behalf of a BEA TUXEDO application. TMQUEUE_BMQ may enqueue messages to any queue on any machine in the MessageQ group as long as a path exists between the group to which TMQUEUE_BMQ is attached and the target group.

A TMQUEUE_BMQ server is booted as part of a TUXEDO application to facilitate application access to its associated MessageQ bus and group. Any configuration condition that prevents the TMQUEUE_BMQ server from initiating its services will cause TMQUEUE_BMQ to fail at boot time with an error posted to the BEA TUXEDO user log (ULOG) file.

EXAMPLES

*GROUPS
TMQUEUE_BMQGRPHQMGR GRPNO=1
TMQUEUE_BMQGRPHQPLEBE GRPNO=2
TMQUEUE_BMQGRPREMOTENA GRPNO=3
TMQUEUE_BMQGRPREMOTEEUROPE GRPNO=4

*SERVERS
TMQUEUE_BMQ SRVGRP="TMQUEUE_BMQGRPHQMGR" SRVID=1000 RESTART=Y
GRACE=0 CLOPT="-s Payroll:TMQUEUE_BMQ -s
Promote:TMQUEUE_BMQ -- -b 5 -g 7"
TMQUEUE_BMQ SRVGRP="TMQUEUE_BMQGRPHQPLEBE" SRVID=1000 RESTART=Y
GRACE=0 CLOPT="-s Payroll:TMQUEUE_BMQ -s
Promote:TMQUEUE_BMQ -- -b 5 -g 10"
TMQUEUE_BMQ SRVGRP="TMQUEUE_BMQGRPREMOTENA" SRVID=2002 RESTART=Y
GRACE=0 CLOPT="-s Sales:TMQUEUE_BMQ -- -b 5 -g 42"
TMQUEUE_BMQ SRVGRP="TMQUEUE_BMQGRPREMOTEEUROPE" SRVID=2002
RESTART=Y GRACE=0 CLOPT="-s Sales:TMQUEUE_BMQ -- -b 12 -g 53"

*SERVICES
Payroll ROUTING="SALARYROUTE"
Payroll ROUTING="HAIRCOLORROUTE"

*ROUTING
SALARYROUTE FIELD=Salary BUFTYPE="FML32"
RANGES="MIN - 50000:TMQUEUE_BMQGRPPLEBE,50001
-MAX:TMQUEUE_BMQGRPHQMGR"
HAIRCOLORROUTE FIELD=Hair BUFTYPE="FML32"
RANGES="`Gray':TMQUEUE_BMQGRPHQMGR,*:TMQUEUE_BMQGRPPLEBE"

SEE ALSO

ubbconfig(5), servopts(5), buildserver(1), tpenqueue(3c), tpdequeue(3c), TMQFORWARD_BMQ(5), BEA TUXEDO Administrator's Guide, BEA TUXEDO Programmer's Guide, BEA MessageQ Introduction to Message Queueing, BEA MessageQ Programmer's Guide

TMQFORWARD_BMQ

Name

TMQFORWARD_BMQ - MessageQ / TUXEDO Forwarding Agent Server

Synopsis

TMQFORWARD_BMQ
SRVGRP="identifier"
SRVID="number" REPLYQ=N CLOPT=" [ -A ] [ servopts options ] --
-q queuename[,queuename] [-b bmq_bus_id] [-g bmq_group_id]
[-t timeout] [-i idletime] [-d] [-f delay][-U uid] [-G gid]
[-E errorqueuename] [-R retries]"

Description

The MessageQ / TUXEDO forwarding agent is a BEA TUXEDO managed server that forwards messages to BEA TUXEDO services from BEA MessageQ queues. The messages are placed on a BEA MessageQ queue using either pams_put_msg or tpenqueue. The server also performs the required data and semantic transformations between MessageQ and TUXEDO. The application administrator enables message processing for the application by specifying this server as an application server in the *SERVERS section of the BEA TUXEDO ubbconfig file.

Messages originating from BEA TUXEDO have the MessageQ class of MSG_CLAS_TUXEDO. Reply messages from BEA TUXEDO have either the MessageQ class of MSG_CLAS_TUXEDO_TPSUCCESS or MSG_CLAS_TUXEDO_TPFAIL.

The location, server group, server identifier and other generic server related parameters are associated with the server using the already defined configuration file mechanisms for servers. Note that REPLYQ=N must be specified, as shown in the synopsis. The following is a list of additional command line options that are available for customization:

-q queuename[,queuename]

The names of one or more queues for which TMQFORWARD_BMQ forwards messages.

-b bmq_bus_id

The MessageQ bus with which the server communicates. The bmq_bus_id option is used instead of the DMQ_BUS_ID environment variable.

-g bmq_group_id

The MessageQ group with which the server communicates. The bmq_group_id option is used instead of the DMQ_GROUP_ID environment variable.

-t timeout

The time in seconds at which an operation specified with flags:TPNOTIME will timeout. If no value is specified, the default value is 60 seconds.This option provides consistency with the transaction timeout in TUXEDO.

-i idletime

The time that the server is idle after draining the queue(s) that it is reading. A value of zero indicates that the server will continually read the queue(s), which can be inefficient if the queues do not continually have messages. If not specified, the default is 30 seconds.

-d

Causes messages that result in service failure and have a reply message (non-zero in length) to be deleted from the queue.

-f delay

Causes the server to forward the message to the service instead of using tpcall. The message is sent such that a reply is not expected from the service. The TMQFORWARD_BMQ server does not block waiting for the reply from the service and can continue processing the next message from the queue. To throttle the system such that TMQFORWARD_BMQ does not flood the system with requests, the delay numeric value can be used to indicate a delay, in seconds, between processing requests. Use zero for no delay.

-U uid

The user name or user identification number (UID) for all messages handled by TMQFORWARD_BMQ. The user argument is used for access control list (ACL) checks when security is configured for a TUXEDO application.

-G gid

The group name or group identification number (GID) for all messages handled by TMQFORWARD_BMQ. The group argument is used for access control list (ACL) checks when security is configured for a TUXEDO application.

If the TUXEDO default security mechanism is used, and the user option is specified as a user name, the group option is not required and should not be specified.

-E errorqueuename

The name of the MessageQ error queue. Each MessageQ group includes a reserved queue (queue 97) which is used to store error messages. Specifying the errorqueuename option allows BEA TUXEDO and BEA M3 applications and processes to address the error queue by name.

-R retries

The number of times that the TMQFORWARD_BMQ server attempts to retry message delivery. The number of retries is in addition to the initial attempt to deliver the message. If the -R option is not specified or is specified as zero, only the initial delivery is attempted.

The TMQFORWARD_BMQ server must be located on the same physical machine as the BEA MessageQ group from which it dequeues messages. The machine must be configured to run servers on behalf of a BEA TUXEDO application.

A TMQFORWARD_BMQ server is booted as part of a TUXEDO application to facilitate application access to its associated MessageQ bus and group.Any configuration condition that prevents the TMQFORWARD_BMQ server from initiating its services will cause TMQFORWARD_BMQ to fail at boot time with an error posted to the BEA TUXEDO user log (ULOG) file.

TMQFORWARD_BMQ forwards messages to a server providing a service whose name matches the queue name from which the message is read. The message priority is the priority specified when the message was enqueued. If the message is associated with a reply queue, then any reply from the service will be enqueued to the specified reply queue, along with the returned tpurcode. If the reply queue does not exist, the reply will be dropped.

EXAMPLES

*GROUPS
TMQUEUE_BMQGRPHQMGR GRPNO=1

*SERVERS
TMQFORWARD_BMQ SRVGRP="TMQUEUE_BMQGRP" SRVID=1001 RESTART=Y GRACE=0
CLOPT=" -- -qservice1,service2" REPLYQ=N
TMQUEUE_BMQ SRVGRP="TMQUEUE_BMQGRP" SRVID=1000 RESTART=Y GRACE=0
CLOPT="-s Payroll:TMQUEUE_BMQ -- -b 5 -g 7"

SEE ALSO

ubbconfig(5), servopts(5), buildserver(1), tpenqueue(3c), tpdequeue(3c), TMQUEUE_BMQ(5), BEA TUXEDO Administrator's Guide, BEA TUXEDO Programmer's Guide, BEA MessageQ Introduction to Message Queueing, BEA MessageQ Programmer's Guide

tpdequeue (3)

Name

tpdequeue - routine to dequeue a message from a queue

Synopsis

#include <atmi.h>

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

Description

tpdequeue() dequeues a message for processing from the queue named by qname in the qspace queue space.

By default, the message at the top of the queue is dequeued. The default order of messages on the queue is defined when the queue is created. The application can request a particular message for dequeuing by specifying its message identifier using the ctl parameter. ctl flags can also be used to indicate that the application wants to wait for a message, in the case where a message is not currently available. See the section below describing this parameter.

data is the address of a pointer to the buffer into which a message is read, and len points to the length of that message. *data must point to a buffer originally allocated by tpalloc(3c). To determine whether a message buffer changed in size, compare its (total) size before tpdequeue() was issued with *len. Note that *data may change for reasons other than the buffer's size increased. If *len is 0 upon return, then the message dequeued has no data portion and neither *data nor the buffer it points to were modified. It is an error for *data or len to be NULL.

The TPNOTRAN flag must be set when exchanging messages between BEA MessageQ and BEA TUXEDO, so messages are not dequeued in transaction mode. The message is dequeued in a separate transaction. If a communication error or a timeout occurs (either transaction or blocking timeout), the application will not know whether or not the message was successfully dequeued and the message may be lost.

Following is a list of valid flags.

TPNOTRAN

This flag must be set when exchanging messages between BEA MessageQ and BEA TUXEDO. If the caller is in transaction mode and this flag is set, then the message is not dequeued within the same transaction as the caller. A caller in transaction mode that sets this flag is still subject to the transaction timeout (and no other) when dequeuing the message. If message dequeuing fails, the caller's transaction is not affected.

TPNOBLOCK

The message is not dequeued if a blocking condition exists (for example, the internal buffers into which the message is transferred are full). If such a condition occurs, the call fails and tperrno is set to TPEBLOCK. When TPNOBLOCK is not specified and a blocking condition exists, the caller blocks until the condition subsides or a timeout occurs (either transaction or blocking timeout). This blocking condition does not include blocking on the queue itself if the TPQWAIT option is specified.

TPNOTIME

This flag signifies that the caller is willing to block indefinitely and wants to be immune to blocking timeouts. Transaction timeouts may still occur.

TPNOCHANGE

When this flag is set, the type of the buffer pointed to by *data is not allowed to change. By default, if a buffer is received that differs in type from the buffer pointed to by *data, then *data's buffer type changes to the received buffer's type so long as the receiver recognizes the incoming buffer type. That is, the type and sub-type of the dequeued message must match the type and sub-type of the buffer pointed to by *data.

TPSIGRSTRT

If a signal interrupts any underlying system calls, then the interrupted system call is re-issued. When TPSIGRSTRT is not specified and a signal interrupts a system call, then tpdequeue() fails and tperrno is set to TPGOTSIG.

If tpdequeue() returns successfully, the application can retrieve additional information about the message using ctl data structure. The information may include the message identifier for the dequeued message, a correlation identifier that should accompany any reply or failure message so that the originator can correlate the message with the original request, the name of a reply queue if a reply is desired, and the name of the failure queue on which the application can queue information regarding failure to dequeue the message. This is described below.

Control Parameter

The TPQCTL structure is used by the application program to pass and retrieve parameters associated with dequeuing the message. The flags element of TPQCTL is used to indicate what other elements in the structure are valid.

On input to tpdequeue(), the following elements may be set in the TPQCTL structure:

long flags;            /* indicates which of the values
* are set */
char msgid[32]; /* id of message to dequeue */
char corrid[32]; /* correlation identifier of
* message to dequeue */

Following is a list of valid bits for the flags parameter controlling input information for tpdequeue().

TPNOFLAGS

No flags are set. No information is taken from the control structure.

TPQGETBYMSGID

If set, it requests that the message identified by ctl->msgid be dequeued. The message identifier would be one that was returned by a prior call to tpenqueue(3c). Note that the message identifier is not valid if the message has moved from one queue to another; in this case, use the correlation identifier. This option cannot be used with the TPQWAIT option.

TPQGETBYCORRID

If set, it requests that the message with the correlation identifier specified by ctl->corrid be dequeued. The correlation identifier would be one that the application specified when enqueuing the message with tpenqueue(). This option cannot be used with the TPQWAIT option.

TPQWAIT

If set, it indicates that an error should not be returned if the queue is empty. Instead, the process should block until a message is available.

On output from tpdequeue(), the following elements may be set in the TPQCTL structure:

long flags;            /* indicates which of the values
* should be set */
long priority; /* enqueue priority */
char msgid[32]; /* id of message dequeued */
char corrid[32]; /* correlation identifier used to
* identify the message */
char replyqueue[16]; /* queue name for reply */
char failurequeue[16]; /* queue name for failure */
long diagnostic; /* reason for failure */
long appkey; /* application authentication client
* key */
long urcode; /* user-return code */
CLIENTID cltid; /* client identifier for originating
* client */

Following is a list of valid bits for the flags parameter controlling output information from tpdequeue(). If the flag bit is turned on when tpdequeue() is called, then the associated element in the structure is populated if available and the bit remains set. If the value is not available, the flag bit will be turned off after tpdequeue() completes.

TPQPRIORITY

If set and the value is available, the priority at which the message was queued is stored in ctl->priority. The priority is in the range 1 to 100, inclusive, and the higher the number, the higher the priority (that is, a message with a higher number is dequeued before a message with a lower number).

TPQMSGID

If set and the call to tpdequeue() was successful, the message identifier will be stored in ctl->msgid.

TPQCORRID

If set and the call to tpdequeue() was successful and the message was queued with a correlation identifier, the value will be stored in ctl->corrid. Any reply to a queue must have this correlation identifier.

TPQREPLYQ

If set and the message is associated with a reply queue, the value will be stored in ctl->replyqueue. Any reply to the message should go to the named reply queue within the same queue space as the request message.

TPQFAILUREQ

If set and the message is associated with a failure queue, the value will be stored in ctl->failurequeue. Any failure message should go to the named failure queue within the same queue space as the request message.

If the call to tpdequeue() failed and tperrno is set to TPEDIAGNOSTIC, a value indicating the reason for failure is returned in ctl->diagnostic. The possible values are defined below in the DIAGNOSTICS section.

Additionally on output, ctl->appkey is set to application authentication key, ctl->cltid is set to the identifier for the client originating the request, and ctl->urcode is set to the user-return code value that was set when the message was enqueued.

If the ctl parameter is NULL, the input flags are considered to be TPNOFLAGS and no output information is made available to the application program.

Return Values

This function returns -1 on error and sets tperrno to indicate the error condition.

Errors

Under the following conditions, tpdequeue() fails and sets tperrno to one of the following (unless otherwise noted, failure does not affect the caller's transaction, if one exists):

[TPEINVAL]

Invalid arguments were given (for example, qname is NULL, data does not point to space allocated with tpalloc(3c) or flags are invalid).

[TPENOENT]

Cannot access the qspace because it is not available (the associated TMQUEUE(5) server is not available) or the name begins with "..".

[TPEOTYPE]

Either the type and sub-type of the dequeued message are not known to the caller; or, TPNOCHANGE was set in flags and the type and sub-type of *data do not match the type and sub-type of the dequeued message. Regardless, neither *data, its contents nor *len are changed. When this error occurs, the transaction is marked abort-only and the message will remain on the queue.

[TPETIME]

A timeout occurred. If the caller is in transaction mode, then a transaction timeout occurred and the transaction is to be aborted; otherwise, a blocking timeout occurred and neither TPNOBLOCK nor TPNOTIME were specified. If a transaction timeout occurred, any attempts to dequeue new messages will fail with TPETIME until the transaction has been aborted.

[TPEBLOCK]

A blocking condition exists and TPNOBLOCK was specified.

[TPGOTSIG]

A signal was received and TPSIGRSTRT was not specified.

[TPEPROTO]

tpdequeue() was called in an improper context. There is no effect on the queue or the transaction.

[TPESYSTEM]

A System /T error has occurred. The exact nature of the error is written to a log file. There is no effect on the queue.

[TPEOS]

An operating system error has occurred. There is no effect on the queue.

[TPEDIAGNOSTIC]

Dequeuing a message from the specified queue failed. The reason for failure can be determined by the diagnostic value returned via ctl structure.

Diagnostic

The following diagnostic values are returned during the dequeuing of a message.

[QMEINVAL]

An invalid flag value was specified.

[QMEBADRMID]

An invalid resource manager identifier was specified.

[QMENOTOPEN]

The resource manager is not currently open.

[QMETRAN]

The call was made with the TPNOTRAN flag and an error occurred trying to start a transaction in which to dequeue the message.

[QMEBADMSGID]

An invalid message identifier was specified for dequeuing.

[QMEINUSE]

When dequeuing a message by correlation or message identifier, the specified message is in-use by another transaction. Otherwise, all messages currently on the queue are in-use by other transactions.

[QMESYSTEM]

A system error has occurred. The exact nature of the error is written to a log file.

[QMEOS]

An operating system error has occurred.

[QMEABORTED]

The operation was aborted. When executed within a global transaction, the global transaction has been marked rollback-only. Otherwise, the queue manager aborted the operation.

[QMEPROTO]

A dequeue was done when the transaction state was not active.

[QMEBADQUEUE]

An invalid or deleted queue name was specified.

[QMENOMSG]

No message was available for dequeuing.

See Also

tpalloc(3c), tpenqueue(3c), TMQUEUE_BMQ(5)

tpenqueue (3)

Name

tpenqueue - routine to enqueue a message

Synopsis

#include <atmi.h>
int tpenqueue(char *qspace, char *qname,
TPQCTL *ctl, char *data, long len, long flags)

Description

tpenqueue() stores a message on the queue named by qname in the qspace queue space. A queue space is a collection of queues, one of which must be qname.

When the message is intended for a System/T server, the qname matches the name of a service provided by a server. The system provided server, TMQFORWARD_BMQ(5), provides a default mechanism for dequeuing messages from the queue and forwarding them to servers that provide a service matching the queue name. If the originator expected a reply, then the reply to the forwarded service request is stored on the originator's (stable) queue. The originator will dequeue the reply message at a subsequent time. Queues can also be used for a reliable message transfer mechanism between any pair of System/T processes (clients and/or servers). In this case, the queue name does not match a service name but some agreed upon title for transferring the message.

If data is non-NULL, it must point to a buffer previously allocated by tpalloc(3c) and len should specify the amount of data in the buffer that should be queued. Note that if data points to a buffer of a type that does not require a length to be specified (for example, an FML fielded buffer), then len is ignored. If data is NULL, len is ignored and a message is queued with no data portion.

The message is queued at the priority defined for qspace unless overridden by a previous call to tpsprio(3c).

The TPNOTRAN flag must be set when exchanging messages between BEA MessageQ and BEA TUXEDO, so messages are not enqueued in transaction mode. The message is not queued in transaction mode if either the caller is not in transaction mode, or the TPNOTRAN flag is set. In this case, the queued message is stored on the queue in a separate transaction. Once tpenqueue() returns successfully, the submitted message is guaranteed to be available. If a communication error or a timeout occurs (either transaction or blocking timeout), the application will not know whether or not the message was successfully stored on the queue.

The order in which messages are placed on the queue is controlled by the application via ctl data structure as described below; the default queue ordering is set when the queue is created.

Following is a list of valid flags.

TPNOTRAN

This flag must be set when exchanging messages between BEA MessageQ and BEA TUXEDO. If the caller is in transaction mode and this flag is set, then the message is not queued within the same transaction as the caller. A caller in transaction mode that sets this flag is still subject to the transaction timeout (and no other) when queuing the message. If message queuing fails, the caller's transaction is not affected.

TPNOBLOCK

The message is not enqueued if a blocking condition exists (for example, the internal buffers into which the message is transferred are full). If such a condition occurs, the call fails and tperrno is set to TPEBLOCK. When TPNOBLOCK is not specified and a blocking condition exists, the caller blocks until the condition subsides or a timeout occurs (either transaction or blocking timeout).

TPNOTIME

This flag signifies that the caller is willing to block indefinitely and wants to be immune to blocking timeouts. Transaction timeouts may still occur.

TPSIGRSTRT

If a signal interrupts any underlying system calls, then the interrupted system call is re-issued. When TPSIGRSTRT is not specified and a signal interrupts a system call, then tpenqueue() fails and tperrno is set to TPGOTSIG.

Additional information about queuing the message can be specified via ctl data structure. This information includes values to override the default queue ordering placing the message at the top of the queue or before an enqueued message; an absolute or relative time after which a queued message is made available; a correlation identifier that aids in correlating a reply or failure message with the queued message; the name of a queue to which a reply should be enqueued; and the name of a queue to which any failure message should be enqueued.

Control Parameter

The TPQCTL structure is used by the application program to pass and retrieve parameters associated with enqueuing the message. The flags element of TPQCTL is used to indicate what other elements in the structure are valid.

On input to tpenqueue(), the following elements may be set in the TPQCTL structure:

long flags;            /* indicates which of the values
* are set */
long deq_time; /* absolute/relative for dequeuing */
long priority; /* enqueue priority */
long urcode; /* user-return code */
char msgid[32]; /* id of message before which to queue
* request */
char corrid[32]; /* correlation identifier used to
* identify the msg */
char replyqueue[16]; /* queue name for reply message */
char failurequeue[16]; /* queue name for failure message */

The following is a list of valid bits for the flags parameter controlling input information for tpenqueue().

TPNOFLAGS

No flags or values are set. No information is taken from the control structure.

TPQTOP

This flag is not supported when exchanging messages between BEA MEssageQ and BEA TUXEDO.

TPQBEFOREMSGID

Setting this flag bit indicates that the queue ordering be overridden and the message placed in the queue before the message identified by ctl->msgid. This request may not be granted depending on whether or not the queue was configured to allow overriding the queue ordering. TPQTOP and TPQBEFOREMSGID are mutually exclusive flags.

TPQTIME_ABS

This flag is not supported when exchanging messages between BEA MEssageQ and BEA TUXEDO.

TPQTIME_REL

This flag is not supported when exchanging messages between BEA MEssageQ and BEA TUXEDO.

TPQPRIORITY

If set, the priority at which the message should be enqueued is stored in ctl->priority. The priority must be in the range 1 to 100, inclusive. The higher the number, the higher the priority (that is, a message with a higher number is dequeued before a message with a lower number).

TPQCORRID

If set, the correlation identifier value specified in ctl->corrid is available when a message is dequeued with tpdequeue(3c). This identifier accompanies any reply or failure message that is queued such that an application can correlate a reply with a particular request. The entire value should be initialized (e.g., padded with null characters) such that the value can be matched at a later time.

TPQREPLYQ

If set, a reply queue named in ctl->replyqueue is associated with the queued message. Any reply to the message will be queued to the named queue within the same queue space as the request message. This string must be NULL terminated (maximum 15 characters in length).

TPQFAILUREQ

If set, a failure queue named in ctl->failurequeue is associated with the queued message. If a failure occurs when the enqueued message is subsequently dequeued, a failure message will go to the named queue within the same queue space as the original request message. This string must be NULL terminated (maximum 15 characters in length).

Additionally, the urcode element of TPQCTL can be set with a user-return code. This value will be returned to the application that dequeues the message.

On output from tpenqueue(), the following elements may be set in the TPQCTL structure:

long flags;            /* indicates which of the values
* are set */
char msgid[32]; /* id of enqueued message */
long diagnostic; /* indicates reason for failure */

Following is a list of valid bits for the flags parameter controlling output information from tpenqueue(). If the flag bit is turned on when tpenqueue() is called, then the associated element in the structure is populated if available and the bit remains set. If the value is not available, the flag bit will be turned off after tpenqueue() completes.

TPQMSGID

If set and the call to tpenqueue() was successful, the message identifier will be stored in ctl->msgid.

If the call to tpenqueue() failed and tperrno is set to TPEDIAGNOSTIC, a value indicating the reason for failure is returned in ctl->diagnostic. The possible values are defined below in the DIAGNOSTICS section.

If this parameter is NULL, the input flags are considered to be TPNOFLAGS and no output information is made available to the application program.

Return Values

This function returns -1 on error and sets tperrno to indicate the error condition. Otherwise, the message has been successfully queued when tpenqueue() returns.

Errors

Under the following conditions, tpenqueue() fails and sets tperrno to the following values (unless otherwise noted, failure does not affect the caller's transaction, if one exists):

[TPEINVAL]

Invalid arguments were given (for example, qspace is NULL, data does not point to space allocated with tpalloc(3c), or flags are invalid).

[TPENOENT]

Cannot access the qspace because it is not available (the associated TMQUEUE(5) server is not available) or the name begins with "..".

[TPETIME]

A timeout occurred. If the caller is in transaction mode, then a transaction timeout occurred and the transaction is to be aborted; otherwise, a blocking timeout occurred and neither TPNOBLOCK nor TPNOTIME was specified. If a transaction timeout occurred, any attempts to enqueue new messages will fail with TPETIME until the transaction has been aborted.

[TPEBLOCK]

A blocking condition exists and TPNOBLOCK was specified.

[TPGOTSIG]

A signal was received and TPSIGRSTRT was not specified.

[TPEPROTO]

tpenqueue() was called in an improper context.

[TPESYSTEM]

A System/T error has occurred. The exact nature of the error is written to a log file.

[TPEOS]

An operating system error has occurred.

[TPEDIAGNOSTIC]

Enqueuing a message on the specified queue failed. The reason for failure can be determined by the diagnostic returned via ctl.

Diagnostic

The following diagnostic values are returned during the enqueuing of a message.

[QMEINVAL]

An invalid flag value was specified.

[QMEBADRMID]

An invalid resource manager identifier was specified.

[QMENOTOPEN]

The resource manager is not currently open.

[QMETRAN]

The call was made with the TPNOTRAN flag and an error occurred trying to start a transaction in which to enqueue the message.

[QMEBADMSGID]

An invalid message identifier was specified.

[QMESYSTEM]

A system error has occurred. The exact nature of the error is written to a log file.

[QMEOS]

An operating system error has occurred.

[QMEABORTED]

The operation was aborted. When executed within a global transaction, the global transaction has been marked rollback-only. Otherwise, the queue manager aborted the operation.

[QMEPROTO]

An enqueue was done when the transaction state was not active.

[QMEBADQUEUE]

An invalid or deleted queue name was specified.

[QMENOSPACE]

There is no space on the queue for the message.

See Also

gp_mktime(3c), tpacall(3c), tpalloc(3c), tpdequeue(3c), tpinit(3c), tpsprio(3c)TMQFORWARD_BMQ(5), TMQUEUE_BMQ(5),