mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
broker and cluster: Wire up HookPublishEvent
This commit is contained in:
parent
621fd2ab39
commit
53236a184a
2 changed files with 12 additions and 0 deletions
|
@ -38,6 +38,8 @@
|
||||||
#include "zeek/iosource/Manager.h"
|
#include "zeek/iosource/Manager.h"
|
||||||
#include "zeek/logging/Manager.h"
|
#include "zeek/logging/Manager.h"
|
||||||
#include "zeek/logging/Types.h"
|
#include "zeek/logging/Types.h"
|
||||||
|
#include "zeek/plugin/Manager.h"
|
||||||
|
#include "zeek/plugin/Plugin.h"
|
||||||
#include "zeek/telemetry/Manager.h"
|
#include "zeek/telemetry/Manager.h"
|
||||||
#include "zeek/util.h"
|
#include "zeek/util.h"
|
||||||
|
|
||||||
|
@ -825,6 +827,10 @@ std::vector<broker::peer_info> Manager::Peers() const {
|
||||||
std::string Manager::NodeID() const { return to_string(bstate->endpoint.node_id()); }
|
std::string Manager::NodeID() const { return to_string(bstate->endpoint.node_id()); }
|
||||||
|
|
||||||
bool Manager::DoPublishEvent(const std::string& topic, cluster::detail::Event& event) {
|
bool Manager::DoPublishEvent(const std::string& topic, cluster::detail::Event& event) {
|
||||||
|
bool do_publish = PLUGIN_HOOK_WITH_RESULT(HOOK_PUBLISH_EVENT, HookPublishEvent(*this, topic, event), true);
|
||||||
|
if ( ! do_publish )
|
||||||
|
return true;
|
||||||
|
|
||||||
auto maybe_ev = zeek::cluster::detail::to_broker_event(event);
|
auto maybe_ev = zeek::cluster::detail::to_broker_event(event);
|
||||||
if ( ! maybe_ev )
|
if ( ! maybe_ev )
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include "zeek/cluster/Serializer.h"
|
#include "zeek/cluster/Serializer.h"
|
||||||
#include "zeek/cluster/cluster.bif.h"
|
#include "zeek/cluster/cluster.bif.h"
|
||||||
#include "zeek/logging/Manager.h"
|
#include "zeek/logging/Manager.h"
|
||||||
|
#include "zeek/plugin/Manager.h"
|
||||||
|
#include "zeek/plugin/Plugin.h"
|
||||||
#include "zeek/util.h"
|
#include "zeek/util.h"
|
||||||
|
|
||||||
using namespace zeek::cluster;
|
using namespace zeek::cluster;
|
||||||
|
@ -120,6 +122,10 @@ void Backend::DoReadyToPublishCallback(Backend::ReadyCallback cb) {
|
||||||
bool Backend::DoPublishEvent(const std::string& topic, cluster::detail::Event& event) {
|
bool Backend::DoPublishEvent(const std::string& topic, cluster::detail::Event& event) {
|
||||||
byte_buffer buf;
|
byte_buffer buf;
|
||||||
|
|
||||||
|
bool do_publish = PLUGIN_HOOK_WITH_RESULT(HOOK_PUBLISH_EVENT, HookPublishEvent(*this, topic, event), true);
|
||||||
|
if ( ! do_publish )
|
||||||
|
return true;
|
||||||
|
|
||||||
if ( ! event_serializer->SerializeEvent(buf, event) )
|
if ( ! event_serializer->SerializeEvent(buf, event) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue