basic_publish
Since: Version 2024.09.02-c5476b89
The functionality described in this section requires version 2024.09.02-c5476b89 of KumoMTA, or a more recent version.
Publishes a message using the amqprs AMQP client. This function differs from kumo.amqp.build_client in that it encapsulates the entire publish operation in a single function that manages a connection pool of client(s) and performs the publish without manually dealing with the client connection lifetime.
PARAMS is an object style table with the following possible fields:
routing_key- required string; the name of the queue to which to send the messagepayload- required string; the message to sendexchange- optional string; the exchange through which to send the message. If unspecified, the empty string is used, which corresponds to a default exchange.connection- the connection information, which is in turn an object with the following fields:host- required string; the hostname or IP address of the AMQP serverport- optional integer; the port number of the AMQP service.username- optional stringpassword- optional stringvhost- optional stringconnection_name- optional stringheartbeat- optional integerenable_tls- optional booleanroot_ca_cert- optional string; the path to a CA certificate file.client_cert- optional string; the path to a client certificate file.client_private_key- optional string; the path to the private key associated with the client certificate.pool_size- optional integer; specifies the maximum number of AMQP connections to pool. The default is the number of CPUs * 4.connect_timeout- optional duration string; the timeout to use around the connect operation.recycle_timeout- optional duration string; the timeout to use around the recycle operation, which is where the liveness of an existing connection is tested prior to reuse.wait_timeout- optional duration string; the timeout to use while waiting for a fully saturated pool to have an available AMQP client.publish_timeout- optional duration string; the timeout to use around thebasic_publishoperation.
app_id- optional stringcluster_id- optional stringcontent_encoding- optional stringcontent_type- optional stringcorrelation_id- optional stringdelivery_mode- optional integerexpiration- optional stringheaders- optional field tablemessage_id- optional stringmessage_type- optional stringpriority- optional integerreply_to- optional stringtimestamp- optional timestampuser_id- optional stringmandatory- optional booleanimmediate- optional boolean