Fusio

API / connector.get

Returns the fitting connection object for the provided connection name.

Arguments
Name Type Description
connection string Name or id of the connection
Return
Type Description
amqp Connection to push messages to RabbitMQ
beanstalk Connection to push messages to Beanstalkd
elasticsearch Connection to find or update entries from a Elasticsearch server
http Connection to execute HTTP requests
memcache Connection to set and get values from a Memcache server
mongodb Connection to work with a MongoDB
redis Connection to set and get values from a Redis server
soap Connection to execute SOAP requests
sql Connection to execute SQL queries
Example
var connection = connector.get("Mysql-Connection");
var row = connection.fetchAssoc('SELECT * FROM acme_news WHERE id = :id', {
  id: request.getUriFragment("id")
});

if (row) {
  response.setBody(row);
} else {
  response.setStatusCode(404);
  response.setBody({
    message: "Entry not available"
  });
}