# Safely publish an event using libbeat

**URL:** <https://discuss.elastic.co/t/safely-publish-an-event-using-libbeat/52395>\
**Category:** Beats\
**Created:** [June 10, 2016, 1:23am UTC](https://discuss.elastic.co/t/safely-publish-an-event-using-libbeat/52395 "2016-06-10T01:23:42Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [June 10, 2016, 10:52am UTC](https://discuss.elastic.co/t/safely-publish-an-event-using-libbeat/52395/3 "2016-06-10T10:52:51Z")

</div>

options understood by `Publish`:

- `publisher.Sync`: block PublishEvent until either event has been send or event is dropped due to max\_retries
- `publisher.Guaranteed`: Never drop event. Keep event in output pipeline until ACKed by output. Can be used without sync for async guaranteed publishing.
- `publisher.Signal`: Callback for publish requests. E.g. used in filebeat in conjunction with `publisher.Guaranteed` to update file state offsets once events have been ACKed by output.

Filebeat supports both mode. Sync publishing: [https://github.com/elastic/beats/blob/master/filebeat/beater/publish.go#L110](https://github.com/elastic/beats/blob/master/filebeat/beater/publish.go#L110)  
and async publishing: [https://github.com/elastic/beats/blob/master/filebeat/beater/publish.go#L166](https://github.com/elastic/beats/blob/master/filebeat/beater/publish.go#L166)

If output (logstash/elasticsearch/...) is unresponsive and buffers in publisher pipeline (both, in sync and async mode) are full, PublishEvent(s) will block. In order to guarantee proper shutdown one has to dicsonnect from publisher pipeline via `Close`. Once `Close` is called, the publisher pipeline will not give any guarantees to events being queued. Events might be send or not.

---

_[View the full topic](https://discuss.elastic.co/t/safely-publish-an-event-using-libbeat/52395)._
