Skip to content

set_message_queue_paramSetMessageQueueParamSetMessageQueueParamset_message_queue_paramT_set_message_queue_param🔗

Short description🔗

set_message_queue_paramSetMessageQueueParamSetMessageQueueParamset_message_queue_paramT_set_message_queue_param — Set message queue parameters or invoke commands on the queue.

Signature🔗

set_message_queue_param( message_queue QueueHandle, string GenParamName, tuple GenParamValue )void SetMessageQueueParam( const HTuple& QueueHandle, const HTuple& GenParamName, const HTuple& GenParamValue )static void HOperatorSet.SetMessageQueueParam( HTuple queueHandle, HTuple genParamName, HTuple genParamValue )def set_message_queue_param( queue_handle: HHandle, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]] ) -> None

Herror T_set_message_queue_param( const Htuple QueueHandle, const Htuple GenParamName, const Htuple GenParamValue )

void HMessageQueue::SetMessageQueueParam( const HTuple& GenParamName, const HTuple& GenParamValue ) const

void HMessageQueue::SetMessageQueueParam( const HString& GenParamName, const HTuple& GenParamValue ) const

void HMessageQueue::SetMessageQueueParam( const char* GenParamName, const HTuple& GenParamValue ) const

void HMessageQueue::SetMessageQueueParam( const wchar_t* GenParamName, const HTuple& GenParamValue ) const (Windows only)

void HMessageQueue.SetMessageQueueParam( HTuple genParamName, HTuple genParamValue )

void HMessageQueue.SetMessageQueueParam( string genParamName, HTuple genParamValue )

Description🔗

set_message_queue_paramSetMessageQueueParam sets message queue parameters or invokes action commands on the queue.

Multiple parameters and action commands can be passed through a single set_message_queue_paramSetMessageQueueParam call, passing multiple parameter names in a tuple GenParamNamegenParamNamegen_param_name and corresponding values in GenParamValuegenParamValuegen_param_value. There must be always the same number of names and values and the values must be in the same order as the names. The parameters and action commands are applied in the same order passed in GenParamNamegenParamNamegen_param_name. It is important to understand that in particular in case of the action commands, it might not be possible to revert the effect of previous action commands if a later command fails, the caller therefore might need to be careful when setting multiple commands in a single call.

