2

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?

Alex
  • 1,221
  • 2
  • 26
  • 42
iPhosgen
  • 53
  • 1
  • 10
  • I doubt that current C# drivers support queues. You may use `await box.Call("some_function")` to call lua functions on the tarantool side. It is not very elegant solution but it could be a workaround for your problem. Please have a look at this post [1], especially at sections "Creating an initialization script" and "Calling Lua functions". [1]: https://hackernoon.com/using-tarantool-in-a-net-project-on-windows-2676253ce521 – Vladimir Lebedev Dec 21 '17 at 07:36
  • @VladimirLebedev, thanks for the advice – iPhosgen Dec 21 '17 at 16:46

1 Answers1

2

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()
iPhosgen
  • 53
  • 1
  • 10