Loading

Processing requests in sequential order (FIFO) on Mule Runtime on-premises

Publiceringsdatum: Aug 6, 2025
Steg

QUESTION

How to process requests in sequential order on Mule Runtime on-prem?

ANSWER

In order to preserve the order of requests, you can use the VM components as follow:
-  publish the message immediately after the HTTP listener component in the main flow
- set maxConcurrency=1 in the flow which has the VM listener

User-added image
    <flow name="mainFlow" doc:id="7a402279-50a3-4cba-afec-7ee9bef0ec72">
		<http:listener doc:name="Listener" doc:id="19b34c23-0646-4af1-b459-ed04443b731f" config-ref="HTTP_Listener_config" path="/test" />
		<vm:publish doc:name="Publish" doc:id="211e61dc-e34c-4662-b9e1-9d531651804e" config-ref="VM_Config" queueName="reqVM" />
	</flow>
	<flow name="processFlow" doc:id="df1b153d-1cbf-4d2d-a88e-cf4983ad4fe0" maxConcurrency="1">
		<vm:listener doc:name="Listener" doc:id="15b43b11-8357-460a-a461-c5bdbd967102" config-ref="VM_Config" numberOfConsumers="1" queueName="reqVM" />
		<set-variable value="#[randomInt(3)]" doc:name="Set Variable" doc:id="2e023c28-d459-42c8-a5ae-841958cac834" variableName="timeProcess" />
		<ee:transform doc:name="Transform Message" doc:id="69ac6e2d-9588-4f96-a338-c60fdf3ff537">
			<ee:message>
				<ee:set-payload><![CDATA[%dw 2.0
import * from dw::Runtime
output application/json
---
wait(payload, vars.timeProcess * 1000)]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<logger level="INFO" doc:name="Logger" doc:id="c57fd8a9-e5ce-462b-baef-c9cc27f4df18" message='#["processFlow - message processed in " ++ vars.timeProcess ++ " seconds"]' />
	</flow>

The order will be preserved as the requests have arrived at the HTTP listener.

Take in mind that VM is a simple queueing that does not justify the use of a full JMS broker (if you want to use a full JMS broker see additional information)

VM limitations: https://docs.mulesoft.com/runtime-manager/managing-queues#limitations


ADDITIONAL INFORMATION

To get a robust and flexible solution with more features to FIFO processing we recommend Anypoint MQ, you can find more information about benefits and restrictions in the following documentation:
https://docs.mulesoft.com/mq/mq-queues#fifoqueues
https://docs.mulesoft.com/mq/mq-faq
Knowledge-artikelnummer

001115713

 
Laddar
Salesforce Help | Article