Skip Headers

Oracle9i Application Developer's Guide - Advanced Queuing
Release 2 (9.2)

Part Number A96587-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

6
Frequently Asked Questions

This section answers some of the most commonly asked questions about Advanced Queuing. This chapter discusses questions in the following areas:

General Questions

How are messages that have been dequeued but are still retained in the queue table accessed?

Access messages using SQL. Messages in the queue table (either because they are being retained or because they have not yet been processed). Each queue has a view that you can use (see "Selecting the Number of Messages in Different States for the Whole Database" ).

Message retention means the messages are there, but how does the subscriber access these messages?

Typically we expect the subscriber to access the messages using the dequeue interface. If, however, you would like to see processed or waiting messages, you can either dequeue by message id or use SQL.

Can the sort order be changed after the queue table is created?

You cannot change the sort order for messages after you have created the queue table.

How do I dequeue from an exception queue?

The exception queue for a multiconsumer queue must also be a multiconsumer queue.

Expired messages in multiconsumer queues cannot be dequeued by the intended recipients of the message. However, they can be dequeued in the REMOVE mode once (only once) using a NULL consumer name in dequeue options. Messages can also be dequeued from an exception queue by specifying the message ID.

Expired messages can be dequeued only by specifying message ID if the multiconsumer exception queue was created in a queue table without the compatible parameter or with the compatible parameter set to '8.0'

What does the latency parameter mean in scheduling propagation?

If a latency less than 0 was specified in the propagation schedule, the job is rescheduled to run after the specified latency. The time at which the job actually runs depends on other factors, such as the number of ready jobs and the number of job_queue_processes. It may also be affected by the value for job_queue_interval. Please refer to the MANAGING JOB QUEUES chapter of the Oracle9i Database Administrator's Guide for more information on job queues and SNP background processes.

How can I control the tablespaces in which the queue tables are created?

You can pick a tablespace for storing the queue table and all its ancillary objects using the storage_clause parameter in DBMS_AQADM.CREATE_QUEUE_TABLE. However, once you pick the tablespace, all IOTs and indexes created for that queue table will go to the specified tablespace. Currently, you do not have a choice to split them between different tablespaces.

How do you associate Oracle Parallel Server instance affinities with queue tables?

In 8.1 you can associate OPS instance affinities with queue tables. If you are using q1 and q2 in different instances, you can use alter_queue_table (or even create queue table) on the queue table and set the primary_instance to the appropriate instance_id.

Can you give me some examples of a subscriber rule containing - message properties - message data properties.

Yes, here is a simple rule that specifies message properties - rule = 'priority 1';
here are example rules that specify a combination of message properties and data attributes: rule = 'priority 1 AND tab.userdata.sal 1000' rule = '((priority between 0 AND 3) OR correlation = 'BACK_ORDERS') AND tab.userdata.customer_name like ''JOHN DOE'')'

Note that user data properties or attributes apply only to object payloads and must be prefixed with tab.userdata in all cases. Check documentation for more examples.

Is registration for notification (OCI) the same as starting a listener?

No. Registration is an OCI client call to be used for asynchronous notifications (that is, push). It provides a notification from the server to the client when a message is available for dequeue. A client side function (callback) is invoked by the server when the message is available. Registration for notification is both nonblocking and nonpolling.

What is the use of non-persistent queues?

To provide a mechanism for notification to all users that are currently connected. The non-persistent queue mechanism supports the enqueue of a message to a non-persistent queue and OCI notifications are used to deliver such messages to users that are currently registered for notification.

Is there a limit on the length of a recipient list? Or on the number of subscribers for a particular queue?

Yes, 1024 subscribers or recipients for any queue.

How can I clean out a queue with UNDELIVERABLE messages?

You can dequeue these messages by msgid. You can find the msgid by querying the queue table view. Eventually the messages are moved to the exception queue (you must have the AQ background process running for this to happen). You can dequeue these messages from the exception queue with a normal dequeue.

Is it possible to update the message payload after it has been enqueued?

Only by dequeuing and enqueuing the message again. If you are changing the message payload, it is a different message.

Can asynchronous notification be used to invoke an executable every time there is a new message?

Notification is possible only to OCI clients. The client does not have to be connected to the database to receive notifications. The client specifies a callback function which will be executed for each message. Asynchronous Notification cannot be used to invoke an executable, but it is possible for the callback function to invoke a stored procedure.

