Packagecom.kaazing.gateway.jms.client
Interfacepublic interface MessageProducer

A client uses a MessageProducer object to send messages to a destination. A MessageProducer object is created by passing a Destination object to a message-producer creation method supplied by a session.

MessageProducer is the parent interface for all message producers.

A client also has the option of creating a message producer without supplying a destination. In this case, a destination must be provided with every send operation. A typical use for this kind of message producer is to send replies to requests using the request's JMSReplyTo destination.

A client can specify a default delivery mode, priority, and time to live for messages sent by a message producer. It can also specify the delivery mode, priority, and time to live for an individual message.

A client can specify a time-to-live value in milliseconds for each message it sends. This value defines a message expiration time that is the sum of the message's time-to-live and the GMT when it is sent (for transacted sends, this is the time the client sends the message, not the time the transaction is committed).

A JMS provider should do its best to expire messages accurately; however, the JMS API does not define the accuracy provided.



Public Properties
 PropertyDefined by
  deliveryMode : int
Gets the producer's default delivery mode.
MessageProducer
  destination : Destination
[read-only] Gets the destination associated with this MessageProducer.
MessageProducer
  disableMessageID : Boolean
Gets an indication of whether message IDs are disabled.
MessageProducer
  disableMessageTimestamp : Boolean
Gets an indication of whether message timestamps are disabled.
MessageProducer
  priority : int
Gets the producer's default priority.
MessageProducer
  timeToLive : Number
Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.
MessageProducer
Public Methods
 MethodDefined by
  
close():void
Closes the message producer.
MessageProducer
  
send(message:Message, deliveryMode:int = -1, priority:int = -1, timeToLive:Number = 0, callback:Function = null):VoidFuture
Sends a message to the destination, specifying delivery mode, priority, and time to live.
MessageProducer
  
sendToDestination(destination:Destination, message:Message, deliveryMode:int = -1, priority:int = -1, timeToLive:Number = 0, callback:Function = null):VoidFuture
Sends a message to a destination for an unidentified message producer, specifying delivery mode, priority and time to live.
MessageProducer
Property detail
deliveryModeproperty
deliveryMode:int  [read-write]

Gets the producer's default delivery mode.

Implementation
    public function get deliveryMode():int
    public function set deliveryMode(value:int):void
destinationproperty 
destination:Destination  [read-only]

Gets the destination associated with this MessageProducer.

Implementation
    public function get destination():Destination
disableMessageIDproperty 
disableMessageID:Boolean  [read-write]

Gets an indication of whether message IDs are disabled.

Implementation
    public function get disableMessageID():Boolean
    public function set disableMessageID(value:Boolean):void
disableMessageTimestampproperty 
disableMessageTimestamp:Boolean  [read-write]

Gets an indication of whether message timestamps are disabled.

Implementation
    public function get disableMessageTimestamp():Boolean
    public function set disableMessageTimestamp(value:Boolean):void
priorityproperty 
priority:int  [read-write]

Gets the producer's default priority.

Implementation
    public function get priority():int
    public function set priority(value:int):void
timeToLiveproperty 
timeToLive:Number  [read-write]

Gets the default length of time in milliseconds from its dispatch time that a produced message should be retained by the message system.

Implementation
    public function get timeToLive():Number
    public function set timeToLive(value:Number):void
Method detail
close()method
public function close():void

Closes the message producer.

Since a provider may allocate some resources on behalf of a MessageProducer outside the immediate environment, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

send()method 
public function send(message:Message, deliveryMode:int = -1, priority:int = -1, timeToLive:Number = 0, callback:Function = null):VoidFuture

Sends a message to the destination, specifying delivery mode, priority, and time to live.

This function executes asynchronously (returns immediately), but does not invoke the callback specified until the message has been delivered to the broker.

Parameters
message:Message — the message to send
 
deliveryMode:int (default = -1) — the delivery mode to use
 
priority:int (default = -1) — the priority for this message
 
timeToLive:Number (default = 0) — the message's lifetime (in milliseconds)
 
callback:Function (default = null) — called when the message has been delivered to the broker

Returns
VoidFuture
sendToDestination()method 
public function sendToDestination(destination:Destination, message:Message, deliveryMode:int = -1, priority:int = -1, timeToLive:Number = 0, callback:Function = null):VoidFuture

Sends a message to a destination for an unidentified message producer, specifying delivery mode, priority and time to live.

Typically, a message producer is assigned a destination at creation time; however, the JMS API also supports unidentified message producers, which require that the destination be supplied every time a message is sent.

This function executes asynchronously (returns immediately), but does not invoke the callback specified until the message has been delivered to the broker.

Parameters
destination:Destination — the destination to send this message to
 
message:Message — the message to send
 
deliveryMode:int (default = -1) — the delivery mode to use
 
priority:int (default = -1) — the priority for this message
 
timeToLive:Number (default = 0) — the message's lifetime (in milliseconds)
 
callback:Function (default = null) — called when the message has been delivered to the broker

Returns
VoidFuture