function _findConnection (req, res, next, connectionId) {
  res.locals.connection = req.app.locals.redisConnections.findByConnectionId(connectionId);
  if (res.locals.connection) {
    res.locals.connectionId = connectionId;

    // try to reconnect if it is an optional connection and not connected right now
    if (res.locals.connection.status === 'end' && res.locals.connection.options.isOptional) {
      res.locals.connection.connect();
    }
  }
  else {
    console.error('Connection with id ' + connectionId + ' not found, requested by url ' + req.originalUrl);
    return _printError(res, next, null, req.originalUrl);
  }
  next();
}
method called to extract url parameter 'connectionId' from all routes.
 The connection object found is attached to the res.locals.connection variable for all
 following routes to work with. The connectionId param is attached to res.locals.connectionId.

 This method exits with JSON error response if no connection is found.

@param {object} req Express request object
@param {object} res Express response object
@param {function} next The next middleware function to call
@param {string} [connectionId] The value of the connectionId parameter.