--- a/src/PosixMQ.h Fri Mar 04 01:11:27 2022 +0100
+++ b/src/PosixMQ.h Fri Mar 04 01:40:50 2022 +0100
@@ -22,7 +22,7 @@
#include <cstring>
namespace relpipe {
-namespace in {
+namespace out {
namespace posixmq {
class PosixMQ {
@@ -41,11 +41,16 @@
}
static PosixMQ* open(std::string queueName) {
- mqd_t handle = mq_open(queueName.c_str(), O_RDONLY | O_CREAT);
+ mqd_t handle = mq_open(queueName.c_str(), O_RDWR | O_CREAT);
if (handle >= 0) return new PosixMQ(queueName, handle);
else throw std::logic_error("Unable to open PosixMQ: " + queueName + " error: " + strerror(errno));
}
+ void send(std::string message) {
+ int result = mq_send(handle, message.c_str(), message.size(), 0);
+ if (result) throw std::logic_error("mq_send() = " + std::to_string(result) + " error: " + strerror(errno));
+ }
+
std::string receive() {
char buffer[MSG_SIZE + 1];
memset(buffer, 0, MSG_SIZE + 1);