What is a Subscriber?
In Oracle Advanced Queuing, a subscriber is a named consumer registered to receive messages from a queue. When a message is enqueued, Oracle automatically creates copies for each subscriber.Key Properties
domain/subscriber.go
- Name: Unique identifier for this consumer
- BatchSize: Performance tuning for bulk operations (default: 1000)
- WaitTime: How long to block on empty queue (default: 5 seconds)
Each subscriber maintains independent message state. If one subscriber crashes, others continue receiving messages without interruption.
Subscriber Registration Flow
1. Check for Existing Subscriber
On startup, OmniView checks if a subscriber already exists in local storage:subscribers/subscriber_service.go
Subsequent Runs: Retrieves existing subscriber from BoltDB
2. Generate Unique Subscriber Name
New subscribers get UUID-based names:subscribers/subscriber_service.go
SUB_F47AC10B_58CC_4372_A567_0E02B2C3D479
Hyphens are replaced with underscores to comply with Oracle identifier naming rules.
3. Register with Oracle AQ
The adapter calls the PL/SQL API to register the subscriber:oracle/subscriptions.go
4. Verify Subscriber Exists
Before registration, the system checks theALL_QUEUE_SUBSCRIBERS view:
oracle/subscriptions.go
Subscriber Lifecycle
Multi-Subscriber Support
Multiple OmniView instances can monitor the same database simultaneously:Scenario: Three Monitoring Instances
- Oracle creates 3 independent copies in
AQ$OMNI_TRACER_QUEUE - Each subscriber sees the message as
READY - Each instance dequeues its own copy independently
- No coordination required between instances
Message Independence
Each subscriber’s queue depth is independent. If Subscriber A has processed 100 messages but Subscriber B just started, Subscriber B will see all messages from the beginning (subject to retention policy).
Subscriber Configuration
Default Settings
subscribers/subscriber_service.go
Tuning Batch Size
| BatchSize | Use Case |
|---|---|
100 | Low-volume queues, minimal latency |
1000 | Default - balanced performance |
5000 | High-volume queues, bulk processing |
Tuning Wait Time
| WaitTime | Behavior |
|---|---|
0 | Non-blocking: Return immediately if empty |
5 | Default - good balance between CPU and responsiveness |
60 | Low-priority monitoring, reduce Oracle load |
-1 | Block indefinitely (not recommended) |
Message Routing Logic
How Oracle determines which messages a subscriber receives:1. Enqueue Time
- Inserts message into
AQ$OMNI_TRACER_QUEUE - Creates rows for all current subscribers
- Sets
MSG_STATE = 'READY'for each subscriber
2. Dequeue Operation
- Finds
READYmessages for this specific subscriber - Returns up to
BatchSizemessages - Marks retrieved messages as
PROCESSED - Removes processed messages after commit
3. Queue Depth Check
oracle/queue.go
Error Handling
Subscriber Already Exists
oracle/subscriptions.go
Subscriber Not Found in BoltDB
subscribers/subscriber_service.go
Storage Persistence
BoltDB Schema
- Restarts use the same subscriber (preserves queue position)
- Multiple runs don’t create duplicate subscribers
- Subscriber name remains consistent
Oracle Metadata
Best Practices
Should I reuse the same subscriber across restarts?
Should I reuse the same subscriber across restarts?
Yes. OmniView automatically reuses the subscriber stored in BoltDB. This ensures:
- You don’t miss messages sent while OmniView was stopped
- Queue depth remains consistent
- No orphaned subscribers accumulate
How many subscribers should I create?
How many subscribers should I create?
Create one subscriber per OmniView instance. Each instance automatically generates and persists its own subscriber on first run.Multiple subscribers are useful for:
- Different teams monitoring the same database
- Separate dev/test/prod environments
- Redundant monitoring instances
What happens if I delete the BoltDB file?
What happens if I delete the BoltDB file?
OmniView will generate a new subscriber with a different name. This means:
- Old subscriber remains in Oracle but becomes inactive
- New subscriber starts fresh (may miss recent messages)
- Old subscriber can be manually removed from Oracle if needed
Can I manually name subscribers?
Can I manually name subscribers?
Currently, subscriber names are auto-generated via UUID. Manual naming would require modifying
generateSubscriberName() in subscriber_service.go.The UUID approach ensures global uniqueness and avoids naming conflicts.Next Steps
Message Queuing
Deep dive into Oracle AQ and dequeue operations
Architecture
Understand how subscribers fit into the overall design