I'm working on a solution to make certain data from a large database available to a remote website. My first thought was to simply cook up some soap web services to fetch certain data from the database. This could be done in just a few line, for instance like this, with the user of Zend_Soap_Server:
class MyClass
{
public function getlastname($id)
{
$dbh = new PDO("oci:dbname=bigdb", "theuser", "thepass");
$stmt = $dbh->prepare("select lastname from person where id = :id");
if ($stmt->execute(array(':id',$id)))
{
$row = $stmt->fetch();
return $row['lastname'];
}
}
}
$server = new Zend_Soap_Server(null, $options);
$server->setClass('MyClass');
$server->setObject(new MyClass());
$server->handle();
Now someone told me to also have a look at message brokers / queues. I've been taking a look at some software like apache activeMQ, stomp and zend_queue but I didn't really get a clear view what they should be used for and weather they would be useful in this project.
I do understand that my implementation could have some drawbacks, like a sluggish website when the database is not responding quickly and a high load on the database when there are coming lots of requests from the website, would a message broker be able to prevent such complications?