7.1 OCI Streaming, OCI Queue & Messaging Patterns for Microservices

Key Takeaways

  • OCI Streaming keeps messages for 24 hours to 7 days, and neither the retention period nor the partition count can be changed after the stream is created.

  • Each Streaming partition supports 1 MB per second of writes and 5 GET requests per second per consumer group, with up to 50 consumer groups per stream.

  • OCI Queue visibility timeouts range from 1 second to 12 hours (default 30 seconds), and a message moves to the dead letter queue after the configured 1 to 20 delivery attempts.

  • Streaming's Kafka compatibility does not include Kafka Streams, log compaction, transactions, dynamic partition addition, or idempotent production.

Last updated: October 2026

5.3 OCI Streaming, OCI Queue & Messaging Patterns for Microservices

Enterprise Messaging Paradigms: Streams vs. Queues

Distributed enterprise architectures depend heavily on asynchronous messaging to decouple microservices, absorb unpredictable traffic surges, and guarantee data durability. However, cloud architects frequently conflate two fundamentally different messaging paradigms:

  1. Event Streaming (Log-Centric Pub/Sub): An immutable, distributed, append-only log where continuous sequences of events are written to partitioned streams. Messages are retained independently of consumer activity, enabling multiple independent consumer applications to read, track progress, and replay event history.
  2. Message Queuing (Point-to-Point Task Distribution): A transient buffer designed to decouple task producers from competing consumer workers. Messages are processed by whichever worker is available and are permanently deleted once acknowledged, with built-in mechanics for retries and dead-letter handling.

On Oracle Cloud Infrastructure, OCI Streaming Service (OSS) addresses the event streaming model, while OCI Queue provides the point-to-point task queue model.


OCI Streaming Service (OSS) Architecture

OCI Streaming is a fully managed, scalable, durable, and highly available real-time event ingestion and streaming platform. It provides a serverless alternative to deploying, patching, and managing self-hosted Apache Kafka clusters.

Stream Pool (KMS Encryption, Private VCN Endpoint, Kafka Settings)
  └── Stream: OrdersStream (Retention: 7 Days)
        ├── Partition 0 ──[Offset 0, 1, 2, 3...] ──> Consumer A (Group 1)
        ├── Partition 1 ──[Offset 0, 1, 2, 3...] ──> Consumer B (Group 1)
        └── Partition 2 ──[Offset 0, 1, 2, 3...] ──> Consumer C (Group 1) & Consumer X (Group 2)

Core Structural Components

  • Stream Pools: A logical grouping and administrative boundary for multiple streams. Stream pools define shared security configurations, including Customer-Managed Encryption Keys (CMEK) via OCI Vault, private endpoint VCN attachment, and Kafka connection settings.
  • Streams: A partitioned log of messages, created within a stream pool. Retention is set at creation between 24 hours and 7 days and cannot be changed later.
  • Partitions: The fundamental unit of scalability, throughput, and parallelism in OCI Streaming. Sequential message ordering is strictly guaranteed within a single partition, but ordering is not guaranteed across different partitions.
  • Message Keys: When producing a message, the producer specifies an optional message key. OCI Streaming hashes the key to assign the message to a specific partition. Messages with identical keys are guaranteed to land on the same partition in sequential order.
  • Consumer Groups: A coordinated group of consumer instances that divide stream partitions among themselves for parallel message consumption. Each partition is allocated to exactly one consumer within the group. Consumers commit their read offsets back to OCI Streaming, allowing the group to resume processing seamlessly without duplicating records if an instance fails.
  • Replayability: Reading a message does not delete it. Messages persist until the retention window expires. A consumer group can reset its offset to rewind and replay historical data, and distinct consumer groups can consume the identical stream independently at their own pace.

Limits, Sizing & Apache Kafka Compatibility

