Skip to main content

Start event stream

GET 

/subscriptions/{subscription_id}/events

This endpoint starts a new stream for reading events from this subscription. The data will be automatically rebalanced between streams of one subscription.

  • The minimal consumption unit is a partition, so it is possible to start as many streams as the total number of partitions in event-types of this subscription.
  • The rebalance currently only operates with the number of partitions so the amount of data in event-- types/partitions is not considered during autorebalance.
  • The position of the consumption is managed by Mambu. The client is required to commit the cursors it gets in a stream.
Example Request
GET https://TENANT_NAME.mambu.com/api/v1/subscriptions/0691160a-b519-4595-b85c-a400fc73e96/events?stream_limit=10&stream_timeout=600 HTTP/1.1

Accept: application/json
apikey: string
X-Flow-Id: string

Client Rebalancing

  • If you need more than one client for your subscription to distribute load or increase throughput - you can read the subscription with multiple clients and Mambu will automatically balance the load across them.
  • Currently, the maximum number of supported clients per subscription is equal to the number of event types in the subscription multiplied by 3.
  • For example if there are two event types in the subscription, the total number of clients for the subscription is 6. The total of all the partitions within a subscription cannot be more than 100. This gives a maximum of 33 event types per subscription.
  • Recommendation: to improve throughput, maintain the same number of partitions and consumer clients from the start. This ensures a balanced distribution of the workload, minimises delays and simplifies rebalancing.
  • The API provides a guarantee of at-least-once delivery, this means that there are cases where duplicate events may be sent if there are errors committing events - a useful technique to detect and handle duplicates is to be idempotent and to check the eid field of event metadata.

Request

Responses

Stream started. Stream format is a continuous series of SubscriptionEventStreamBatch objects separated by \n

Response Headers
    X-Mambu-StreamId

    The id of this stream generated by Mambu. Must be used for committing events that were read by client from this stream.