アプリケーションプログラミングインターフェイスガイド> 組み込み手順> サンプルJMS組み込みプロシージャ
 
サンプルのJMS組み込み手順
組み込みプロシージャの使用方法の概要として、/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