11#pragma once
22
33#include < ydb/core/persqueue/events/events.h>
4+ #include < ydb/core/persqueue/public/describer/describer.h>
45#include < ydb/public/api/protos/ydb_status_codes.pb.h>
56#include < ydb/public/api/protos/ydb_topic.pb.h>
67#include < ydb/library/actors/core/actorsystem_fwd.h>
@@ -13,6 +14,7 @@ namespace NKikimr::NPQ::NMLP {
1314
1415enum EEv : ui32 {
1516 EvReadResponse = InternalEventSpaceBegin (NPQ::NEvents::EServices::MLP),
17+ EvWriteResponse,
1618 EvChangeResponse,
1719 EvEnd
1820};
@@ -22,6 +24,18 @@ struct TMessageId {
2224 ui64 Offset;
2325};
2426
27+ struct TEvWriteResponse : public NActors ::TEventLocal<TEvWriteResponse, EEv::EvWriteResponse> {
28+
29+ NDescriber::EStatus DescribeStatus;
30+
31+ struct TMessage {
32+ size_t Index;
33+ // if message was written successfully, it will be set
34+ std::optional<TMessageId> MessageId;
35+ };
36+ std::vector<TMessage> Messages;
37+ };
38+
2539struct TEvReadResponse : public NActors ::TEventLocal<TEvReadResponse, EEv::EvReadResponse> {
2640
2741 TEvReadResponse (Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS, TString&& errorDescription = {})
@@ -41,7 +55,6 @@ struct TEvReadResponse : public NActors::TEventLocal<TEvReadResponse, EEv::EvRea
4155 TInstant SentTimestamp;
4256 TString MessageGroupId;
4357 };
44- // The original topic path (from request) -> TopicInfo
4558 std::vector<TMessage> Messages;
4659};
4760
@@ -61,11 +74,29 @@ struct TEvChangeResponse : public NActors::TEventLocal<TEvChangeResponse, EEv::E
6174 TMessageId MessageId;
6275 bool Success = false ;
6376 };
64- // The original topic path (from request) -> TopicInfo
6577 std::vector<TResult> Messages;
6678};
6779
80+ struct TWriterSettings {
81+ TString DatabasePath;
82+ TString TopicName;
83+
84+ struct TMessage {
85+ size_t Index;
86+ TString MessageBody;
87+ std::optional<TString> MessageGroupId;
88+ std::optional<TString> MessageDeduplicationId;
89+ std::optional<TString> SerializedMessageAttributes;
90+ TDuration Delay;
91+ };
92+ std::vector<TMessage> Messages;
93+
94+ bool ShouldBeCharged = false ;
95+
96+ TIntrusiveConstPtr<NACLib::TUserToken> UserToken;
97+ };
6898
99+ IActor* CreateWriter (const NActors::TActorId& parentId, TWriterSettings&& settings);
69100
70101struct TReaderSettings {
71102 TString DatabasePath;
0 commit comments