...
- Request Schema
{ "transactionWritePointer" : [ "long", "null" ], "messages" : { "type" : "array", "items" : "bytes" }}
- Request body
- Can be avro Avro binary or JSON, based on the request - Content-Type: application/json or avro/binary
Schema Fields:
messages
- Contains an array of byte arrays that correspond to messagestransactionWritePointer
- Corresponds to a transaction write pointer.
...
- TopicId extends NamespaceId with a string that represents the topic name.
Creating Topic:
void create(TopicId topic) throws TopicAlreadyExistsException;
Updating Topic properties:
void update(TopicId topic, Map<String, String> properties) throws TopicAlreadyExistsException;
Deleting Topic:
void delete(TopicId topic) throws TopicNotFoundException;
Publishing Message:
For publishing messages non-transactionally:
...
For storing messages in the PayloadTable (requires Transaction - tx_write_ptr)
- void store(TopicId topic, byte[] message, Transaction transaction) throws TopicNotFoundException;
- void store(TopicId topic, List<byte[]> messages, Transaction transaction) throws TopicNotFoundException;
...
- void rollback(TopicId topic, Transaction transaction) throws TopicNotFoundException;
Consuming Message
...
:
For consuming messages non-transactionally:
- List<Record> List<Message> poll(TopicId topic) throws TopicNotFoundException;
- List<Record> List<Message> poll(TopicId topic, long timestampInMs, boolean inclusive) throws TopicNotFoundException;
- List<Record> List<Message> poll(TopicId topic, MessageId messageId, boolean inclusive) throws TopicNotFoundException;
- List<Record> List<Message> poll(TopicId topic, long timestampInMs, boolean inclusive, int maxMessages) throws TopicNotFoundException;
- List<Record> List<Message> poll(TopicId topic, MessageId, messageId, boolean inclusive, int maxMessages) throws TopicNotFoundException;
For consuming messages transactionally (timestamp used for polling will correspond to the publish timestamp):
- List<Record> List<Message> poll(TopicId topic, Transaction transaction) throws TopicNotFoundException;
- List<Record> List<Message> poll(TopicId topic, MessageId messageId, boolean inclusive, Transaction transaction) throws TopicNotFoundException;
- List<Record> List<Message> poll(TopicId topic, long timestampInMs, boolean inclusive, Transaction transaction) throws TopicNotFoundException;
- List<Record> List<Message> poll(TopicId topic, MessageId messageId, boolean inclusive, int maxMessages, Transaction transaction) throws TopicNotFoundException;
- List<Record> List<Message> poll(TopicId topic, long timestampInMs, boolean inclusive, int maxMessages, Transaction transaction) throws TopicNotFoundException;
Public Programmatic API
Consuming Message:
class Record Message {
MessageId messageIdid;
byte[] messagepayload;
}
class MessageId {
long publish_timestamp;
short seq_id;
long write_timestamp;
short p_seq_id;
}
...