46 |
48 |
47 std::shared_ptr<PosixMQ> mq(PosixMQ::open(convertor.to_bytes(configuration.queue), configuration.unlinkOnClose)); |
49 std::shared_ptr<PosixMQ> mq(PosixMQ::open(convertor.to_bytes(configuration.queue), configuration.unlinkOnClose)); |
48 |
50 |
49 writer->startRelation(configuration.relation,{ |
51 writer->startRelation(configuration.relation,{ |
50 {L"queue", TypeId::STRING}, |
52 {L"queue", TypeId::STRING}, |
51 {L"message", TypeId::STRING} |
53 {L"text", TypeId::STRING}, |
|
54 {L"data", TypeId::STRING} |
52 }, true); |
55 }, true); |
53 |
56 |
54 for (int i = configuration.messageCount; i > 0; i--) { |
57 for (int i = configuration.messageCount; i > 0; i--) { |
|
58 std::string message = mq->receive(); |
|
59 |
|
60 std::stringstream hex; |
|
61 hex << std::hex << std::setfill('0'); |
|
62 for (uint8_t b : message) hex << std::setw(2) << (int) b; |
|
63 |
55 writer->writeAttribute(configuration.queue); |
64 writer->writeAttribute(configuration.queue); |
56 writer->writeAttribute(convertor.from_bytes(mq->receive())); |
65 writer->writeAttribute(convertor.from_bytes(message)); // Show at least ASCII characters + ... if UTF-8 decoding fails |
|
66 writer->writeAttribute(convertor.from_bytes(hex.str())); |
57 } |
67 } |
58 |
68 |
59 } |
69 } |
60 |
70 |
61 PosixMQCommand::~PosixMQCommand() { |
71 PosixMQCommand::~PosixMQCommand() { |