Does propagation work from multiconsumer queues to single-consumer queues and vice versa?

Propagation from a multiconsumer queue to a single consumer queue is possible. The reverse is not possible (propagation is not possible from a single consumer queue).

Why do I sometimes get ORA-1555 error on dequeue?

You are probably using the NEXT_MESSAGE navigation option for dequeue. This uses the snapshot created during the first dequeue call. After that the other dequeue calls generate more undo which fills up the rollback segment and hence generates 1555.

The workaround is to use the FIRST_MESSAGE option to dequeue the message. This will reexecute the cursor and get a new snapshot. This might not perform as well, so we suggest you dequeue them in batches: FIRST_MESSAGE for one, and NEXT_MESSAGE for the next, say, 1000 messages, and then FIRST_MESSAGE again, and so on.

What are the different subscriber types recorded on the subscriber table?

The subscriber_types and their values are:

1 - Current Subscriber. The subscribers name, address and protocol are in the same row.

2 - Ex subscriber - A subscriber that unsubscribed but had agent entries in the history aq$_queuetable_h IOT.

4 - Address - Used to store addresses of recipients. The name is always NULL. The address is always non-NULL.

8 - Proxy for Propagation - The name is always NULL.

database proxy to local queues, address=NULL, protocol=0

database proxy to remote queues, address=dblink address, protocol=0

3rd party proxies, address = NULL, protocol = 3rd party protocol.

After a message has been moved to an exception queue, is there a way, using SQL or otherwise, of identifying which queue the message resided in before moving to the exception queue?

No, AQ does not provide this information. To get around this, the application could save this information in the message.

What is the order in which messages are dequeued if many messages are enqueued in the same second?

When the enq_time is the same for messages, there is another field called step_no that will be monotonically increasing (for each message that has the same enq_time). Hence this helps in maintaining the order of the messages. There will be no situation when both enq_time and step_no are the same for more than one message enqueued from the same session.

What happened to OMB? When should we use AQ and when should we use Oracle MessageBroker?

In Oracle9i, OMB functionality is provided in the Oracle database. So, if you are using the Oracle9i database, use the functionality offered by the database.

You do not need OMB.

With Oracle8i, use OMB in the following scenarios:

Use JMS functionality directly from the database in other scenarios.

Can I use AQ with Virtual Private Database?

Yes, you can specify a security policy with AQ queue tables. While dequeuing, use the dequeue condition (deq_cond) or the correlation ID for the policy to be applied. You can use "1=1" as the dequeue condition. If you do not use a dequeue condition or correlation ID, the dequeue will result in an error.

How do I clean up my retained messages?

The Advanced Queuing retention feature can be used to automatically clean up messages after the user-specified duration after consumption.

I have an application in which I inserted the messages for the wrong subscriber. How do I clean up those messages?

You can do a dequeue with the subscriber name or by message ID. This consumes the messages, which will be cleaned up after their retention time expires.

I'm running propagation between multiple Oracle databases. For some reason, one of the destination databases has gone down for an extended duration. How do I clean up messages for that destination?

To clean up messages for a particular subscriber, you can remove the subscriber and add the subscriber again. Removing the subscriber removes all the messages for that subscriber.

Messaging Gateway Questions

Where is the Messaging Gateway log file?

By default, the Messaging Gateway log file is in the $ORACLE_HOME/mgw/log directory. The location can be overridden by the log_directory parameter of the mgw.ora file. A new log file is created each time the MGW agent starts. The format of the log file name is "oramgw-hostname-timestamp-processid.log".

How do I interpret exception messages in a Messaging Gateway log file?

The exception messages logged to the MGW log file may include one or more linked exceptions ([Linked-exception]), which are helpful in determining the problem. A java.sql.SQLException may include an Oracle error message and possibly a PL/SQL stack trace.

