We required to consume messages from VM in a flow. Currently it is throwing an error when VM is empty as below:
Message : Tried to consume messages from VM queue 'FQ' but it was empty after timeout of 5 SECONDS Payload Type : org.mule.runtime.core.internal.streaming.bytes.ManagedCursorStreamProvider
For now we wrapped it in try catch block and handling this error(still it is printing the error stack trace, we want to avoid it)
I want to check is there a way or piece of code that can be used for checking the number of messages available in VM before consuming it.
You can use the logException
attribute on the error handler so the exception is not printed in the log.
Example:
<try doc:name="Try">
<vm:consume doc:name="Consume" config-ref="VM_Config" queueName="q1" />
<error-handler >
<on-error-continue enableNotifications="true" logException="false" doc:name="On Error Continue" type="VM:EMPTY_QUEUE">
<logger level="INFO" doc:name="Logger" message="consume timeout"/>
</on-error-continue>
</error-handler>
</try>
Thanks, let me try it.
Yes it works, now the stack trace is not getting printed.