Messsage reader.
More...
#include <tkrzw_message_queue.h>
|
| | ~Reader () |
| | Destructor.
|
| |
| Status | Read (int64_t *timestamp, std::string *message, double wait_time=0) |
| | Reads a message from the queue.
|
| |
| Status | Wait (double wait_time=0) |
| | Waits until the reader is ready to read tne next message.
|
| |
| int64_t | GetTimestamp () |
| | Gets the latest timestamp.
|
| |
◆ ~Reader()
| tkrzw::MessageQueue::Reader::~Reader |
( |
| ) |
|
◆ Read()
| Status tkrzw::MessageQueue::Reader::Read |
( |
int64_t * | timestamp, |
|
|
std::string * | message, |
|
|
double | wait_time = 0 ) |
Reads a message from the queue.
- Parameters
-
| timestamp | The pointer to a variable to store the timestamp in milliseconds of the message. This is set if the result is SUCCESS or INFEASIBLE_ERROR. |
| message | The pointer to a string object to store the msssage data. |
| wait_time | The time in seconds to wait for the next log. Zero means no wait. Negative means unlimited. |
- Returns
- The result status. If the queue is in the read-only mode and there's no record to read, NOT_FOUND_ERROR is returned. If the time wait time passes, INFEASIBLE_ERROR is returned. If the writer closes the file while waiting, CANCELED_ERROR is returned.
◆ Wait()
| Status tkrzw::MessageQueue::Reader::Wait |
( |
double | wait_time = 0 | ) |
|
Waits until the reader is ready to read tne next message.
- Parameters
-
| wait_time | The time in seconds to wait for the next log. Zero means no wait. Negative means unlimited. |
- Returns
- The result status. If the queue is in the read-only mode and there's no record to read, NOT_FOUND_ERROR is returned. If the time wait time passes, INFEASIBLE_ERROR is returned. If the writer closes the file while waiting, CANCELED_ERROR is returned.
◆ GetTimestamp()
| int64_t tkrzw::MessageQueue::Reader::GetTimestamp |
( |
| ) |
|
Gets the latest timestamp.
- Returns
- The latest timestamp, or -1 if nothing has been read.