The following example shows entries from a MGW log file when an invalid value (`bad_service_name') was specified for the database parameter of dbms_mgwadm.db_connect_info. This resulted in the MGW agent being unable to establish database connections.

>>2002-01-15 15:45:12  MGW  AdminMgr  0 LOG
Connecting to database using connect string = jdbc:oracle:oci8:@BAD_SERVICE_NAME
>>2002-01-15 15:45:15  MGW  Engine  0 3
Agent is shutdown.
oracle.mgw.admin.MgwAdminException: [241]  Failed to connect to database. SQL 
error: 12154, connect string: jdbc:oracle:oci8:@BAD_SERVICE_NAME
[...Java stack trace here...]

[Linked-exception]
java.sql.SQLException: ORA-12154: TNS:could not resolve service name
[...Java stack trace here...]

How do I know if the Messaging Gateway agent is running?

Use the MGW_GATEWAY view to show gateway status information. The AGENT_STATUS and AGENT_PING fields indicate the current agent status and whether it is active and responsive to pings. AGENT_STATUS progresses through the following values when the MGW agent is started:

  1. NOT_STARTED
  2. START_SCHEDULED
  3. STARTING
  4. INITIALIZING
  5. RUNNING

Will the Messaging Gateway agent automatically restart if the database shuts down or crashes while the agent is running?

The MGW agent may or may not automatically restart after a database shutdown or crash. The MGW agent should always be shut down before shutting down the database. If the MGW agent is running when a database SHUTDOWN NORMAL is done, the database will not shut down due to the database connections held by the MGW agent. For IMMEDIATE or ABORT the agent will not restart if the agent has time to exit normally; otherwise the agent will restart the next time the database is started.

Why does the database not shut down when the Messaging Gateway agent is running?

The MGW agent establishes connections with the database and those connections prevent the database from shutting down for a SHUTDOWN NORMAL command. Call dbms_mgwadm.shutdown to shut down the MGW agent before shutting down the database.

Why does MGW_GATEWAY view always show an AGENT_STATUS of START_SCHEDULED?

Messaging Gateway uses job queues in the Oracle database to start the MGW agent process. At least one job queue process must be configured to execute queued jobs in the background. The gateway job is scheduled to execute immediately, but will not do so until a job queue process is available. If the gateway status remains START_SCHEDULED for an extended period of time, it may indicate that the database instance has been started with no or too few job queue processes. The Messaging Gateway holds its job queue process for the lifetime of that MGW agent session.

You should verify that the database instances have been started, with enough job queue processes so one is available for use by Messaging Gateway. A minimum value of 2 is recommended.

init.ora parameters:

JOB_QUEUE_PROCESSES specifies the number of job queue processes for each instance.

Dynamic parameters:

ALTER SYSTEM SET JOB_QUEUE_PROCESSES = <number>;

After starting the Messaging Gateway agent, why does the MGW_GATEWAY view show an AGENT_STATUS of NOT_STARTED?

The MGW_GATEWAY view provides status information about the gateway agent. A NOT_STARTED status indicates that the agent is not running. If the MGW agent encounters a fatal error while starting or running, the LAST_ERROR_MSG field is nonnull.

Do the following:

  1. Check if a MGW log file has been generated and whether it indicates any errors. If a log file is not present, the gateway agent process was probably not started.
  2. Verify that the listener has been started.
  3. Verify that the values specified in tnsnames.ora and listener.ora are correct. Incorrect or mismatched values will prevent the listener from starting the MGW agent. process.
  4. Verify that the values specified in mgw.ora are correct. Incorrect values may cause the MGW agent to terminate due to abnormal error conditions.
  5. Correct the problem indicated by the error and start the MGW agent.
What if the MGW_GATEWAY view shows LAST_ERROR_MSG of "ORA-28575: unable to open RPC connection to external procedure agent?"

What if MGW_GATEWAY view shows LAST_ERROR_MSG of "ORA-32830: result code <value> returned by Messaging Gateway agent?"

The result code may be one of the following:

-1...An error occurred starting the Java Virtual Machine (JVM). Check the MGW log file for an entry that contains one of the following lines.

Verify that the Java version you are using is correct. Verify that your operating system version and patch level are sufficient for the JDK version. Verify that you are using a reasonable value for the JVM heap size. The heap size is specified by the max_memory parameter of dbms_mgwadm.alter_agent.

Verify that the CLASSPATH set in mgw.ora contains mgw.jar. For example:

set CLASSPATH=<ORACLE_HOME>/mgw/classes/mgw.jar

-2...An error occurred reading mgw.ora. Verify that the file is readable.

-3...An error occurred creating the MGW log file. Verify that the log directory is writeable. The default location is <ORACLE_HOME>/mgw/log.

-100...The MGW agent JVM encountered a runtime exception or error on startup.

-101...The MGW agent shut down due to a fatal error. Check the MGW log file.

Why does the Messaging Gateway log file show "ORA-01034: ORACLE not available" when attempting to start Messaging Gateway agent?

This error may indicate that the database has not been started or that the environment used by the Messaging Gateway agent to connect to the database is not correct.

Example 1

If the MGW log file shows the following two Oracle errors

then the gateway agent is attempting to connect to the database using a local IPC connection, but the ORACLE_SID value is not correct.

A local connection is used when dbms_mgwadm.db_connect_info is called with a NULL value for the database parameter. If a local connection is desired, the correct ORACLE_SID value must be set in the MGW agent process. This can be done by adding the following line to mgw.ora.

set ORACLE_SID = <sid_value>



Note that ORACLE_SID need not be set if dbms_mgwadm.db_connect_info is called with a nonnull value for the database parameter. In this case the value should specify a net service name from tnsnames.ora.

Can I use an AQ single consumer queue as a propagation source?

No, only an AQ multi-consumer queue can be used as a propagation source queue.

When is a Messaging Gateway subscriber flagged as DELETE_PENDING removed?

An MGW subscriber will be flagged as DELETE_PENDING when dbms_mgwadm.remove_subscriber is called to remove the subscriber in a nonforced manner and either the MGW agent is not running or the agent is running but unable to perform all necessary clean up action at that time.

The MGW agent tries to remove a DELETE_PENDING subscriber:

  1. Each time dbms_mgwadm.remove_subscriber is called and the agent is running.
  2. Each time the MGW agent is started and it finds a DELETE_PENDING subscriber.

What is the maximum message size for AQ queues with RAW payload?

For AQ queues with RAW payload, the MGW agent can propagate messages of 32512 bytes or less. If the message size is larger than 32512 bytes, an error occurs when the agent attempts to enqueue or dequeue the message.

Which instance of Oracle Real Application Clusters is used for the Messaging Gateway agent?

The DBMS_MGWADM.STARTUP procedure submits a job queue job that starts the MGW agent external process when the job is executed. The instance and force can be used to control the job and instance affinity. By default the job is set up so that it can be run by any instance.

Propagation Questions

How can I control when message propagation occurs?

The MGW agent propagates messages when a propagation subscriber and schedule are configured for the same source queue, destination queue, and propagation type. You can control when propagation occurs by using dbms_mgwadm.enable_propagation_schedule and dbms_mgwadm.disable_propagation_schedule. By default, the propagation schedule is enabled when it is first created.

To create a propagation job that is initially disabled, call the following APIs in the indicated order:

  1. dbms_mgwadm.schedule_propagation
  2. dbms_mgwadm.disable_propagation_schedule
  3. dbms_mgwadm.add_subscriber

In release 9.2, the propagation schedule window parameters are not used.

How do I tell if messages are being propagated or moved to the exception queue?

The PROPAGATED_MSGS field of the MGW_SUBSCRIBERS view indicates how many messages have been successfully propagated. The EXCEPTIONQ_MSGS field indicates how many messages have been moved to the exception queue. Both these fields are reset to zero when the MGW agent is started.

When are messages moved to the propagation job exception queue?

If a MGW subscriber has been configured with an exception queue, the MGW agent will move messages to that exception queue the first time the MGW agent encounters a propagation failure due to a message conversion failure. A message conversion failure is indicated by oracle.mgw.common.MessageException in the MGW log file.

How do I recover from a message conversion failure? How do I continue processing when oracle.mgw.common.MessageException occurs?

If a message conversion failure occurs, oracle.mgw.common.MessageException is be logged to the MGW log file. If this occurs, the MGW agent probably cannot propagate the message causing the failure, and the propagation job will eventually be disabled.

If the log file indicates that the failure is due to an exception being raised in a transformation function used for an AQ dequeue (outbound propagation) or AQ enqueue (inbound propagation), verify that the transformation function is correct.

The MGW subscriber can be configured with a propagation exception queue. If a message conversion failure occurs, the MGW agent moves that message to the exception queue and then continues processing the propagation job.

How do I recover a failed propagation job?

If a propagation job runs into failures during processing, the MGW agent retries up to 16 times in an exponential backoff scheme before disabling the job.

To recover from a failed propagation job, do the following:

  1. Look at the MGW log file to determine the nature of the failure and correct the problem. For a message conversion failure, the MGW subscriber may need to be configured with an exception queue.
  2. Call dbms_mgwadm.reset_subscriber to reset the subscriber state. The MGW agent will attempt to recover the failed job and retry the propagation.

Why are messages moved to the default AQ exception queue upon propagation failures for an outbound propagation job?

The MAX_RETRIES parameter of AQ queues controls when AQ moves messages to an AQ exception queue for a failed dequeue attempt. The default value is NULL, which resolves to the value 5 in Oracle 9i.

If the parameter value is too small, messages in the queues can be moved into AQ exception queues if the MGW agent keeps running into failures when processing MGW subscribers. The AQ messages moved to AQ exception queues cause unrecoverable failures on the associated MGW subscribers. The MAX_RETRIES parameter for AQ queues that are used as a propagation source should be set to at least 16, and preferably a much larger value.

Transformation Questions

How do I use transformations?

An MGW subscriber can be configured with a transformation to use during an AQ dequeue for outbound propagation or an AQ enqueue for inbound propagation.

Do the following:

  1. Create the transformation function.
  2. Grant EXECUTE to the MGW agent user or to PUBLIC on the function and the object types it references.
  3. Call dbms_transform.create_transformation to register the transformation.
  4. Call dbms_mgwadm.add_subscriber to create a MGW subscriber using the transformation, or dbms_mgwadm.alter_subscriber to alter an existing subscriber.

The value passed in the transformation parameter for these APIs must be the registered transformation name and not the function name.

What happens if a transformation raises an exception?

If a transformation function raises an exception, a message conversion failure occurs and will be indicated by an oracle.mgw.common.MessageException in the MGW log file.

What transformation exceptions might I see in a Messaging Gateway log file?

The exception messages logged to the MGW log file often include a linked exception that provides additional information. If the linked exception is a java.sql.SQLException, it may include an Oracle error message and possibly a PL/SQL stack trace.

ORA-25229 is typically thrown by AQ when the transformation function raises a PL/SQL exception or some other Oracle error occurs when attempting to use the transformation.

Example 1
Errors occured during processing of subscriber SUB_MQ2AQ_2 
oracle.mgw.common.GatewayException: [722]  Message transformation failed; queue: 
MGWUSER.DESTQ_SIMPLEADT, transform: 
MGWUSER.MGW_BASIC_MSG_TO_SIMPLEADT
[...Java stack trace here...]
[Linked-exception]
oracle.mgw.common.MessageException: [722]  Message transformation failed; queue: 
MGWUSER.DESTQ_SIMPLEADT, transform: 
MGWUSER.MGW_BASIC_MSG_TO_SIMPLEADT
[...Java stack trace here...]
[Linked-exception]
java.sql.SQLException: ORA-25229: error on transformation of message msgid: 
9749DB80C85B0BD4E03408002086745E
ORA-00604: error occurred at recursive SQL level 1
ORA-00904: invalid column name
[...Java stack trace here...]

Possible causes of transformation exceptions include:

  1. The MGW agent user may not have EXECUTE privilege on the transformation function. It is not sufficient to grant EXECUTE to MGW_AGENT_ROLE and then grant MGW_AGENT_ROLE to the agent user. EXECUTE privilege on the transformation function must be granted directly to the agent user or to PUBLIC.
  2. The transformation function may not exist, even though the registered transformation does. If the transformation function does not exist, it must be re-created.
  3. The MGW agent user may not have EXECUTE privilege on the payload object type for the queue indicated in the exception. It is not sufficient to grant EXECUTE to MGW_AGENT_ROLE and then grant MGW_AGENT_ROLE to the agent user. EXECUTE privilege on the object type must be granted directly to the agent user or to PUBLIC.
Example 2
Errors occured during processing of subscriber SUB_AQ2MQ_2 
oracle.mgw.common.GatewayException: [703]  Failed to retrieve information for 
transformation mgwuser.SAMPLEADT_TO_MGW_BASIC_MSG
[...Java stack trace here...]

The transformation indicated in the exception may not exist. Note that the transformation parameter of dbms_mgwadm.add_subscriber specifies the name of the registered transformation and not the name of the transformation function.

Example 3
Errors occured during processing of subscriber SUB_AQ2MQ_2
oracle.mgw.common.GatewayException: [703]  Failed to retrieve information for 
transformation mgwuser.SAMPLEADT_TO_MGW_BASIC_MSG
[...Java stack trace here...]

[Linked-exception]
java.sql.SQLException: "from_type" is null
[...Java stack trace here...]

The MGW agent user may not have EXECUTE privilege on the object type used for the from_type of the transformation indicated in the exception. It is not sufficient to grant EXECUTE to MGW_AGENT_ROLE and then grant MGW_AGENT_ROLE to the agent user. EXECUTE privilege on the object type must be granted directly to the agent user or to PUBLIC.

Example 4
Errors occured during processing of subscriber SUB_AQ2MQ_2
oracle.mgw.common.GatewayException: [703]  Failed to retrieve information for 
transformation mgwuser.SAMPLEADT_TO_MGW_BASIC_MSG
[...Java stack trace here...]

[Linked-exception]
java.sql.SQLException: "to_type" is null
[...Java stack trace here...]

The MGW agent user may not have EXECUTE privilege on the object type used for the to_type of the transformation indicated in the exception. It is not sufficient to grant EXECUTE to MGW_AGENT_ROLE and then grant MGW_AGENT_ROLE to the agent user. EXECUTE privilege on the object type must be granted directly to the agent user or to PUBLIC.

JMS Questions

Why do the JMS dbms_aqadm.add_subscriber and dbms_aqadm.remove_subscriber calls sometimes hang when there are concurrent enqueues or dequeues happening on the same queue to which these calls are issued?

Add_subscriber and remove_subscriber are administrative operations on a queue. Though AQ does not prevent applications from issuing administrative and operational calls concurrently, they are executed serially. Both add_subscriber and remove_subscriber will block until pending transactions that have enqueued or dequeued messages commit and release the resources they hold. It is expected that adding and removing subscribers will not be a frequent event. It will mostly be part of the setup for the application. The behavior you observe will be acceptable in most cases. The solution is to try to isolate the calls to add_subscriber and remove_subscriber at the setup or cleanup phase when there are no other operations happening on the queue. That will make sure that they will not stay blocked waiting for operational calls to release resources.

Why do the TopicSession.createDurableSubscriber and TopicSession.unubscribe calls raise JMSException with the message "ORA - 4020 - deadlock detected while trying to lock object"?

CreateDurableSubscriber and unsubscribe calls require exclusive access to the Topics. If there are pending JMS operations (send/publish/receive) on the same Topic before these calls are issued, the ORA - 4020 exception is raised.

There are two solutions to the problem:

  1. Try to isolate the calls to createDurableSubscriber and unsubscribe at the setup or cleanup phase when there are no other JMS operations happening on the Topic. That will make sure that the required resources are not held by other JMS operational calls. Hence the error ORA - 4020 will not be raised.
  2. Issue a TopicSession.commit call before calling createDurableSubscriber and unsubscribe call.

Why doesn't AQ_ADMINISTRATOR_ROLE or AQ_USER_ROLE always work for AQ applications using Java/JMS API?

In addition to granting the roles, you would also need to grant execute to the user on the following packages:

Why do I get java.security.AccessControlException when using JMS MessageListeners from Java stored procedures inside Oracle8i JServer?

To use MessageListeners inside Oracle8i JServer, you can do one for the following

  1. GRANT JAVASYSPRIV to <userid>

Call dbms_java.grant_permission ('JAVASYSPRIV', 'SYS:java.net.SocketPermission', '*', 'accept,connect,listen,resolve');

Internet Access Questions

What is IDAP?

IDAP is Internet Data Access Presentation. IDAP defines the message structure for the body of a SOAP request. An IDAP message encapsulates the AQ request and response in XML. IDAP is used to perform AQ operations such as enqueue, dequeue, send notifications, register for notifications, and propagation over the Internet standard transports--HTTP(s) and e-mail. In addition, IDAP encapsulates transactions, security, transformation, and the character set ID for requests.

Which Web servers are supported for AQ Internet access functionality? Do I have to use Apache or can I use any Web server? Which servlet engines are supported for AQ Internet access? Can I use Tomcat?

Internet access functionality for AQ is supported on Apache. This feature is certified to work with Apache, along with the Tomcat or Jserv servlet execution engines. However, the code does not prevent the servlet from working with other Web server and servlet execution engines that support Java Servlet 2.0 or higher interfaces.

How do I get transactional behavior while using e-mail for AQ operations?

When you send IDAP messages through SMTP, each request is a separate transaction. The IDAP request must contain <AQXmlCommit/> as part of the message request to ensure that the operation is committed.

How does an Internet agent tie to an AQ agent stored in Oracle Internet Directory?

You can create an alias to an AQ agent in Oracle Internet Directory (OID). You can use these AQ agent aliases in the IDAP document sent over the Internet to perform AQ operations. Using aliases prevents exposing the internal name of the AQ agent.

Can I use my own authentication framework for authentication?

Yes, you can use your own authentication framework for authentication. HTTP POST requests to the AQ Servlet for AQ operations must be authenticated by the Web server. For example, in Apache, the following can be used to restrict access (using basic authentication) to servlets installed under aqserv/servlet. In this example, all users sending POST requests to the servlet are authenticated using the users file in /apache/htdocs/userdb.

<Location /aqserv/servlet>


<Limit POST>
AuthName "Restrict AQ Servlet Access"
AuthType Basic
AuthUserFile /apache/htdocs/userdb/users
require valid-user
</Limit>
</Location>

Oracle Internet Directory Questions--Global Agents, Global Events, and Global Queues

Which events can be registered in Oracle Internet Directory (OID)?

All types of events--system events, user events, and notifications on queues--can be registered with OID. System events are database startup, database shutdown, and system error events. User events include user log on and user log off, DDL statements (create, drop, alter), and DML statement triggers. Notifications on queues include OCI notifications, PL/SQL notifications, and e-mail notifications.

How do I use agent information stored in an OID?

You can create aliases for an AQ agent in OID. These aliases can be specified while performing AQ operations-enqueue, dequeue, and notifications. This is specifically useful while performing AQ operations over the Internet when you do not want to expose an internal agent name. An alias can be used in an AQ operation (IDAP request).

Transformation Questions

What happens to enqueue, dequeue, or propagation if the transformation mapping raises an error?

Enqueue and dequeue of the message will raise the error to the application. If the error occurs during the dequeue operation, the retry count of the message is incremented. If the retry count exceeds max_retries, the message is moved to the exception queue. If the error occurs during propagation, it is handled in a manner similar to dequeue; propagation of the message will fail. It will be attempted again and the message will be moved to the exception queue when retry count exceeds max_retries for the queue.

How do you do transformation of XML data?

Transformation of XML data can be done in one of the following ways:

Performance Questions

What is the maximum number of queues that a table can have without affecting performance?

Performance is not affected by the number of queues in a table.

When messages are moved from one queue to another using propagation, is there any optimization to move the messages in batches, rather than one at a time?

Yes, if it is optimized, propagation happens in batches.

If the remote queue is in a different database, we use a sequencing algorithm to avoid the need for a two-phase commit.

When a message needs to be sent to multiple queues in the same destination, it is sent multiple times. If the message needs to be sent to multiple consumers in the same queue at the destination, it is sent only once.

When is it useful to create indexes on a queue table? How do I create them?

Creating an index on the queue table is useful in the following scenarios:

  1. Dequeuing using correlation ID: To expedite dequeue, an index can be created on the column corr_id of the underlying queue table AQ$_<QueueTableName>.
  2. Dequeue using a condition: Assume this condition to the where-clause for the SELECT on the underlying queue table. An index on <QueueTableName> can be created to expedite the performance this SELECT statement.

What is the performance of Java (JMS) versus the PL/SQL API for AQ?

We do not have a specific performance evaluation of JMS versus the PL/SQL API. In general, the PL/SQL API is slightly better than the JMS API. The performance of the JMS and PL/SQL APIs in version 8.1.7 and higher should be comparable.

Installation Questions

How do I set up Internet access for AQ? What components are required?

See Chapter 17 for a full discussion. The following summarizes the steps required to set up Internet access for AQ queues:

  1. Set up the AQ Servlet: If you are using a servlet execution engine that supports the Java Servlet 2.2 specification (such as Tomcat), you must create a servlet that extends the oracle.AQ.xml.AQxmlServlet class. If you are using a servlet execution engine that supports the Java Servlet 2.0 specification (like Apache Jserv), you must create a servlet that extends the oracle.AQ.xml.AQxmlServlet20 class. Implement the init() method in the servlet to specify database connection parameters.
  2. Set up user authentication: Configure the Web server to authenticate all the users that send POST requests to the AQ Servlet. Only authenticated users are allowed to access the AQ Servlet.
  3. Set up user authorization: Register the AQ agent name that will be used to perform AQ operations using DBMS_AQADM.CREATE_AQ_AGENT. Map the AQ agent to the database users using DBMS_AQADM.ENABLE_DB_ACCESS.
  4. Now clients can write SOAP requests and send them to the AQ Servlet using HTTP POST.

How do I set up e-mail notifications?

Here are the steps for setting up your database for e-mail notifications:

  1. Set the SMTP mail host: Invoke DBMS_AQELM.SET_MAILHOST as an AQ administrator.
  2. Set the SMTP mail port: Invoke DBMS_AQELM.SET_MAILPORT as an AQ administrator. If not explicit, set defaults to 25.
  3. Set the SendFrom address: Invoke DBMS_AQELM.SET_SENDFROM.
  4. After setup, you can register for e-mail notifications using the OCI or PL/SQL API.

How do I perform AQ operations using e-mail?

See Chapter 17 for a full discussion. Currently, these operations are supported by Oracle Email Server 5.5 and higher. In summary, follow the steps for setting up Internet access for AQ. In addition, do the following:

  1. Create an AQ Internet agent to access the servlet using SMTP. This agent's digital certificate should be registered in LDAP. The certificate location must be specified when the agent is registered using the DBMS_AQADM.CREATE_AQ_AGENT procedure.
  2. Set up the Web server: Configure the Web server to receive requests from a user called ORACLE_SMTP_AGENT. This user will be used to access the AQ Servlet. Also specify setEmailServerAddr or setEmailServerHost in the init() method of the AQ Servlet.
  3. Set up Oracle Email Server:
    1. Run $ORACLE_HOME/admin/emailrule.sql to create an AQ schema on the e-mail server database.
    2. Create an e-mail account for the destination database in which the AQ operations are to be performed.
    3. Set up an e-mail rule for the destination database, so that it can route the AQ requests to the AQ Servlet on the web server. This can be done using the DBMS_AQST.REGISTER_DB procedure.
  4. Now clients can write IDAP requests and send to the AQ Servlet using e-mail.

How do I set up AQ propagation over the Internet?

See Chapter 17 for a full discussion. In summary, follow the steps for setting up Internet access for AQ. The destination databases need to be set up for Internet access, as follows:

  1. At the source database, create the dblink with protocol as http, and host and port of the Web server running the AQ Servlet with the username password for authentication with the Web server/servlet runner. For example, if the Web server is running on machine webdest.oracle.com and listening for requests on port 8081, then the connect string of the database is (DESCRIPTION=(ADDRESS=(PROTOCOL=http)(HOST=webdest.oracle.com)(PORT=8081)) If SSL is used, specify https as the protocol in the connect string. The database link is created as follows: create public database link propdb connect to john identified by welcome using '(DESCRIPTION=(ADDRESS=(PROTOCOL=http)(HOST=webdest.oracle.com)(PORT=8081))'; where user John with password Welcome is used to authenticate with the Web server, and is also known by the term AQ HTTP agent.
  2. If SSL is used, create an Oracle wallet and specify the wallet path at the source database execute dbms_aqadm.set_aq_propagationwallet('/home/myuid/cwallet.sso', 'welcome');
  3. Deploy the AQ Servlet at the destination database: Create a class AQPropServlet that extends oracle.AQ.xml.AQxmlServlet20 (if you are using a Servlet 2.0 execution engine like Apache Jserv) or extends oracle.AQ.xml.AQxmlServlet (if you are using a Servlet 2.2 execution engine like Tomcat). This servlet must connect to the destination database. The servlet must be deployed on the Web server in the path aqserv/servlet.


    NOTE:

    In Oracle9i, the propagation servlet name and deployment path are fixed, that is, they must be AQPropServlet and the aqserv/servlet respectively.


  4. At the destination database: Set up the authorization and authentication for the Internet user performing propagation, in this case, John.
  5. Start propagation at the source site by calling dbms_aqadm.schedule_propagation('src_queue', 'propdb').

Go to previous page Go to next page
Oracle
Copyright © 1996, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback