Delete record instantly while reading that record using java client in aerospike set

secondary
udf
query
deletion

#1

Hi All

I need to delete record instantly while reading that record using java client .I want to use aerospike set as a queue where i want parallel read processing where no consumer will read same record .

Please help .


#2

The way to do this currently would be by invoking a record UDF on the record. For example:

function read_delete(rec)
  local mapped_rec = map()
  if aerospike:exists() then
    local names = record.bin_names(rec)
    for key, val in pairs(names) do
      mapped_rec[key] = val
    end
    aerospike:remove(rec)
  end
  return mapped_rec
end

#3

Thanks . you are awesome :slight_smile: