# What happens if I restart the apm when I still have messages in the queue? Is the messages still there?

**URL:** <https://discuss.elastic.co/t/what-happens-if-i-restart-the-apm-when-i-still-have-messages-in-the-queue-is-the-messages-still-there/258525>\
**Category:** APM\
**Tags:** server\
**Created:** [December 14, 2020, 3:14am UTC](https://discuss.elastic.co/t/what-happens-if-i-restart-the-apm-when-i-still-have-messages-in-the-queue-is-the-messages-still-there/258525 "2020-12-14T03:14:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![111395](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111395/32/76933_2.png) [@111395](https://discuss.elastic.co/u/111395)\
**Post date:** [December 14, 2020, 3:14am UTC](https://discuss.elastic.co/t/what-happens-if-i-restart-the-apm-when-i-still-have-messages-in-the-queue-is-the-messages-still-there/258525/1 "2020-12-14T03:14:18Z")

</div>

I think messages is there。

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [December 14, 2020, 3:39am UTC](https://discuss.elastic.co/t/what-happens-if-i-restart-the-apm-when-i-still-have-messages-in-the-queue-is-the-messages-still-there/258525/2 "2020-12-14T03:39:33Z")

</div>

Whe APM Server is stopped, it will first try to send all queued events to Elasticsearch. By default it will block for up to 5 seconds. This can be increased by modifying `apm-server.shutdown_timeout`: [https://www.elastic.co/guide/en/apm/server/current/configuration-process.html#shutdown\_timeout](https://www.elastic.co/guide/en/apm/server/current/configuration-process.html#shutdown_timeout)

---

<div class="post-metadata">

**Author:** ![111395](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111395/32/76933_2.png) [@111395](https://discuss.elastic.co/u/111395)\
**Post date:** [December 14, 2020, 3:53am UTC](https://discuss.elastic.co/t/what-happens-if-i-restart-the-apm-when-i-still-have-messages-in-the-queue-is-the-messages-still-there/258525/3 "2020-12-14T03:53:13Z")

</div>

Thank you for your reply。  
If the message is not consumed within five seconds，The rest of the meassages is lost?  
Then restart the apm server and the queue is new and empty。

---

<div class="post-metadata">

**Author:** ![axw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/axw/32/28197_2.png) [@axw](https://discuss.elastic.co/u/axw)\
**Post date:** [December 14, 2020, 4:11am UTC](https://discuss.elastic.co/t/what-happens-if-i-restart-the-apm-when-i-still-have-messages-in-the-queue-is-the-messages-still-there/258525/4 "2020-12-14T04:11:00Z")

</div>

That is correct.

If you would like to make sure the events are not lost, then there is another option: you can configure APM Server to queue events on disk. When APM Server is restarted, the events written to disk will not be lost.

This is not documented for APM Server yet as we have not tested it, but you can try it out by following the documentation for Filebeat (the same config is supported in `apm-server.yml`):

> **[Configure the internal queue | Filebeat Reference \[7.10\] | Elastic](https://www.elastic.co/guide/en/beats/filebeat/current/configuring-internal-queue.html#configuration-internal-queue-disk)**

---

<div class="post-metadata">

**Author:** ![111395](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111395/32/76933_2.png) [@111395](https://discuss.elastic.co/u/111395)\
**Post date:** [December 14, 2020, 4:18am UTC](https://discuss.elastic.co/t/what-happens-if-i-restart-the-apm-when-i-still-have-messages-in-the-queue-is-the-messages-still-there/258525/5 "2020-12-14T04:18:40Z")

</div>

I understand. Thank you！

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 4, 2021, 12:18am UTC](https://discuss.elastic.co/t/what-happens-if-i-restart-the-apm-when-i-still-have-messages-in-the-queue-is-the-messages-still-there/258525/6 "2021-01-04T00:18:43Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
