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 tomanual 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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -