Skip to content

How can I use this client with tarantool queues? #33

Open
@AndreyAlifanov

Description

@AndreyAlifanov

Hello!

I try to use this client with queues in tarantool (it's modified code from Simple.cpp). And can't do it in normal way.

int main()
{
	Connector<Buf_t, Net_t> client;
	Connection<Buf_t, Net_t> conn(client);
	int rc = client.connect(conn, {.address = address,
				       .service = std::to_string(port),
				       /*.user = ...,*/
				       /*.passwd = ...,*/
				       /* .transport = STREAM_SSL, */});
	if (rc != 0)
	{
		std::cerr << conn.getError().msg << std::endl;
		return -1;
	}

	rid_t f1 = conn.call("queue.create_tube", std::make_tuple("test", "fifo"));

	while (!conn.futureIsReady(f1))
	{
		if (client.wait(conn, f1, WAIT_TIMEOUT) != 0)
		{
			std::cerr << conn.getError().msg << std::endl;
			conn.reset();
		}
	}

	std::optional<Response<Buf_t>> response = conn.getResponse(f1);
	assert(response != std::nullopt);

	printResponse<Buf_t>(conn, *response); // this method from sample without modifications

	client.close(conn);

	return 0;
}

As result I get an error from conn.call:

RESPONSE ERROR: msg=unsupported Lua type 'function' line=/usr/src/tarantool/src/lua/utils.c file=/usr/src/tarantool/src/lua/utils.c errno=0 type=LuajitError code=32

But tube is created, in fact.

I guess, that I should use eval instead of call. But client doesn't contain this method.

So I have 2 questions:

  1. How to use this client with Tarantool queues properly?
  2. How to write wrappers for queue methods? Is it possible at all?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions