Overview
OmniView uses Oracle Advanced Queuing (AQ) subscriber mechanisms to receive trace messages from the database. Each OmniView instance registers as a unique subscriber to ensure reliable message delivery.Register_Subscriber
Registers a new subscriber to theOMNI_TRACER_QUEUE, allowing it to receive trace messages.
Procedure Signature
Omni_Tracer.sql:177-200
Parameters
Unique name for the subscriber. OmniView generates names in the format
SUB_<UUID> (e.g., SUB_A3F2E8C1_9D4B_4F7A_B2E6_1C8D5A9F3E7B).Usage from PL/SQL
Error Handling
ORA-20001: NULL subscriber name
ORA-20001: NULL subscriber name
Raised when
subscriber_name_ is NULL or empty.Omni_Tracer.sql:182-184
ORA-24034: Subscriber already exists
ORA-24034: Subscriber already exists
Silently succeeds if the subscriber is already registered (idempotent operation).
Omni_Tracer.sql:194-195
Other errors
Other errors
Rolls back the autonomous transaction and re-raises the exception.
The procedure uses
PRAGMA AUTONOMOUS_TRANSACTION to ensure subscriber registration is committed independently of the calling transaction.Dequeue_Array_Events
Bulk dequeues messages from the queue for a specific subscriber. This is the primary method OmniView uses to retrieve trace messages.Procedure Signature
Omni_Tracer.sql:273-320
Parameters
Input Parameters
Name of the subscriber to dequeue messages for. Must match a previously registered subscriber.
Maximum number of messages to dequeue in a single call. OmniView typically uses 1000.
Time in seconds to wait for messages. Use:
DBMS_AQ.NO_WAIT(0): Return immediately if no messagesDBMS_AQ.FOREVER(-1): Wait indefinitely- Positive number: Wait specified seconds
Output Parameters
Array of message payload objects. Each contains a BLOB with JSON data.
Array of RAW(16) message IDs corresponding to the dequeued messages.
Actual number of messages dequeued (may be less than
batch_size_).Dequeue Options
The procedure configures the following dequeue options:Omni_Tracer.sql:290-293
Specifies which subscriber’s messages to dequeue
Wait time for messages (configurable via parameter)
DBMS_AQ.FIRST_MESSAGE - Start from the first available messageDBMS_AQ.IMMEDIATE - Remove messages from queue immediatelyError Handling
ORA-25228: No messages available
ORA-25228: No messages available
Returns empty arrays with count 0 when no messages are available.
Omni_Tracer.sql:311-316
Other errors
Other errors
Re-raises any other exceptions for the caller to handle.
Subscriber Registration Flow
OmniView follows this process to register and manage subscribers:Generate subscriber name
OmniView generates a unique subscriber name using UUID v4.Example:
subscriber_service.go:76-84
SUB_A3F2E8C1_9D4B_4F7A_B2E6_1C8D5A9F3E7BStore subscriber locally
The subscriber information is stored in OmniView’s BoltDB configuration.
subscriber_service.go:38-50
Register in Oracle
OmniView calls the
Register_Subscriber procedure via PL/SQL.subscriptions.go:18-20
Go Integration
OmniView’s Go code interacts with the subscriber procedures through the Oracle adapter.Subscriber Domain Object
subscriber.go:6-10
Unique subscriber name (e.g.,
SUB_A3F2E8C1_9D4B_4F7A_B2E6_1C8D5A9F3E7B)Number of messages to dequeue per batch (default: 1000)
Seconds to wait for messages (default: 5)
Bulk Dequeue Implementation
OmniView uses C bindings to efficiently dequeue and process messages:queue.go:45-96
OmniView uses custom C bindings (
DequeueManyAndExtract) for performance optimization when dequeuing large batches of messages.Event Listener Loop
OmniView runs a blocking consumer loop for each subscriber:tracer_service.go:46-70
Queue Depth Monitoring
OmniView can check the number of pending messages for a subscriber:queue.go:18-43
Subscriber name to check queue depth for
Name of the queue table (typically generated by Oracle AQ)
READY state for the specified subscriber.
Performance Considerations
Batch Size
The default batch size of 1000 messages balances memory usage and throughput:- Smaller batches (100-500): Lower memory usage, more database round trips
- Larger batches (1000-5000): Better throughput, higher memory usage
Wait Time
The default wait time of 5 seconds prevents excessive polling:- Shorter wait (1-2s): More responsive, higher CPU usage
- Longer wait (10-30s): Lower CPU usage, delayed message processing
Sharded Queue Benefits
The sharded queue architecture enables:- Multiple subscribers can dequeue in parallel without contention
- Messages are distributed across 4 shards for load balancing
- High-throughput scenarios benefit from parallel processing
Troubleshooting
Subscriber not receiving messages
Subscriber not receiving messages
Possible causes:
- Subscriber not registered: Check
ALL_QUEUE_SUBSCRIBERS - Queue not started: Verify queue status in
USER_QUEUES - Wrong subscriber name: Ensure exact match including case
ORA-25228: Timeout while dequeuing
ORA-25228: Timeout while dequeuing
This is normal behavior when no messages are available within the wait time.Solution: The Go code handles this gracefully and returns empty results.
High memory usage
High memory usage
Large batch sizes can consume significant memory, especially with large message payloads.Solution: Reduce the
BatchSize in the subscriber configuration.Messages backing up in queue
Messages backing up in queue
Subscriber may not be processing messages fast enough.Solution:
- Check
CheckQueueDepth()to monitor queue depth - Increase subscriber
BatchSize - Add more subscriber instances (different subscriber names)
Related Topics
OMNI_TRACER_API Package
Overview of the complete package
Trace_Message
Learn how to send trace messages