IMessageProducer

An application uses a message producer to send messages to a destination.

    Inheritance hierarchy:
    IBM.XMS.IPropertyContext
       |
       +----IBM.XMS.IMessageProducer
    

For a list of the XMS defined properties of a MessageProducer object, see Properties of MessageProducer.

Parent topic: .NET interfaces


.NET properties

    Summary of .NET properties:

    .NET properties Description
    DeliveryMode Get and set the default delivery mode for messages sent by the message producer.
    Destination Get the destination for the message producer.
    DisableMsgID Get an indication of whether a receiving application requires message identifiers to be included in messages sent by the message producer, and indicate whether a receiving application requires message identifiers to be included in messages sent by the message producer.
    DisableMsgTS Get an indication of whether a receiving application requires time stamps to be included in messages sent by the message producer, and indicate whether a receiving application requires time stamps to be included in messages sent by the message producer.
    Priority Get and set the default priority for messages sent by the message producer.
    TimeToLive Get and set the default length of time that a message exists before it expires.


DeliveryMode - Get and Set Default Delivery Mode

    Interface:
    DeliveryMode DeliveryMode
    {
      get;
      set;
    }
    

Get and set the default delivery mode for messages sent by the message producer.

The default delivery mode has one of the following values:

  • DeliveryMode.Persistent
  • DeliveryMode.NonPersistent

For a real-time connection to a broker, the value must be DeliveryMode.NonPersistent.

The default value is DeliveryMode.Persistent, except for a real-time connection to a broker for which the default value is DeliveryMode.NonPersistent.

    Exceptions:

    • XMSException


Destination - Get Destination

    Interface:
    IDestination Destination
    {
      get;
    }
    

Get the destination for the message producer.

    Parameters:
    None

    Returns:
    The Destination object. If the message producer does not have a destination, the method returns a null Destination object.

    Exceptions:

    • XMSException


DisableMsgID - Get and Set Disable Message ID Flag

    Interface:
    Boolean DisableMessageID
    {
      get;
      set;
    }
    

Get an indication of whether a receiving application requires message identifiers to be included in messages sent by the message producer, and indicate whether a receiving application requires message identifiers to be included in messages sent by the message producer.

On a connection to a queue manager, or on a real-time connection to a broker, this flag is ignored. On a connection to a service integration bus, the flag is honored.

DisabledMsgID has the following values:

  • True, if a receiving application does not require message identifiers to be included in messages sent by the message producer.
  • False, if a receiving application does require message identifiers to be included in messages sent by the message producer.

    Exceptions:

    • XMSException


DisableMsgTS - Get and Set Disable Time Stamp Flag

    Interface:
    Boolean DisableMessageTimestamp
    {
      get;
      set;
    }
    

Get an indication of whether a receiving application requires time stamps to be included in messages sent by the message producer, and indicate whether a receiving application requires time stamps to be included in messages sent by the message producer.

On a real-time connection to a broker, this flag is ignored. On a connection to a queue manager, or on a connection to a service integration bus, the flag is honored.

DisableMsgTS has the following values:

  • True, if a receiving application does not require time stamps to be included in messages sent by the message producer.
  • False, if a receiving application does require time stamps to be included in messages sent by the message producer.

    Returns:

    Exceptions:

    • XMSException


Priority - Get and Set Default Priority

    Interface:
    Int32 Priority
    {
      get;
      set;
    }
    

Get and set the default priority for messages sent by the message producer.

The value of the default message priority is an integer in the range 0, the lowest priority, to 9, the highest priority.

On a real-time connection to a broker, the priority of a message is ignored.

    Exceptions:

    • XMSException


TimeToLive - Get and Set Default Time to Live

    Interface:
    Int64 TimeToLive
    {
      get;
      set;
    }
    

Get and set the default length of time that a message exists before it expires.

The time is measured from when the message producer sends the message and is the default time to live in milliseconds. A value of 0 means that a message never expires.

For a real-time connection to a broker, this value is always 0.

    Exceptions:

    • XMSException


