feat(messaging): implement P3 S-MESSAGING-01..04 Messaging queue, StorageQueue/OutboxInbox, and MessagingRpc adapter
This commit is contained in:
1 parent
aaeab50758
commit
60ee28e4ca
17 files changed
+4641
No files matched your search
@@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(VoidMessagingOnlyConsumer LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
find_package(Void REQUIRED CONFIG COMPONENTS Messaging)
|
||||
|
||||
add_executable(messaging_only main.cpp)
|
||||
target_link_libraries(messaging_only PRIVATE Void::Messaging)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME messaging_only COMMAND messaging_only)
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <Void/Messaging/Queue.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
int main()
|
||||
{
|
||||
Void::Messaging::InMemoryQueue q{};
|
||||
if (!q.create_queue(Void::Messaging::QueueConfig{.name = "q"}).has_value()) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (!q.create_group("q", Void::Messaging::GroupConfig{.name = "g"})
|
||||
.has_value()) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
Void::Messaging::Message m{};
|
||||
m.id = "m1";
|
||||
m.payload = {std::byte{0x41}};
|
||||
auto pub = q.publish("q", m, Void::Messaging::PublishDurability::Memory);
|
||||
if (!pub.has_value()) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
auto del = q.try_receive("q", "g");
|
||||
if (!del.has_value() || !del->has_value()) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (!q.ack((*del)->receipt).has_value()) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (!q.close_and_join().has_value()) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in new issue
Block a user