OCI Streaming publishes these limits (Oracle's "Limits on Streaming Resources" page):

LimitValue
Write throughput per partition1 MB per second (no separate limit on the number of PUT requests)
Reads per partition5 GET requests per second per consumer group
Consumer groups per streamUp to 50
Maximum message size1 MB (a single request is also limited to 1 MB)
RetentionMinimum 24 hours, maximum 7 days
Changes after creationRetention and partition count cannot be changed once the stream exists
Default tenancy partition limit200 partitions (Universal Credits) or 50 (Pay As You Go)

Sizing Partitions

Because the partition count is fixed when the stream is created, size for peak load plus growth:

Partitions≥⌈Peak write MB/s1 MB/s per partition⌉\text{Partitions} \ge \left\lceil \frac{\text{Peak write MB/s}}{1\ \text{MB/s per partition}} \right\rceil

Worked example: an IoT platform writes 10 MB/s at peak and expects 50% growth within a year. It needs at least 10 partitions today and 15 for next year's peak, so creating the stream with 15 partitions avoids recreating it later. Each consumer group reads every partition independently, subject to 5 GET requests per second per partition for that group, so adding a second consuming application means adding a consumer group rather than more partitions.

Apache Kafka Compatibility

Streaming is compatible with most Kafka APIs, so many existing Kafka applications can move without code changes. Oracle lists support for the Kafka Producer, Consumer, Connect, Admin, and Group Management APIs (v0.10 and later). Oracle also lists features that are not implemented:

  • Kafka Streams
  • Log compaction
  • Transactions
  • Dynamic partition addition
  • Idempotent production

Connection details:

  • Bootstrap server: the regional endpoint on port 9092, for example streaming.us-phoenix-1.oci.oraclecloud.com:9092.
  • Authentication: SASL_SSL with the SASL/PLAIN mechanism. The username has the format {tenancyName}/{username}/{streamPoolId}, and the password is an auth token. The Java SDK can also authenticate with instance principals.
  • Durability: Streaming supports only lossless Kafka configurations. Data is replicated three ways, and producers receive an acknowledgment only after at least two replicas are in sync.
  • Kafka Connect: connectors can move data between Streaming and databases or object stores, for example through the JDBC connector.

OCI Queue Architecture & Worker Semantics

OCI Queue is a fully managed, serverless, point-to-point message queuing service built to handle high-throughput, bursty asynchronous task workloads without requiring partition sizing or cluster management.

Producer ──> OCI Queue ──> Visibility Timeout (30s) ──> Worker Pool (Competing Consumers)
                                │                              │
                       Processing Succeeds             Processing Fails 3x
                                │                              │
                       DELETE Message                  Dead-Letter Queue (DLQ)

Key Architectural Features

  • At-Least-Once Delivery: Guarantees that every message is delivered to a consumer at least once. Consumer workers must be designed to be idempotent.
  • Competing Consumers: Unlike stream partitions where only one consumer in a group reads a partition, all workers in a consumer pool pull from the same queue concurrently. The first available worker claims the next message.
  • Visibility Timeout: When a worker retrieves a message, OCI Queue hides it from other consumers for the visibility timeout (configurable at the queue from 1 second to 12 hours, default 30 seconds; consumers can set it per request and extend it while they work). During this interval, the message remains hidden from other workers. If the worker processes the task successfully, it invokes DeleteMessage using the unique message receipt handle. If the worker crashes or times out before deletion, the visibility timeout expires, and the message automatically reappears in the queue for another worker to process.
  • Dead-Letter Queues (DLQ): When a malformed message ("poison pill") repeatedly causes worker exceptions, retrying indefinitely would exhaust compute capacity and block queues. OCI Queue lets you set maximum delivery attempts from 1 to 20 at the queue level. A message delivered more times than that without being deleted moves to the queue's dead letter queue (DLQ) for investigation.
  • Retention and Size: Messages are kept until they are deleted or until the retention period expires (configurable from 10 seconds to 7 days, default 1 day). Messages can be up to 256 KB.
  • Channels and Consumer Groups: Channels are on-demand destinations inside a queue, so producers can publish to a specific channel and consumers can read from it (up to 256 channels per queue). Consumer groups let one queue fan out messages to several independent consuming applications.
  • Protocols: OCI Queue can be used through its REST API or the industry-standard STOMP protocol, and Connector Hub can move queue messages to Functions, Notifications, Object Storage, or Streaming.

Decision Framework: OCI Streaming vs. OCI Queue

Selecting between OCI Streaming and OCI Queue is a foundational architectural choice on the 1Z0-997-26 examination:

Evaluation DimensionOCI Streaming Service (OSS)OCI Queue
Core ParadigmDistributed Append-Only Event LogPoint-to-Point Task Queue
Ordering GuaranteeStrict total order within a partitionBest-effort order across workers
Message LifecyclePersists until retention expires (24 hours to 7 days)Kept until a consumer deletes it or retention (10 s to 7 days) expires
Consumption ModelConsumer Groups tracking partition offsetsCompeting workers claiming individual tasks
ReplayabilityYes (can rewind offsets to re-read history)No (once deleted, messages are gone)
Capacity PlanningPartition count fixed at creation (1 MB/s write per partition)No partitions to size
Failure HandlingConsumer application manages error offsetsNative Visibility Timeout & Dead-Letter Queue
Ecosystem ProtocolApache Kafka API (SASL/PLAIN) & OCI RESTOCI REST API & STOMP protocol
Ideal WorkloadsIoT ingest, log aggregation, event sourcing, CQRSBatch jobs, PDF/image processing, decoupled tasks
Loading diagram...
OCI Streaming Event Hub vs OCI Queue Worker Task Distribution
Test Your Knowledge

A utility ingests telemetry at a peak of 18 MB/s today and expects the peak to reach 24 MB/s within a year. Two independent applications must each process every reading, and readings for each meter must stay in order. How should the architect create the stream?

A

9 partitions now, adding more partitions later as the traffic grows over the year

B

18 partitions sized for today's peak, with both applications sharing one consumer group

C

At least 24 partitions, the meter ID as the key, and one consumer group per application

D

OCI Queue with two worker pools, because queues keep per-meter ordering

Test Your Knowledge

An enterprise insurance platform processes submitted accident claims by converting uploaded PDF documents into encrypted TIFF archives. Conversion tasks require between 20 and 80 seconds of compute time depending on document complexity. Occasionally, a corrupted PDF causes an unhandled memory exception in the worker application. The architect must implement an asynchronous task distribution architecture where tasks are distributed among a pool of competing worker VMs, failed tasks are retried up to three times before being quarantined for administrative inspection, and successful tasks are purged immediately. Which service should the architect select?

A

OCI Queue with a 120-second visibility timeout and a dead letter queue after 3 deliveries

B

OCI Streaming with 24-hour retention and a single partition to keep conversions in sequence

C

OCI Events with a rule that routes each upload directly to a Notifications topic

D

API Gateway with an HTTP backend that points to an autoscaling Compute instance pool

Sections you finish are checked off in the contents.