...
- Request Schema
{ "tx_write_ptr" : string, "messages" : { "type" : "array", "items" : "bytes" }}
- Request body
- Can be avro binary or JSON, based on the request - Content-Type: application/json or avro/binary
Schema Fields:
i) messages - Contains an array of byte arrays that correspond to messages
ii) tx_write_ptr - Corresponds to a transaction write pointer.
Store Messages to Payload Table
...
POST [base_url]/topics/[topic]/rollback
Request schema should contain tx_write_ptr and the messages field is ignored
Response:
404 NOT FOUND if topic is not present
200 OK if messages are rolled back
Consume Message
- Request method and URI
POST [base_url]/topics/[topic]/poll
An optional JSON object that contains the offset (either messageId or timestamp) and limit
{ Schema{ "messageId"
: [ message id byte array ],: bytes, "timestamp"
:
12454Lstring,
"inclusive"
:
trueboolean,
"limit"
:
40int,
"transaction"
: [Serialized Transaction Object] }: bytes}
- Request body
- Can be avro binary or JSON, based on the request - Content-Type: application/json or avro/binary
Schema Fields:
i) messageId - Contains bytes that correspond to the messageId
ii) timestamp - Timestamp in ms
iii) inclusive -
iv) limit -
v) transaction -
- Request method and URI
POST [base_url]/topics/[topic]/poll
- Request body
Fields (all the fields are optional):
i) messageId: Provide a messageId as an offset into the topic message queue
ii) timestamp: Provide a timestamp as an offset into the topic message queue. Note that either messageId or timestamp needs to be provided. If both are provided, then messageId will be used.
iii) inclusive: This boolean flag indicates whether the offset is inclusive or exclusive
iv) limit: Max number of messages to return, by default it is set to 100.
v) transaction: If message polling needs to be done transactionally, then this
- Response :
404 NOT FOUND if topic is not present
200 OKResponse body contains an array of map of messageId to payload bytes (if no messages are available, then an empty list is returned)
[{ "messageId1" : payload1}, {"messageId2" : payload2}, ... ]
Programmatic
Programmatic API will be used by clients to publish/poll messages from the Messaging Service. They are just a wrapper around the REST APIs.
...