# Why is implementing a queue an anti-pattern?

**URL:** <https://community.temporal.io/t/why-is-implementing-a-queue-an-anti-pattern/4081>\
**Category:** Community Support\
**Tags:** general-impl\
**Created:** [February 26, 2022, 4:01am UTC](https://community.temporal.io/t/why-is-implementing-a-queue-an-anti-pattern/4081 "2022-02-26T04:01:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![evanlimanto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/evanlimanto/32/1794_2.png) [@evanlimanto](https://community.temporal.io/u/evanlimanto)\
**Post date:** [February 26, 2022, 4:01am UTC](https://community.temporal.io/t/why-is-implementing-a-queue-an-anti-pattern/4081/1 "2022-02-26T04:01:41Z")

</div>

Hi! I’m trying to understand this statement more under [Temporal Antipatterns](https://docs.temporal.io/docs/server/production-deployment/#temporal-antipatterns): “Trying to implement a queue in a workflow (because people hear we replace queues)”.

I couldn’t find any prior discussion on this, and would appreciate some elaboration on what “queue” means here and why exactly this is an anti-pattern. Thanks!

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [February 26, 2022, 6:55pm UTC](https://community.temporal.io/t/why-is-implementing-a-queue-an-anti-pattern/4081/2 "2022-02-26T18:55:40Z")

</div>

Hi @evanlimanto I believe the point that statement is trying to make is what Maxim talks about in [this](https://youtu.be/6T6zVZHU7_Q?t=317) video (time included but watch the whole thing 🙂 )  
Basically that Temporal eliminates many hard problems for you and for some applications can eliminate their use of some queueing technologies.  
I don’t think it means you are not allowed to use some programming language queuing structures inside your workflow code (which you absolutely can)

---

<div class="post-metadata">

**Author:** ![joebowbeer](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/joebowbeer/32/525_2.png) [@joebowbeer](https://community.temporal.io/u/joebowbeer)\
**Post date:** [February 28, 2022, 7:39am UTC](https://community.temporal.io/t/why-is-implementing-a-queue-an-anti-pattern/4081/3 "2022-02-28T07:39:46Z")

</div>

Hi @tihomir, I’m also interested in more explanation around this anti-pattern.

In this presentation, it appears to me that Maxim is, if anything, reinforcing the (mistaken?) idea that Temporal replaces queues. The solution he presents (at 10m5s), with queuing implemented inside the Temporal server, is replacing an implementation that was using Kafka.

To better understand this anti-pattern, I’d like to see an example where “real” queues are needed in addition to Temporal.

[![](https://us1.discourse-cdn.com/flex016/uploads/temporal/original/2X/c/c51331b8784ac8f1c97f853dd3a152b366c01328.jpeg "Fault Tolerant Distributed Microservices Orchestration with Temporal - Maxim & Tihomir @ TheDevConf") ](https://www.youtube.com/watch?v=6T6zVZHU7_Q)

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [February 28, 2022, 5:48pm UTC](https://community.temporal.io/t/why-is-implementing-a-queue-an-anti-pattern/4081/4 "2022-02-28T17:48:39Z")

</div>

> [@When to use SQS?](https://community.temporal.io/t/when-to-use-sqs/3689/3):
>
> I assume that your question applies to any queuing solution (Kafka, RabbitMQ, etc.), not only SQS. What are the features of a distributed queue? Producers can enqueue tasks Accumulate (backlog) tasks if consumers are down or slow Deliver each task to a single consumer The consumer can report task completion (ack) or failure (nack) back to the queue If a task is not acked/nacked within a configured timeout it is considered nacked. Some queues support extending the running task timeout (aka hea…

---

<div class="post-metadata">

**Author:** ![joebowbeer](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/joebowbeer/32/525_2.png) [@joebowbeer](https://community.temporal.io/u/joebowbeer)\
**Post date:** [February 28, 2022, 6:55pm UTC](https://community.temporal.io/t/why-is-implementing-a-queue-an-anti-pattern/4081/5 "2022-02-28T18:55:37Z")

</div>

Do I understand correctly then that the intent of the anti-pattern is to say “Don’t re-create bad queuing patterns in Temporal”?

> My experience tells me that a very narrow set of scenarios fit these limitations. In most cases, tasks are not independent, can execute for a long time, require long retries, require actual error handling, and benefit from transactionality between the database and the queue.

If, rather, the intent is to say “Use queues for queuing when appropriate, not Temporal” (as I interpreted it) then I would like to see one of these hybrid examples.

---

<div class="post-metadata">

**Author:** ![joebowbeer](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/joebowbeer/32/525_2.png) [@joebowbeer](https://community.temporal.io/u/joebowbeer)\
**Post date:** [August 23, 2023, 12:01am UTC](https://community.temporal.io/t/why-is-implementing-a-queue-an-anti-pattern/4081/6 "2023-08-23T00:01:46Z")

</div>

From [Temporal Antipatterns​](https://docs.temporal.io/kb/legacy-oss-prod-deploy#temporal-antipatterns)

> Temporal Antipatterns  
> _Please request elaboration on any of these_.
> 
> - Trying to implement a queue in a Workflow (because people hear we replace queues)

Is there anything more to added here?

In a workflow that processes an event stream, would the events typically be posted to the workflow using signals?

If so, how to deal with the [limit on number of signals](https://community.temporal.io/t/limit-on-number-of-signals/4076)?

Would a queue typically be used to buffer the event stream?

Or is there a better way?
