Giter Club home page Giter Club logo

luconejo's Introduction

luconejo

a lua wrapper of the C++ RabbitMQ AMQP client library wrapper SimpleAmqpClient written mostly on a subway train

Build Status

many features work, but just as the SimpleAmqpClient tests are failing, so are the wrapper tests.

status

semi-abandoned

api

reading convention

The api is mirroring the c++ api as closely as possible. Some overloads are split into multiple functions. To read the full documentation, please refer to the original documentation in SimpleAmqpClient. The full binding can be seen at a glance in luconejo_lib.cpp -> register_luconejo See the tests for the API usage examples

global constants

luconejo.version luconejo version string

luconejo.client_version SimpleAmqpClient version

luconejo.amqp_version() rabbitmq-c version string

connecting

connection = luconejo.Channel.Create( host ) -- create a connection (simple api)
connection = luconejo.Channel.CreateWithParameters(
	host,
	port,
	username,
	password,
	vhost,
	frame_max)
connection = luconejo.Channel.CreateFromUri( host_uri ) --  connect with an AMQP URI
connection.Valid -- check if connection succeeded

exchanges

luconejo.Channel.EXCHANGE_TYPE_DIRECT -- constant
luconejo.Channel.EXCHANGE_TYPE_FANOUT -- constant
luconejo.Channel.EXCHANGE_TYPE_TOPIC -- constant

connection:SimpleDeclareExchange(exchange_name)


connection:DeclareExchange(
	exchange_name,
	exchange_type,
	passive,
	durable,
	auto_delete)
connection:DeleteExchange( exchange_name )
connection:DeleteExchangeIfUnused( exchange_name )
connection:BindExchange( destination, source, routing key )
connection:UnbindExchange( destination, source, routing key )

queues

local queue_name = connection:SimpleDeclareQueue( queue_name )
local queue_name = connection:DeclareQueue(
	queue_name,
	passive,
	durable,
	exclusive,
	auto_delete)
	-- returns luconejo.Channel.INVALID_QUEUE_NAME if failed

connection:BindQueue( queue_name, exchange_name, routing_key )
connection:UnbindQueue( queue_name, exchange_name, routing_key )
connection:PurgeQueue( queue_name )

connection:DeleteQueue( queue_name, if_unused, if_empty )

disconnecting

connection:Disconnect()

basic message

message = luconejo.BasicMessage.Create( body ) create a message with a string-body local body = message.Body` get the message text

publishing a message

connection:BasicPublish(exchange_name, routing key, message, mandatory, immediate) message should be a luconejo.BasicMessage.

connection:SimpleBasicPublish(exchange_name, routing key, message) nonmandatory and not immediate.

consuming a message

local consumer_tag = connection:SimpleBasicConsume(queue)

local consumer_tag = connection:BasicConsume(
	queue,
	consumer_tag,
	no_local,
	no_ack,
	exclusive,
	prefetch_count) -- returns the consumer tag

local envelope = connection:BasicConsumeMessage(consumer_tag,timeout)

local envelope = connection:BasicGet( queue, no_ack )

local message = envelope.Message returns luconejo.BasicMessage

connection:BasicCancel( consumer_tag ) stop consuming

acknowledging a message

connection:BasicAck(envelope) where envelope is luconejo.Envelope

recovering an unacknowledged message

connection:BasicRecover( consumer )

quality of service

connection:BasicQos( consumer, message_prefetch_count )

error handling

Currently, the wrapped objects have a .Valid property, indicating if the object has been successfully created.

If not valid, the object ignores commands.

The exception text is sent to stderr.

void (...) methods return true if succeeded or false if exception thrown.

binding details

All parameters are mandatory at the moment. C++ Function signatures with default values or without are mapped onto different Lua functions.

building

  • generate your makefiles or project files using premake
  • on Linux and MacOS X the rabbitmq-c library can be built and installed using premake4 prepare
  • build accordingly

motivation: Recursive Make Considered Harmful

motivation

By way of writing this binding, partially going the wrong way of wrapping an otherwise simpler-bindable class, I can dive into the API and its details.

dependencies

all dependent libraries are built from source

  • rabbitmq-c
  • SimpleAmqpClient
  • LuaBridge
  • Premake for generating makefiles and solutions

testing

  • start RabbitMQ
  • > premake/premake4 test

license

MIT License

luconejo's People

Contributors

d-led avatar

Stargazers

taogogo avatar BigJoe avatar Dmitriev Sergey avatar hex2tan avatar  avatar Heinz Fiedler avatar Ignacio Burgueño avatar

Watchers

James Cloos avatar  avatar José Seabra avatar hex2tan avatar 风---自由 avatar

luconejo's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.