Search code examples
.netqueuetarantool

Tarantool queue via .Net


I use Tarantool as a database and Web API in my .Net project. But besides that, I would like to use the built-in Tarantool queues, but I could not find adapters to work with Tarantool queues under .Net (like this, this or this one). Is it possible to solve the problem of working with queues using .Net?


Solution

  • For easy access from different platforms, I implemented a simple Web API to access ddsfdfd queues as a consumer. For me it turned out to be the most convenient way. Like on fragment below.

    local queue = require('queue')
    
    local function take_task(req)
        local json = require('json')
        local task = queue.tube.queue_name:take(15)
        local resp = nil
        if task ~= nil then
            resp = req:render({ json = {task} })
            resp.status = 200
        else
            resp = req:render({ json = {task_id} })
            resp.status = 404
        end
        return resp
    end
    
    local server = require('http.server').new(nil, 9090, {app_dir='/etc/tarantool/instances.enabled/'})
    server:route({ path = '/take_task' }, take_task)
    server:start()