Currently supported parameter names are:

  • 'abort_dequeuing'"abort_dequeuing":

  • 'abort_enqueuing'"abort_enqueuing": Aborts any dequeue_messageDequeueMessage or enqueue_messageEnqueueMessage operator waiting in any thread for data to be delivered. Any currently waiting call will unblock and return H_ERR_MQCNCL. Any dequeue_messageDequeueMessage or enqueue_messageEnqueueMessage call invoked in the future will return H_ERR_MQCNCL immediately regardless of the queue status.

    This command is typically needed for cleanup when any threads using the message queue and possibly blocked in dequeue_messageDequeueMessage or enqueue_messageEnqueueMessage must be released, because it is not allowed to destroy the queue (clear_message_queueClearMessageQueue) while any operators might still use it. It might be necessary to wait for the completion of those threads after invoking the 'abort_dequeuing'"abort_dequeuing" and 'abort_enqueuing'"abort_enqueuing" command to be sure any operators using the queue are completed.

    The message data currently stored in the message queue is not affected by the command. The effect of canceling any further dequeue_messageDequeueMessage or enqueue_messageEnqueueMessage calls can be reset again using the 'restore_queue'"restore_queue" command.

    The parameter value must be integer 11.

  • 'restore_queue'"restore_queue": Clears the effect of a previous 'abort_dequeuing'"abort_dequeuing" and 'abort_enqueuing'"abort_enqueuing" command. This means the next call to dequeue_messageDequeueMessage will again attempt to deliver message data, and the next call to enqueue_messageEnqueueMessage will be able to enqueue new messages.

    The parameter value must be integer 11.

  • 'flush_queue'"flush_queue": Flushes the queue. All currently enqueued messages are removed from the queue and all associated resources, in particular the tuple or object data stored in the messages, are released.

    The parameter value must be integer 11.

  • 'max_message_num'"max_message_num": Sets the maximum number of messages that can be stored in the queue. The setting 'wait_on_full'"wait_on_full" can be used to change the behavior of an enqueue_messageEnqueueMessage operator call that would result in the queue containing more messages after the operation than the defined maximum. In such a case, if 'wait_on_full'"wait_on_full" is set to 'false'"false", enqueue_messageEnqueueMessage would fail with code H_ERR_MQOVL. If 'wait_on_full'"wait_on_full" is set to 'true'"true", enqueue_messageEnqueueMessage would wait until enough space becomes available in the queue.

    Setting the 'max_message_num'"max_message_num" parameter has no effect on the messages already present in the queue. No messages that are already in the queue can be removed by this operation.

    The parameter value can be a positive integer or -1-1 if the queue size should be unlimited. The string value 'infinite'"infinite" is accepted as well. The queue size is unlimited by default.

    Suggested values: -1-1, 'infinite'"infinite", 1010, 2020

    Default: -1-1

  • 'wait_on_full'"wait_on_full": If 'max_message_num'"max_message_num" is set for the queue, this parameter can be used to configure the behavior of enqueue_messageEnqueueMessage when the queue is full.

    If this parameter is set to 'false'"false" (default), then enqueue_messageEnqueueMessage returns the value H_ERR_MQOVL when the queue is full.

    If this parameter is set to 'true'"true", then enqueue_messageEnqueueMessage waits when the queue is full until space becomes available again. This can happen through a call to dequeue_messageDequeueMessage, by increasing the value of 'max_message_num'"max_message_num", or by manually clearing the queue using 'flush_queue'"flush_queue".

    If a call to enqueue_messageEnqueueMessage attempts to place more messages in the queue than allowed by 'max_message_num'"max_message_num", then enqueue_messageEnqueueMessage returns an error regardless of the setting of 'wait_on_full'"wait_on_full".

    Pending calls to enqueue_messageEnqueueMessage can also be aborted using 'abort_enqueuing'"abort_enqueuing".

    List of values: 'false'"false", 'true'"true"

    Default: 'false'"false"

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

QueueHandlequeueHandlequeue_handle (input_control) message_queue → (handle)HTuple (HHandle)HMessageQueue, HTuple (IntPtr)HHandleHtuple (handle)

Message queue handle.

Number of elements: QueueHandle == 1
Restriction: QueueHandle != 0

GenParamNamegenParamNamegen_param_name (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Names of the queue parameters or action commands.

Number of elements: GenParamName == GenParamValue
Default: 'max_message_num'"max_message_num"
List of values: 'abort_dequeuing', 'abort_enqueuing', 'flush_queue', 'max_message_num', 'restore_queue', 'wait_on_full'"abort_dequeuing", "abort_enqueuing", "flush_queue", "max_message_num", "restore_queue", "wait_on_full"

GenParamValuegenParamValuegen_param_value (input_control) tuple(-array) → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)MaybeSequence[Union[int, float, str]]Htuple (char* / Hlong / double)

Values of the queue parameters or action commands.

Number of elements: GenParamName == GenParamValue
Default: 11
Suggested values: 1, -1, 'true', 'false'1, -1, "true", "false"

Example🔗

(HDevelop)

* abort waiting dequeue_message operators
set_message_queue_param (Queue, 'abort_dequeuing', 1)
* abort waiting enqueue_message operators (if 'wait_on_full' is set)
set_message_queue_param (Queue, 'abort_enqueuing', 1)
*
* ... wait for the operators to abort
*
* Restore normal queue operations
set_message_queue_param (Queue, 'restore_queue', 1)

Result🔗

If all the operator parameters and their values are valid, set_message_queue_paramSetMessageQueueParam returns 2 (H_MSG_TRUE). Otherwise an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

create_message_queueCreateMessageQueue

Possible successors

clear_message_queueClearMessageQueue

See also

create_message_queueCreateMessageQueue, clear_message_queueClearMessageQueue, enqueue_messageEnqueueMessage, dequeue_messageDequeueMessage, get_message_queue_paramGetMessageQueueParam, create_messageCreateMessage, clear_messageClearMessage, set_message_tupleSetMessageTuple, get_message_tupleGetMessageTuple, set_message_objSetMessageObj, get_message_objGetMessageObj

Module🔗

Foundation