I have a requirement in Mulesoft to subscribe to anypoint mq and get messages and then create a table which in the end of flow will be deleted, so what is happening is I have given fetch size as 10 so it is picking the first message and creates the table and before this message is completed, another message from queue is picked and it tries to create a table which is failing with error ‘there is already an object named table in the database’. Is there a way to gather all 10 messages process them at once?
You are probably asking the wrong question to solve the issue. Even if you read more messages with fetch size you can not avoid more messages to arrive. Instead use the maxConcurrency
attribute of the flow to limit it to only 1 concurrent execution.
Example
<flow name="myFlow" maxConcurrency="1">
... some operation that should not be executed concurrently
</flow>
See the documentation of maxConcurrency for reference.