20#ifndef ORES_NATS_DOMAIN_MESSAGE_HPP
21#define ORES_NATS_DOMAIN_MESSAGE_HPP
27#include <unordered_map>
58 std::vector<std::byte>
data;
66 std::unordered_map<std::string, std::string>
headers;
81inline std::span<const std::byte>
as_bytes(std::string_view s)
noexcept {
82 return {
reinterpret_cast<const std::byte*
>(s.data()), s.size()};
91inline std::string_view
as_string_view(
const std::vector<std::byte>& data)
noexcept {
92 return {
reinterpret_cast<const char*
>(data.data()), data.size()};
NATS transport layer — external message bus, cross-process connectivity.
Definition service_token_provider.hpp:27
std::string_view as_string_view(const std::vector< std::byte > &data) noexcept
Reinterprets a message's byte payload as a string_view.
Definition message.hpp:91
std::span< const std::byte > as_bytes(std::string_view s) noexcept
Reinterprets a string's character data as a read-only byte span.
Definition message.hpp:81
std::function< void(message)> message_handler
Callback type for incoming NATS messages.
Definition message.hpp:72
A received NATS message.
Definition message.hpp:40
std::string subject
The subject the message was published to.
Definition message.hpp:44
std::unordered_map< std::string, std::string > headers
NATS message headers (NATS 2.2+).
Definition message.hpp:66
std::string reply_subject
The reply-to subject, empty for one-way publishes.
Definition message.hpp:51
std::vector< std::byte > data
The message payload bytes.
Definition message.hpp:58