...
- Request method and URI
PUT [base_url]/topics/[topic]
- Request body
- Can be empty
- If provided, it is a JSON object containing topic properties
e.g. {"ttl" : [ttl-in-seconds]}
- Response
- 200 OK if the topic was created successfully
- 409 CONFLICT if a topic of the same name exists already
- 400 BAD REQUEST if the given TTL is invalid
Publish Message
- Request method and URI
POST [base_url]/topics/[topic]/publish
- Request body
JSON object containing payload and optionally transaction write pointer
{ "payload" : [ payload byte array ], "tx_write_ptr" : 12345L, "buffer" : true }
Fields:
i) payload - Contains the payload in the form of array of bytes
ii) tx_write_ptr (optional) - Contains a long that corresponds to a transaction write pointer. If this field is not provided, then the publishing of message is performed non-transactionally
iii) buffer (optional) - A boolean flag that indicates whether the messages can be buffered on the client side or should it the message be persisted in a Payload table
- Response :
404 NOT FOUND if topic is not present
200 OK if message is persisted - Commit Transactionally published messages
POST [base_url]/topics/[topic]/commit
Request body should contain the transaction write pointer that should be committed
{ "tx_write_ptr" : 12345L }
- Rollback Transactionally published messages
POST [base_url]/topics/[topic]/rollback
Request body should contain the transaction write pointer that should be rolled back
{ "tx_write_ptr" : 12345L }
Consume Message
- Request method and URI
POST [base_url]/topics/[topic]/poll
- Request body
An optional JSON object that contains the offset (either messageId or timestamp) and limit
{ "messageId" : [ message id byte array ], "timestamp" : 12454L, "inclusive" : true, "limit" : 40, "transaction" : [Serialized Transaction Object] }
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
TBA