msgproptype

Description

Extracts and returns from a <msgheader> and <msgproperties> document the message provider’s property type for the msg_doc property with a name that equals prop_name. The result is a null value if msg_doc does not have a property with a name is equal to prop_name.

Syntax

msgproptype_call ::= msgproptype(prop_name [ , msg_doc] )
	msg_doc ::= basic_character_expression
	prop_name::= basic_character_expression

Parameters

msgproptype_call

makes the request to use the msgproptype function.

msg_doc

is the <msgheader> or <msgproperties> XML document. A basic_character_expression. If msg_doc is not specified, the current value of @@msgprpoperties is used.

prop_name

is the property name from which you want to extract a value or type. A basic_character_expression.

Examples

Example 1

A message is sent with two properties, “integer_prop,” which is an integer with value 1234, and “string_prop,” which is a string with the value “cat”:

select msgsend('msgproptype example',
    'tibco_jms:tcp://localhost:7222?queue=queue.sample'
    MESSAGE PROPERTY "integer_prop=1234,string_prop='cat'")
go
---------------------------------------
ID:E4JMS-SERVER.82CC311EC:1
(1 row affected)

The message is then read back:

select msgrecv('tibco_jms:tcp://localhost:7222?queue=queue.sample')
go
---------------------------------------
msgproptype example
(1 row affected)

The @@msgproperties global variable is selected to display what the properties were in the message just received:

select @@msgproperties
go
---------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <msgproperties
       string_prop="&apos;cat&apos;"
       ASE_RTMS_CHARSET="1"
       ASE_ORIGIN="&apos;francis_pinot_2&apos;"
       ASE_SPID="15"
       ASE_MSGBODY_FORMAT="&apos;string&apos;"
       ASE_TIMESTAMP="&apos;2005/06/22 15:01:36.91&apos;"
       ASE_MSGBODY_SCHEMA="&apos;NULL&apos;"
       ASE_RTMS_VERSION="&apos;1.0&apos;"
       ASE_VERSION="&apos;12.5.0.0&apos;"
       integer_prop="1234">
    </msgproperties> 

(1 row affected)

The first msgproptype call asks for the type of the “integer_prop” property, and returns “Integer”:

1> select msgproptype('integer_prop')
2> go
---------------------------------------
Integer
(1 row affected)

The second msgproptype call asks for the type of the “string_prop” property, and returns “String”:

1> select msgproptype('string_prop')
2> go
---------------------------------------
String
(1 row affected)

Usage