= Manage Queues ifndef::env-site,env-github[] include::_attributes.adoc[] endif::[] :page-aliases: runtime-manager::managing-queues.adoc, You can view and control any Virtual Machine (VM) or Staged Event-Driven Architecture (http://en.wikipedia.org/wiki/Staged_event-driven_architecture[SEDA]) queues within the flows of your deployed applications from the *Queues* tab in Runtime Manager. Queues are available only for applications deployed to CloudHub workers. They are not available for applications that you deploy with the Runtime Manager to local servers. See xref:runtime-manager::deployment-strategies.adoc[Deployment Options] for more details. image::queuestab.png[QueuesTab] CloudHub automatically detects the queues from within your flow and lists them on the *Queues* tab. Without making any changes in the underlying application, you can: * See the number of queued and in-flight messages on each queue. * View a snapshot of the queue throughput for the past 24 hours. * Clear all pending messages on a queue. You can also enable data-at-rest encryption for your persistent queues to ensure that any shared application data written to a persistent queue is encrypted. == Use Cases The *Queues* tab is useful for the following use cases: * You want runtime visibility into the queues in your application. * You are testing your application to observe whether messages are traveling through your queues as expected. * Your application is stuck processing a message and you want to flush the messages from only that queue to resolve the issue. == Enable Queues To enable queues: . Deploy an application to CloudHub that includes one or more queues. + See xref:connectors::vm/vm-connector.adoc[VM Connector]. . In Runtime Manager, click the application and click *Manage Application*. . Click the checkbox for *Persistent queues*. . If you are enabling this setting when deploying an application, click *Deploy Application*. + If you are updating an existing application, click *Apply Changes*. + image::persistentqueuessetondeploy.png[PersistentQueuesSetOnDeploy] == View Queues After you enable persistent queues, click *Queues* in the left navigation menu. CloudHub lists the queues in your application in the order they appear in your application: image::chqconsole.png[CHQConsole] The name of each queue is determined by the `path` attribute of the associated VM endpoint, or, in the case of a SEDA queue, from the flow name. * The *Queued* column shows the number of messages currently waiting on each of the queues in your application. * The *In-Flight* column indicates the number of messages being processed in the flow after that queue. + The in-flight messages are still on the queue until processing is complete, then they are deleted from the queue. * The *Processed Messages* column shows a thumbnail graph depicting the number of messages processed through each queue over the past 24 hours. The *Queued* and *In-Flight* columns update every five seconds, and the *Processed Messages* graph updates every five minutes. == Clear Queues To clear one or more queues, click the checkboxes for the queues to clear, then click *Clear*. image::chqclearq.png[CHQClearQ] Runtime Manager presents a warning message that confirms which queues to clear and the duration this process takes to occur. Click *Clear Queues* to proceed. image::chqclear.png[CHQClear] After you confirm, the queues that you selected display a "Clearing queue in progress" message until the clearing process is complete: image::chqclearinprogress.png[CHQClearInProgress] Clearing a queue flushes all messages waiting in the queue and all in-flight messages. After the queue is cleared, the queue immediately begins accepting messages again. == Encrypt Data at Rest in Persistent Queues You can enable data-at-rest encryption for all your persistent queues. By enabling this feature, you ensure that any shared application data written to a persistent queue is encrypted, allowing you to meet your security and compliance needs. image::enable-encripting.png[enable+encripting] [IMPORTANT] If you enable encryption and then disable it, any messages that were previously encrypted become unreadable. == Batch Component and Persistent Queues If your Mule application is using a Batch component and persistent queues, you might see batch records being processed multiple times. All batch records are stored in Amazon SQS and the visibility of the message is set to 70 seconds by default. If your batch process takes longer than 70 seconds, batch processes might see the same message again and process it multiple times. To avoid this issue, set the `persistent.queue.min.timeout` system parameter to a larger value in the *Properties* tab of the application *Settings* page. For example, if your batch process takes 30 minutes to complete, set the value to `persistent.queue.min.timeout=2700000` milliseconds (45 Minutes). The maximum value is 43000000 milliseconds (12 hours). == Limitations When enabling persistent queues in your application, be aware of the following: * Persistent queues do not guarantee one-time-only message delivery. Duplicate messages might be sent. If one-time-only message delivery is critical for your use case, do not enable persistent queues. * If you clear a queue using the *Queues* tab, any new messages sent to the queue during the queue clearing process might be lost. * Enabling persistent queues has a performance implication. Putting a small message (50kb or less) on a queue can take 10-20 milliseconds (ms). Taking the same message off a queue can take 70-100ms. == See Also * xref:cloudhub-fabric#persistent-queues[Persistent Queues] * xref:mule-runtime::reliability-patterns.adoc[Reliability Patterns] * xref:deploying-to-cloudhub.adoc[Deploy to CloudHub] * xref:studio::index.adoc[Anypoint Studio] * xref:runtime-manager::deployment-strategies.adoc[Deployment Options] * xref:runtime-manager::managing-deployed-applications.adoc[Manage Deployed Applications] * xref:managing-applications-on-cloudhub.adoc[Manage Applications on CloudHub] * xref:index.adoc[CloudHub] * xref:developing-applications-for-cloudhub.adoc[Develop Applications for CloudHub] * xref:cloudhub-architecture.adoc[CloudHub Architecture] * xref:runtime-manager::monitoring.adoc[Monitor Applications] * xref:managing-schedules.adoc[Manage Schedules] * xref:managing-application-data-with-object-stores.adoc[Manage Application Data with Object Stores] * xref:anypoint-cli::index.adoc[Anypoint Platform Command-Line Interface] * xref:secure-application-properties.adoc[Secure Application Properties] * xref:virtual-private-cloud.adoc[Virtual Private Cloud] * xref:penetration-testing-policies.adoc[Penetration Testing Policies]