Technical Webinar5 - Streaming API
Technical Webinar5 - Streaming API
API.
Subscribe to real time data streaming from
Mambu.
2. Use cases
6. Questions?
Simple at first... ...but after a while
Consumer
EVENT Consumer
Consumer
EVENT
NT
EVE
EVENT Consumer
EV
EN
T
EVENT
Consumer
Consumer
Why Streaming API. Abstract implementation via REST API
STREAMING API
A high throughput, near real time
CONNECTION CONNECTION
Request Request
OPENS OPENS
Response
Event
Request
Response Event
Event
Request
Response
Event
Event
Request
Response
CONNECTION CONNECTION
CLOSES CLOSES
Streaming API.
○ Producer - mambu
■ Topic :
● Configure the payload to be sent to a topic as a message and when.
● Unique auto generated entity for each combination of mambu instance and event type
● Partitions
○ Events of event types are stored in
partitions
○ Offsets
○ By default, current implementation, each
○ Offset has a meaning for only specific partition
event types stores its events in 3
■ For example, offset 3 partition 1 holds an event different to offset 3
partitions
in partition 0
○ Each event in each partition is stored in
○ Ordering is guaranteed only within a partition
ordered fashion, and each event will get its
own incremental id called offset.
Producer side of the API.
○ Event & Partition continued...
○ Events in the partition are stored only for a limited time. Current TTL duration is 96 hours
Consumer side of the API.
Owning Application & Consumer Group
A unique subscription to topics Open one or more streams from Commit cursor found in the event Deleting the subscription after event
comprises of: consuming client application to a batches back to Mambu after consumption to reset the cursor
● owning_application , topic through the subscription ID: consumption. offset.
● consumer_group ● Read events sent on the stream The cursor should be committed in
● event_types (Topic Name). as chunk/batch; max 60 seconds, otherwise the POST
● Commit chunk based on the operation should be re-done.
cursor token of the batch.
Headers
Headers Headers Headers - ApiKey
- ApiKey - ApiKey - ApiKey - ContentType
- ContentType - ContentType - ContentType
- X-Mambu-StreamId
https://api.mambu.com/CNNmZrTm3GDuWN/index.html#using-the-streaming-api
Structure of Batch.
JSON Structure of a Batch
Stream configuration.
Empty Batch
● Batch 1
○ Events
■ Event 1 ● batch_limit = 3
■ Event 2 ● batch_flush_timeout = 2 seconds (default - 30 seconds)
■ Event 3
● Batch 2 ● batch_limit = 3
○ Events ● batch_flush_timeout = 2 seconds (default - 30 seconds)
■ Event 4
● Stream Configuration
○ Configuring empty batches writing
○ Configuring batch flush timeout
○ Configuring stream timeout
● Stream Reading
○ How many streams can be opened for a
subscription topic
○ Client Rebalancing
https://support.mambu.com/docs/streaming-api
Demo.
● Stream Reading
○ How an empty batch will look?
○ How a batch with events will look?
● Cursor Commit
○ How to commit the cursor of a received batch?
○ Configuring cursor commit timeout
https://support.mambu.com/docs/streaming-api
Questions.
Useful links/ examples.
● Mambu support pages:
○ https://support.mambu.com/docs/streaming-api