java - How to acknowledge rabbitmq message manually using spring intergration -
i have created bean inbound channel acknowledge property manual, , chain method publishing output message ,
<int-amqp:inbound-channel-adapter channel="inputchannel" queue-names="input" connection-factory="connectionfactory" concurrent-consumers="1" message-converter="converter" acknowledge-mode="manual" prefetch-count="5"/> <int:chain input-channel="inputchannel" output-channel="outputchannel"> <int:transformer method = "transform" > <bean class="com.sampleconverter" /> </int:transformer> <int:service-activator method="transform"> <bean class="com.transformer" /> </int:service-activator> <int:object-to-string-transformer /> </int:chain>
can please me way acknowledge messages processed manual acknowledge mode,
thanks in advance.
the reference manual has dedicated paragraph on matter:
setting mode to
manual
allows user code ack message @ other point during processing. support this, mode, endpoints provide channel , deliverytag in amqp_channel , amqp_deliverytag headers respectively.
@serviceactivator(inputchannel = "foo", outputchannel = "bar") public object handle(@payload string payload, @header(amqpheaders.channel) channel channel, @header(amqpheaders.delivery_tag) long deliverytag) throws exception { // processing if (allok) { channel.basicack(deliverytag, false); // perhaps more processing } else { channel.basicnack(deliverytag, false, true); } return someresultfordownstreamprocessing; }
Comments
Post a Comment