<?xml version="1.0"?>
<instances>

	<!-- This instance maintains connections to a MySQL database -->
	<instance id="mysqldb" port="" socket="/tmp/mysqldb.socket" dbase="mysql">
		<users>
			<user user="mysqldbuser" password="mysqldbpassword"/>
		</users>
		<connections>
			<connection string="user=mysqldbuser;password=mysqldbpassword;host=mysqldb;db=mysqldb;"/>
		</connections>
	</instance>


	<!-- This instance maintains connections to a PostgreSQL database -->
	<instance id="postgresqldb" port="" socket="/tmp/postgresqldb.socket" dbase="postgresql">
		<users>
			<user user="postgresqldbuser" password="postgresqldbpassword"/>
		</users>
		<connections>
			<connection string="user=postgresqldbuser;password=postgresqldbpassword;host=postgresqldb;db=postgresqldb;"/>
		</connections>
	</instance>


	<!-- This instance sends queries containing "mysqldb." to the mysql
		database and "postgresqldb." to the postgresql database -->
	<instance id="router" dbase="router">
		<users>
			<user user="routeruser" password="routerpassword"/>
		</users>
		<routers>
			<!-- send all mysqldb queries to "mysqldb" -->
			<router module="regex" connectionid="mysqldb">
				<pattern pattern="mysqldb\."/>
			</router>
			<!-- send all postgresqldb queries to "postgresqldb" -->
			<router module="regex" connectionid="postgresqldb">
				<pattern pattern="postgresqldb\."/>
			</router>
		</routers>
		<connections>
			<connection connectionid="mysqldb" string="socket=/tmp/mysqldb.socket;user=mysqldbuser;password=mysqldbpassword"/>
			<connection connectionid="postgresqldb" string="socket=/tmp/postgresqldb.socket;user=postgresqldbuser;password=postgresqldbpassword"/>
		</connections>
		<notifications>
			<notification module="events">
				<events>
					<event event="integrity_violation"/>
				</events>
				<recipients>
					<recipient address="dba@firstworks.com"/>
				</recipients>
			</notification>
		</notifications>
	</instance>

</instances>
