Oracle Message Broker Adminstration Guide Release 2.0.1.0 Part Number A65435-01 |
|
This appendix describes the Oracle8 abstract data types (ADTs) that the AQ Driver uses to store Oracle Message Broker messages in AQ.
The AQ Driver uses these ADTs is work with messages using the JDBC Mode. For details on configuring Oracle Message Broker for using JDBC Mode, see, and for information on specifying ADT types for topics and queues, refer to "AQ Messages". In this appendix, we refer to this feature of the AQ Driver as, JMS ADTs. The JMS ADTs define the data structures in Oracle8i, Oracle AQ Database Tables, that store Oracle Message Broker JMS messages. Using JMS ADTs, all of the data types available for a JMS message have corresponding types in the Oracle8 type system.
The JMS ADTs are defined as part of a PL/SQL package that is added to the Oracle8i Database Server during the Oracle Message Broker installation. The package includes PL/SQL procedures that support access to the ADTs using JDBC.
This appendix covers the following:
This appendix assumes that you have knowledge of the following:
The AQ Driver connects to AQ Queues that have the following characteristics:
The AQ Driver's JMS ADTs define abstract data types that store JMS messages in AQ tables. Five of the JMS ADTs store a particular JMS message type: map, stream, bytes, object, text. Another JMS ADT can store any of the JMS message types.
The AQ Driver maps data from the Oracle Message Broker JMS messages, to and from messages in AQ tables. These messages include components that are stored using SQL types. Table A-1 describes the mapping from JMS message Java types to SQL table types.
In the mapping shown in Table A-1, when a Java type is always mapped to the same SQL type, the name of the SQL type is specified. Using the JMS ADT, a SQL number
type holds either a Java int
, byte
, short
, boolean
, or float
. A type code determines the actual Java type stored in a SQL number
type. The "Type Code" column lists the values for each Java type.
The JMS ADT type ombaq_property
stores a message property. An array of instances of ombaq_property
stores all of the message properties set for a message. Table A-2 describes the fields in ombaq_property
.
The JMS ADT type ombaq_properties
is a varray
of type ombaq_property
. The maximum size of the varray is 1000.
The JMS specification requires that each name used for a property is unique within a message. This is not enforced by the JMS ADT. A PL/SQL client can enqueue a message with 10 properties, such that each property has the same name. If an Oracle Message Broker client dequeues the message, Oracle Message Broker coerces the duplicate property names by appending a string to the end of the duplicate property names.
The JMS ADT type ombaq_header
contains fields that are common to all JMS messages. Table A-3 describes the fields in ombaq_header
.
The JMS ADT type ombaq_text_msg
contains the fields needed to store a JMS text message. Table A-4 describes the fields in an ombaq_text_msg
.
When the Oracle Message Broker runtime dequeues a text message using the AQ Driver, it sets the value of the message body as shown in Table A-5.
When the Oracle Message Broker runtime enqueues a text message, it does the following:
null_flag
is set to 0, text_vc
is set to null and text_lob
is set to null
text_vc
, null_flag
is set to 0, text_vc
is set to the value of the message body, and text_lob
is set to null.
text_vc
, null_flag
is set to 0, text_vc
is set to null, and text_lob
is set to the value of the message body.
The JMS ADT type ombaq_bytes_msg
contains the fields needed to store a JMS bytes message. Table A-6 describes the fields in an ombaq_bytes_msg
.
When the Oracle Message Broker runtime dequeues a bytes message, it sets the value of the message body as shown in Table A-7.
bytes_vc | bytes_lob | Value of message body |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
When the Oracle Message Broker runtime enqueues a bytes message, it does the following:
bytes_vc
is set to null and bytes_lob
is set to null.
bytes_vc
, bytes_vc
is set to the value of the message body, and bytes_lob
is set to null.
bytes_vc
, bytes_vc
is set to null, and bytes_lob
is set to the value of the message body.
The JMS ADT type ombaq_object_msg
contains the fields needed to store a JMS object message. Table A-8 describes the fields in an ombaq_object_msg
.
When the Oracle Message Broker runtime dequeues an object message, it sets the value of the message body as shown in Table A-9.
object_vc | object_lob | Value of Message Body |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
When the Oracle Message Broker runtime enqueues an object message, it does the following:
object_vc
is set to null and object_lob
is set to null.
object_vc
, object_vc
is set to the value of the message body, and object_lob
is set to null.
object_vc
, object_vc
is set to null, and object_lob
is set to the value of the message body.
The JMS ADT type ombaq_stream_element
stores one element that has been set as part of a stream message body. An array of instances of ombaq_stream_element
is used to store the entire stream message body. Table A-10 describes the fields in an ombaq_stream_element
.
The JMS ADT type ombaq_stream_elements
is a varray of type ombaq_stream_element
. The maximum size of the varray is 5000.
The JMS ADT type ombaq_stream_msg
contains the fields needed to store a JMS stream message. Table A-11 describes the fields in an ombaq_stream_msg
.
Field | Type | Description |
---|---|---|
|
|
The header for the message |
|
|
The stream message body |
The JMS ADT type ombaq_map_element
is used to store one element that has been set as part of a stream message body. An array of instances of ombaq_map_element
is used to store the entire stream message body. Table A-12 describes the fields in an ombaq_map_element.
The JMS ADT ombaq_map_elements
is a varray
of type ombaq_map_element
. The maximum size of the varray is 5000.
The JMS specification requires that each name used for a map element is unique within a message. The JMS ADT does not enforce this restriction. A PL/SQL client can enqueue a map message with 10 map elements such that each map element has the same name. If an Oracle Message Broker client dequeues the message, Oracle Message Broker will coerce the duplicate map element names by appending a string to the end of the duplicate map element names.
The JMS ADT type ombaq_map_msg
contains the fields needed to store a JMS map message. Table A-13 describes the fields in an ombaq_map_msg.
Field | Type | Description |
---|---|---|
|
|
The header for the message |
|
|
The map message body |
The JMS ADT type ombaq_serial_msg
contains the fields needed to store any JMS message. This type is meant to store a stream of bytes that represents a JMS message. The stream of bytes is created by the Oracle Message Broker runtime. This type is not meant to support access by PL/SQL clients. Table A-14 describes the fields in an ombaq_serial_msg.
Field | Type | Description |
---|---|---|
|
|
Stores the stream of bytes if possible |
|
|
Stores the stream of bytes if serial_vc is too small |
When the Oracle Message Broker runtime dequeues an serial message, it sets the value of the message body as shown in Table A-15.
serial_vc | serial_lob | Value of Message |
---|---|---|
null |
null |
throw exception |
null |
non-null |
serial_lob |
non-null |
null |
serial_vc |
When the Oracle Message Broker runtime enqueues a message to a queue of type ombaq_serial_msg
, it does the following:
serial_vc
, serial_vc
is set to the value of the stream of bytes, and serial_lob is set to null.
The JMS ADTs are defined in PL/SQL packages included with the Oracle Message Broker. The JMS ADTs are installed during the AQ Driver specific installation tasks. Refer to the Oracle Message Broker Installation Guide for information on AQ Driver specific installation tasks.
This section covers the following:
AQ queues that are created using the JMS ADTs can be accessed with the Oracle Message Broker AQ Driver, or with any of the following clients:
The JMS specification includes constraints on a JMS message that must be satisfied to produce a valid JMS message. The PL/SQL JMS ADT definitions do not automatically imply that types created using the JMS ADT are valid JMS messages. For example, a valid instance of a ombaq_text_message
is not guaranteed to be a valid instance of javax.jms.TextMessage
. This limitation creates the following problems:
The Oracle Message Broker solves this problem using coercion. See "Coercion and Invalid Data" for more information on how the Oracle Message Broker handles coercion.
The Oracle Message Broker solves this problem using the PL/SQL Operational Interface Package (this package only supports text and bytes messages, and does not support other message types). See "Using the PL/SQL Operational Interface" for information on the facilities available in this package.
The Oracle Message Broker must be prepared to dequeue messages from AQ queues, when the message was created using JMS ADTs that do not satisfy the JMS specification. This is true even if PL/SQL helper packages attempt to verify the enqueued messages.
Table A-16 describes some of the ways in which an AQ JMS ADT message may not satisfy the JMS specification.
The general solution to these problems is coercion. That is, the Oracle Message Broker AQ Driver corrects the errors in an obvious manner and attempts to avoid losing data. The intent is to make the errors obvious to Oracle Message Broker developers so that they will notice what went wrong with the content of a message and will know how to correct the problem based on the coercion that the Oracle Message Broker performs.
This occurs when ombaq_type
indicates that num_value
will be used to store the value of the property, map element or stream element and num_value
is null. When this occurs the property, map element, or stream element is coerced to a string with a value of 'NO_VALUE_type' where type is determined by the value of ombaq_type
and is one of 'BOOLEAN', 'BYTE', 'SHORT', 'INT', 'LONG', 'FLOAT', 'CHAR'. The value of the property or map element name is not changed.
This occurs when ombaq_type
indicates that str_value
will be used to store the value of the property, map element or stream element and num_value
is null. When this occurs the property, map element or stream element is coerced to a string with a value of 'NO_VALUE_type' where type is determined by the value of ombaq_type
and is one of 'BYTE_ARRAY', 'DOUBLE', 'STRING'. The value of the property or map element name is not changed.
This occurs when ombaq_type
indicates that num_value
will be used to store the value of the property, map element or stream element and the value of num_value
exceeds the range supported by the Java primitive type. This can occur when ombaq_type
is one of 'OMBAQ_BOOLEAN', 'OMBAQ_BYTE', 'OMBAQ_SHORT',and 'OMBAQ_CHAR'. When this occurs, the property, map element or stream element is coerced to a string with a value of 'INVALID_VALUE_type_value'. type is replaced with one of 'BOOLEAN', 'BYTE', 'SHORT' or 'CHAR'. value is replaced with the original value that exceeded the range.
This occurs when ombaq_type
is null or has a value other than the valid subset from the set {'OMBAQ_BOOLEAN', 'OMBAQ_BYTE', 'OMBAQ_SHORT', 'OMBAQ_INT', 'OMBAQ_LONG', 'OMBAQ_FLOAT', 'OMBAQ_DOUBLE', 'OMBAQ_STRING', 'OMBAQ_BYTE_ARRAY', 'OMBAQ_CHAR'}. When this occurs the property, map element or stream element is coerced to a string with the value 'INVALID_TYPE'.
This occurs when ombaq_type
is 'OMBAQ_BYTE_ARRAY' and str_value
does not contain a byte array encoded as a string. The byte array encoded as a string must be a size that is a multiple of 2 and every character in the string must be one of '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', or 'f'. When this occurs, the property, map element or stream element is coerced to a string with a value of 'INVALID_VALUE_BYTE_ARRAY_value'. The value is replaced with the value of str_value
.
This occurs when the ombaq_properties
varray contains ombaq_property
instances that use the same value for the name field. This also occurs when the ombaq_map_elements
varray contains ombaq_map_element
instances that use the same value for the name field. When this occurs the duplicate names are made unique by replacing the duplicate names with 'DUPLICATE_NAME_integer_original_name'. integer is replaced with a small integer. The original_name is replaced with the value of name.
This occurs when the name field in ombaq_property
is invalid per the JMS specification. When this occurs the value of the name field is replaced with 'INVALID_NAME_integer'. integer is replaced with a small integer.
This occurs when the name field in ombaq_property
or ombaq_map_element
is null. When this occurs the value of the name field is replaced with 'NULL_NAME_integer'. integer is replaced with a small integer.
Assuming a queue table had been created with the type ombaq_text_msg
, a PL/SQL client can enqueue a message to this queue that uses this queue table as:
DECLARE enq_opt dbms_aq.enqueue_options_t; props dbms_aq.message_properties_t; msg aq.ombaq_text_msg; header aq.ombaq_header; msgid raw(16); BEGIN header := aq.ombaq_header(NULL, NULL, 'example', NULL); msg := aq.ombaq_text_msg(header, 0, 'example text body', NULL); dbms_aq.enqueue( queue_name => 'TextQueue', enqueue_options => enq_opt, message_properties => props, payload => msg, msgid => msgid); COMMIT; END;
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|