How to read and delete int-redis:store-inbound-channel-adapter messages on each poll

Using this basic configuration :

<int-redis:store-inbound-channel-adapter id="listAdapter"
        <int:poller fixed-rate="2000" />

Messages that are read and put to redisChannel are also left in Redis. Is there a way to read and delete messages from Redis at the same time and put them to redisChannel, using this configuration? I can do it manually using scheduler and executing redis commands that I need, but that feels like hacking around spring integration.


<int-redis:store-inbound-channel-adapter> returns the RedisStore object. In your case it is a List implementation. So, you can simple call remove() or clear() methods of List, when it is necesary for you. Another technique to use Transaction Synchronization Factory, but I'm not sure that it help you, as you may use a <splitter> after your <int-redis:store-inbound-channel-adapter>. However you should place that RedisStore to headers before splitter.


According to your last comment:

<int:service-activator input-channel="redisChannel">
        def data = [] + payload

As far as our payload is a RedisStoreList we can simply copy it to another list, clear() it and return that new list. The clear() operation will be delegated to the Redis.

Need Your Help

Strange Webkit Issue in Wordpress

wordpress google-chrome webkit woothemes

Large amounts of white-space in the body of this page - something is setting height: 4148.21875px; but cant find what.