Methods

    Summary of methods:

    Method Description
    Close Close the message producer.
    Send Send a message to the destination that was specified when the message producer was created. Send the message using the message producer default delivery mode, priority, and time to live.
    Send Send a message to the destination that was specified when the message producer was created. Send the message using the specified delivery mode, priority, and time to live.
    Send Send a message to a specified destination if we are using a message producer for which no destination was specified when the message producer was created. Send the message using the message producer default delivery mode, priority, and time to live.
    Send Send a message to a specified destination if we are using a message producer for which no destination was specified when the message producer was created. Send the message using the specified delivery mode, priority, and time to live.


Close - Close Message Producer

    Interface:
    void  Close(); 
    

Close the message producer.

If an application tries to close a message producer that is already closed, the call is ignored.

    Parameters:
    None

    Returns:
    Void

    Exceptions:

    • XMSException


Send - Send

    Interface:
    void Send(IMessage msg) ;
    

Send a message to the destination that was specified when the message producer was created. Send the message using the message producer default delivery mode, priority, and time to live.

    Parameters:

      msg (input)
      The Message object.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageFormatException
    • InvalidDestinationException


Send - Send (specifying a delivery mode, priority, and time to live)

    Interface:
    void Send(IMessage msg, 
              DeliveryMode deliveryMode, 
              Int32 priority, 
              Int64 timeToLive);
    

Send a message to the destination that was specified when the message producer was created. Send the message using the specified delivery mode, priority, and time to live.

    Parameters:

      msg (input)
      The Message object.

      deliveryMode (input)
      The delivery mode for the message, which must be one of the following values:

      • DeliveryMode.Persistent
      • DeliveryMode.NonPersistent

      For a real-time connection to a broker, the value must be DeliveryMode.NonPersistent.

      priority (input)
      The priority of the message. The value can be an integer in the range 0, for the lowest priority, to 9, for the highest priority. On a real-time connection to a broker, the value is ignored.

      timeToLive (input)
      The time to live for the message in milliseconds. A value of 0 means that the message never expires. For a real-time connection to a broker, the value must be 0.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageFormatException
    • InvalidDestinationException
    • IllegalStateException


Send - Send (to a specified destination)

    Interface:
    void Send(IDestination dest, IMessage msg) ;
    

Send a message to a specified destination if we are using a message producer for which no destination was specified when the message producer was created. Send the message using the message producer default delivery mode, priority, and time to live.

Typically, you specify a destination when you create a message producer but, if we do not, we must specify a destination every time you send a message.

    Parameters:

      dest (input)
      The Destination object.

      msg (input)
      The Message object.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageFormatException
    • InvalidDestinationException


Send - Send (to a specified destination, specifying a delivery mode, priority, and time to live)

    Interface:
    void Send(IDestination dest, 
              IMessage msg, 
              DeliveryMode deliveryMode, 
              Int32 priority, 
              Int64 timeToLive) ;
    

Send a message to a specified destination if we are using a message producer for which no destination was specified when the message producer was created. Send the message using the specified delivery mode, priority, and time to live.

Typically, you specify a destination when you create a message producer but, if we do not, we must specify a destination every time you send a message.

    Parameters:

      dest (input)
      The Destination object.

      msg (input)
      The Message object.

      deliveryMode (input)
      The delivery mode for the message, which must be one of the following values:

      • DeliveryMode.Persistent
      • DeliveryMode.NonPersistent

      For a real-time connection to a broker, the value must be DeliveryMode.NonPersistent.

      priority (input)
      The priority of the message. The value can be an integer in the range 0, for the lowest priority, to 9, for the highest priority. On a real-time connection to a broker, the value is ignored.

      timeToLive (input)
      The time to live for the message in milliseconds. A value of 0 means that the message never expires. For a real-time connection to a broker, the value must be 0.

    Returns:
    Void

    Exceptions:

    • XMSException
    • MessageFormatException
    • InvalidDestinationException
    • IllegalStateException


Inherited properties and methods

The following methods are inherited from the IPropertyContext interface: