Skip to content

Commit

Permalink
broker/cluster: Changes for auto_publish() deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
awelzel committed Nov 19, 2024
1 parent b41b8cd commit 1931185
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 16 additions & 10 deletions frameworks/broker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -276,19 +276,11 @@ define any event handlers for events that peers will send.
:linenos:
:tab-width: 4

There are two different ways to send events.

The first is to call the :zeek:see:`Broker::publish` function which you can
To send an event, call the :zeek:see:`Broker::publish` function which you can
supply directly with the event and its arguments or give it the return value of
:zeek:see:`Broker::make_event` in case you need to send the same event/args
multiple times. When publishing events like this, local event handlers for
the event are not called.

The second option is to call the :zeek:see:`Broker::auto_publish` function where
you specify a particular event that will be automatically sent to peers
whenever the event is called locally via the normal event invocation syntax.
When auto-publishing events, local event handlers for the event are called
in addition to sending the event to any subscribed peers.
the event are not called, even if a matching subscription exists.

.. literalinclude:: broker/events-connector.zeek
:caption: events-connector.zeek
Expand All @@ -301,6 +293,20 @@ to the ``zeek/events`` topic prefix you would receive events that are published
to topic names ``zeek/events/foo`` and ``zeek/events/bar`` but not
``zeek/misc``.


.. note::

In prior Zeek versions, :zeek:see:`Broker::auto_publish` was available to
automatically send events to peers whenever the event ere called locally via
the normal event invocation syntax. When auto-publishing events, local
event handlers for the event were called in addition to sending the
event to any subscribed peers.

:zeek:see:`Broker::auto_publish` has been deprecated due to its
`implicit nature <https://github.com/zeek/zeek/discussions/3637>`_.

.. deprecated:: 7.1

Remote Logging
--------------

Expand Down
6 changes: 0 additions & 6 deletions frameworks/cluster.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,6 @@ function to publish events, including:
- Standard function to send an event to all nodes subscribed to a given
topic

* - :zeek:see:`Broker::auto_publish`
- Automatically send an otherwise generated Zeek event to any interested
peers whenever it is locally dispatched.
- Avoid, since it is somewhat “magical”, unless you’ve got code
compartmentalization running with ``@ifdef`` directives.

* - :zeek:see:`Cluster::publish_hrw`
- Publishes an event to a node within a pool according to
Highest Random Weight (HRW) hashing strategy; see details below
Expand Down

0 comments on commit 1931185

Please sign in to comment.