# tibemsMsgProducer_Send

Function

## Purpose

Send a message.

## C Declaration

    tibems_status tibemsMsgProducer_Send(
        tibemsMsgProducer msgProducer,
        tibemsMsg message );

    tibems_status tibemsMsgProducer_SendEx(
        tibemsMsgProducer msgProducer,
        tibemsMsg message,
        tibems_int deliveryMode,
        tibems_int priority,
        tibems_long timeToLive );

    tibems_status tibemsMsgProducer_SendToDestination(
        tibemsMsgProducer msgProducer,
        tibemsDestination destination,
        tibemsMsg message );

    tibems_status tibemsMsgProducer_SendToDestinationEx(
        tibemsMsgProducer msgProducer,
        tibemsDestination destination,
        tibemsMsg message,
        tibemsDeliveryMode deliveryMode,
        tibems_int priority,
        tibems_long timeToLive );

## COBOL Call

    CALL "tibemsMsgProducer_Send"
         USING BY VALUE msgProducer,
               BY VALUE message,
               RETURNING tibems-status
    END-CALL.

    CALL "tibemsMsgProducer_SendEx"
         USING BY VALUE msgProducer,
               BY VALUE message,
               BY VALUE deliveryMode,
               BY VALUE priority,
               BY VALUE timeToLive,
               RETURNING tibems-status
    END-CALL.

    CALL "tibemsMsgProducer_SendToDestination"
         USING BY VALUE msgProducer,
               BY VALUE destination,
               BY VALUE message,
               RETURNING tibems-status
    END-CALL.

    CALL "tibemsMsgProducer_SendToDestinationEx"
         USING BY VALUE msgProducer,
               BY VALUE destination,
               BY VALUE message,
               BY VALUE deliveryMode,
               BY VALUE priority,
               BY VALUE timeToLive,
               RETURNING tibems-status
    END-CALL.

Note: `msgProducer`, message and destination have usage pointer.

## Parameters

Parameter | Description
--- | ---
`msgProducer` | Send a message through this producer object.
`destination` | Send the message to this destination (queue or topic). Other send calls send the message to the producer’s default destination. When the producer does not specify a default, the send call must supply this parameter.
`message` | Send this message object.
`deliveryMode` | Send the message with this delivery mode. This argument is an enumerated value (see `tibemsDeliveryMode`). Other send calls send the message with the producer’s default delivery mode.
`priority` | Send the message with this priority. Priority affects the order in which the server delivers messages to consumers (higher values first). The JMS specification defines ten levels of priority value, from zero (lowest priority) to 9 (highest priority). The specification suggests that clients consider 0–4 as gradations of normal priority, and priorities 5–9 as gradations of expedited priority. Other send calls send the message with the producer’s default priority.
`timeToLive` | Use this value (in milliseconds) to compute the message expiration. If the time-to-live is non-zero, the expiration is the sum of that time-to-live and the sending client’s current time (GMT). This rule applies even within sessions with transaction semantics—the timer begins with the send call, not the commit call. If the time-to-live is zero, then expiration is also zero—indicating that the message never expires. Other send calls use the producer’s default value to compute expiration. Whenever your application uses non-zero values for message expiration or time-to-live, you must ensure that clocks are synchronized among all the host computers that send and receive messages. Synchronize clocks to a tolerance that is a very small fraction of the smallest or time-to-live.

Copyright © Cloud Software Group, Inc. All rights reserved.