...
- 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
TBD: Do we need to support deletion of topic? If so, do we delete the topic only if all the entries are TTLed or can it be deleted before that?
Delete Topic
- Request method and URI
DELETE [base_url]/topics/[topic]
- Response
- 200 OK if the topic was deleted successfully
- 404 NOT FOUND if the topic is not present
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 }
Response :404 NOT FOUND if topic is not present
200 OK if messages are persisted
- 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 }
Response :
404 NOT FOUND if topic is not present
200 OK if messages are rolled backTBD: When or should the client retry? If it could not be rolled back, the transaction should be invalidated.
...
Programmatic API will be used by clients to publish/poll messages from the Messaging Service. They are just a wrapper around the REST APIs.
Creating Topic:
void create(TopicId topic) throws TopicAlreadyExistsException;
Deleting Topic:
void delete
Publishing Message:
Consuming Message:
...