Obtaining a Data Cursor
Initialize a DIS SDK client instance as instructed in Initializing a DIS SDK Client Instance.
The getCursor_sample.py file provides a code sample. Configure the following parameters in this file:
partitionId="shardId-0000000000" streamname ="dis-test1" #Name of an existing stream. Configure the five cursors as follows: # startSeq and AT_SEQUENCE_NUMBER/AFTER_SEQUENCE_NUMBER are used together. r = cli.getCursor(streamname, partitionId, cursorType='AT_SEQUENCE_NUMBER', startSeq="0") # r = cli.getCursor(streamname, partitionId, cursorType='AFTER_SEQUENCE_NUMBER', startSeq="0") # timestamp and AT_TIMESTAMP are used together. # r = cli.getCursor(streamname, partitionId, cursorType='AT_TIMESTAMP',timestamp=1554694135190) # r = cli.getCursor(streamname, partitionId, cursorType='TRIM_HORIZON') # r = cli.getCursor(streamname, partitionId, cursorType='LATEST')
After configuring the parameters, run the getCursor_sample.py file to call getCursor_test. The following is an example response:
1 2 |
200
{"partition_cursor": "eyJnZXRJdGVyYXRvclBhcmFtIjp7InN0cmVhbS1uYW1lIjoiSCIsInBhcnRpdGlvbi1pZCI6InNoYXJkSWQtMDAwMDAwMDAwMCIsImN1cnNvci10eXBlIjoiQVRfU0VRVUVOQ0VfTlVNQkVSIiwic3RhcnRpbmctc2VxdWVuY2UtbnVtYmVyIjoiMCJ9LCJnZW5lcmF0ZVRpbWVzdGFtcCI6MTUzMjQyNDg4NzE1NH0"}
|
Last Article: Changing Partition Quantity
Next Article: Using the C SDK
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.