Application Programming Interface Guide > Built-in Procedures > Sample JMS Built-in Procedure
 
Sample JMS Built-in Procedure
As an introduction to how built-in procedures can be used, here is an example that uses several built-in procedures from /lib/jms:
PROCEDURE jmsExampleProc()
BEGIN
 -- Create queue_connector and topic_connector beforehand using Manager.
 -- Declare a row type variable to send a map message.
 -- The message has keys named using the attributes of the
 -- following ROW type variable.
DECLARE mapmsg ROW( A INT, B VARCHAR );
 -- Declare a variable to send JMS properties.
DECLARE complexProperties ROW ( uname VARCHAR, utime INT );
SET mapmsg = ( 1, 'var' );
 
 -- Set a simple JMS property.
CALL SetMessageProperty( 'userId', 'admin' );
 -- Send the map message.
CALL SendMapMessage( 'topic_connector', 'my.topic', mapmsg );
 -- Clear all properties.
CALL ClearMessageProperties();
 
 -- Set values for the ROW type variable, which is used to set JMS properties.
 -- The names of such properties are created using the attributes
 -- of the ROW variable.
 -- The value of the property is specified by the following assignment.
SET complexProperties = ( 'admin', 1001 );
CALL SetMessageProperties( complexProperties );
 -- Send several messages. Each message uses the properties in effect.
CALL SendTextMessage( 'queue_connector', 'my.queue', 'hello world' );
CALL SendTextMessage( 'queue_connector', 'my.queue', 'hello world2' );
 -- Properties are cleared upon returning.
END