I've created a simple mule JMS flow with CLIENT_ACKNOWLEDGE mode. My understanding with 'CLIENT_ACKNOWLEDGE' is that we have to explicitly acknowledge the message on receiver or client side, it will not consume from the queue until it would not acknowledge.
<spring:beans>
<spring:bean name="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<spring:property name="brokerURL" value="tcp://localhost:61616" />
<spring:property name="redeliveryPolicy">
<spring:bean class="org.apache.activemq.RedeliveryPolicy">
<spring:property name="maximumRedeliveries" value="10" />
<spring:property name="initialRedeliveryDelay"
value="1000" />
</spring:bean>
</spring:property>
</spring:bean>
</spring:beans>
<jms:connector name="Active_MQ3" connectionFactory-ref="connectionFactory" acknowledgementMode="CLIENT_ACKNOWLEDGE" maxRedelivery="10" persistentDelivery="true" specification="1.1" />
<flow name="main1" doc:name="main1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" path="test" port="8099" doc:name="HTTP"/>
<logger message="starting main flow" level="INFO" doc:name="Logger"/>
<jms:outbound-endpoint queue="StudioIN" connector-ref="Active_MQ3" doc:name="JMS">
<jms:transaction action="NONE"/>
</jms:outbound-endpoint>
</flow>
//reading msg from queue, not acknowledging
<flow name="worker1" doc:name="worker1">
<jms:inbound-endpoint queue="StudioIN" connector-ref="Active_MQ1" doc:name="JMS"/>
<logger message="Consuming payload: #[payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
In my test flow I haven't acknowledge the message, but it still got consumed. How we can keep message in queue until it get acknowledge from client or receiver side?
<!-------------- Updated flow ------------------------>
<flow name="worker1" doc:name="worker1">
<jms:inbound-endpoint queue="StudioIN" connector-ref="Active_MQ1" doc:name="JMS">
<jms:client-ack-transaction action="ALWAYS_BEGIN"/>
</jms:inbound-endpoint>
<logger message="Consuming payload: #[payload]" level="INFO" doc:name="Logger"/>
</flow>