-
Notifications
You must be signed in to change notification settings - Fork 52
Using the Postgres Data Adapter
###Configuring Atom Hopper to use the Postgres Data Adapter###
Note: The Postgres Data Adapter is currently untested and is not production ready at this time. At this point, existing defects are being fixed with the Postgres Data Adapter and no new features are being added. For production needs please use the Hibernate data adapter.
For better HTTP GET performance make sure to add an index on DateLastUpdated.
The Postgres data adapter ships with Atom hopper version 1.2.0 and above. You can turn on the Postgres data adapter easily following these steps:
- Make sure Postgres is installed and running where it can be seen by Atom Hopper. The default dbname is atomhopper
- Go to the location where the Atom Hopper configuration files are located, by default this path is: /etc/atomhopper
- Edit the application-context.xml file so it looks similar to the following (edit as needed to suit your particular needs):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="atomHopperDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://localhost:5432/atomhopper" />
<property name="username" value="postgres" />
<property name="password" value="password" />
<property name="minIdle" value="10" />
<property name="maxIdle" value="25" />
<property name="initialSize" value="10" />
<property name="maxActive" value="50" />
<property name="validationQuery" value="SELECT 1" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvitctionRunsMillis" value="10000" />
</bean>
<bean name="atomHopperJdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<constructor-arg name="dataSource" ref="atomHopperDataSource"/>
</bean>
<bean name="postgres-feed-publisher" class="org.atomhopper.postgres.adapter.PostgresFeedPublisher">
<property name="jdbcTemplate" ref="atomHopperJdbcTemplate" />
</bean>
<bean name="postgres-feed-source" class="org.atomhopper.postgres.adapter.PostgresFeedSource">
<property name="jdbcTemplate" ref="atomHopperJdbcTemplate" />
</bean>
</beans>
- Edit the atom-server.cfg.xml file (by default the file is located in: /etc/atomhopper) so it looks similar to the following (edit as needed to suit your particular needs):
<?xml version="1.0" encoding="UTF-8"?>
<atom-hopper-config xmlns="http://atomhopper.org/atom/hopper-config/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://atomhopper.org/atom/hopper-config/v1.0 ./../../config/atom-hopper-config.xsd">
<defaults>
<author name="Atom Hopper" />
</defaults>
<host domain="localhost:8080" />
<workspace title="Testing Namespace" resource="/namespace/">
<categories-descriptor reference="workspace-categories-descriptor" />
<feed title="Testing Feed" resource="/feed">
<publisher reference="postgres-feed-publisher" />
<feed-source reference="postgres-feed-source" />
</feed>
</workspace>
</atom-hopper-config>The important thing here is to ensure the following:
<publisher reference="postgres-feed-publisher" />
<feed-source reference="postgres-feed-source" />Matches what is specified in the application-context.xml file.
<bean name="postgres-feed-publisher" class="org.atomhopper.postgres.adapter.PostgresFeedPublisher">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean name="postgres-feed-source" class="org.atomhopper.postgres.adapter.PostgresFeedSource">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>If Atom Hopper is currently running you will need to restart it for the changes to take effect.