Skip to content

Commit

Permalink
Version 0.4.3, Added additional configuration options.
Browse files Browse the repository at this point in the history
  • Loading branch information
bflorian committed Sep 25, 2013
1 parent ee18903 commit 45449c0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 11 deletions.
4 changes: 2 additions & 2 deletions CassandraAstyanaxGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import com.reachlocal.grails.plugins.cassandra.astyanax.AstyanaxDynamicMethods
class CassandraAstyanaxGrailsPlugin
{
// the plugin version
def version = "0.4.2"
def version = "0.4.3"

// the version or versions of Grails the plugin is designed for
def grailsVersion = "2.0.0 > *"
Expand Down Expand Up @@ -47,7 +47,7 @@ that provides GORM-like dynamic methods for storing Groovy objects and relations
Note that this plugin does not implement the GORM API.
'''
// URL to the plugin's documentation
def documentation = "http://grails.org/plugin/cassandra-astyanax"
def documentation = "http://bflorian.github.io/cassandra-astyanax/"

def doWithDynamicMethods = { ctx ->
// Dynamic methods to make Astyanax groovier
Expand Down
5 changes: 5 additions & 0 deletions grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ log4j = {
}
grails.views.default.codec="none" // none, html, base64
grails.views.gsp.encoding="UTF-8"

astyanax.clusters.standard.connectTimeout = 3000
astyanax.clusters.standard.socketTimeout = 25000
astyanax.clusters.standard.retryCount = 5

Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,20 @@ class AstyanaxService implements InitializingBean
def port = props.port ?: 9160
def maxConsPerHost = props.maxConsPerHost ?: 10
def connectionPoolName = props.connectionPoolName ?: key
def connectTimeout = props.connectTimeout ?: 2000
def socketTimeout = props.socketTimeout ?: 11000
def maxTimeoutWhenExhausted = props.maxTimeoutWhenExhausted ?: 2000
def maxTimeoutCount = props.maxTimeoutCount ?: 3
def timeoutWindow = props.timeoutWindow ?: 10000

ConnectionPoolConfiguration connectionPoolConfiguration = new ConnectionPoolConfigurationImpl(connectionPoolName)
.setPort(port)
.setMaxConnsPerHost(maxConsPerHost)
.setConnectTimeout(connectTimeout)
.setSocketTimeout(socketTimeout)
.setMaxTimeoutWhenExhausted(maxTimeoutWhenExhausted)
.setMaxTimeoutCount(maxTimeoutCount)
.setTimeoutWindow(timeoutWindow)
.setSeeds(props.seeds)

if (props.username && props.password) {
Expand Down Expand Up @@ -176,9 +186,9 @@ class AstyanaxService implements InitializingBean

def props = clusters[cluster]
//Default the pool type to the same default astyanax uses Round Robin.
ConnectionPoolType connectionPoolType = props.connectionPoolType ?: ConnectionPoolType.ROUND_ROBIN
ConnectionPoolType connectionPoolType = props.connectionPoolType ?: ConnectionPoolType.TOKEN_AWARE
def connectionPoolMonitor = props.connectionPoolMonitor ?: new CountingConnectionPoolMonitor()
def discoveryType = props.discoveryType ?: NodeDiscoveryType.NONE
def discoveryType = props.discoveryType ?: NodeDiscoveryType.RING_DESCRIBE
def retryCount = props.retryCount ?: 3
def retryPolicy = props.retryPolicy ?: new RetryNTimes(retryCount)

Expand Down
8 changes: 4 additions & 4 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<plugin name='cassandra-astyanax' version='0.4.2' grailsVersion='2.0.0 &gt; *'>
<plugin name='cassandra-astyanax' version='0.4.3' grailsVersion='2.0.0 &gt; *'>
<author>Bob Florian</author>
<authorEmail>[email protected]</authorEmail>
<title>Astyanax Cassandra Client</title>
Expand All @@ -7,7 +7,7 @@ to make using it from Groovy more convenient. It also implements the interface
that provides GORM-like dynamic methods for storing Groovy objects and relationships in Cassandra.
Note that this plugin does not implement the GORM API.
</description>
<documentation>http://grails.org/plugin/cassandra-astyanax</documentation>
<documentation>http://bflorian.github.io/cassandra-astyanax/</documentation>
<type>CassandraAstyanaxGrailsPlugin</type>
<resources>
<resource>com.reachlocal.grails.plugins.cassandra.astyanax.AstyanaxService</resource>
Expand All @@ -21,13 +21,13 @@ Note that this plugin does not implement the GORM API.
<dependency group='org.spockframework' name='spock-grails-support' version='0.7-groovy-2.0' />
</test>
<compile>
<dependency group='com.netflix.astyanax' name='astyanax-core' version='1.56.42' />
<dependency group='com.netflix.astyanax' name='astyanax-cassandra' version='1.56.42' />
<dependency group='com.netflix.astyanax' name='astyanax-core' version='1.56.42' />
<dependency group='com.netflix.astyanax' name='astyanax-thrift' version='1.56.42' />
</compile>
<runtime>
<dependency group='com.github.stephenc.high-scale-lib' name='high-scale-lib' version='1.1.1' />
<dependency group='com.github.stephenc.eaio-uuid' name='uuid' version='3.2.0' />
<dependency group='com.github.stephenc.high-scale-lib' name='high-scale-lib' version='1.1.1' />
</runtime>
</dependencies>
<plugins />
Expand Down
15 changes: 12 additions & 3 deletions src/docs/guide/1.2 Configuration Options.gdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ astyanax {
port = 9160
maxConsPerHost = 10
retryCount = 3
connectionPoolType = com.netflix.astyanax.connectionpool.impl.ConnectionPoolType.ROUND_ROBIN
connectionPoolType = com.netflix.astyanax.connectionpool.impl.ConnectionPoolType.TOKEN_AWARE
connectionPoolMonitor = new com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor()
discoveryType = com.netflix.astyanax.connectionpool.NodeDiscoveryType.NONE
discoveryType = com.netflix.astyanax.connectionpool.NodeDiscoveryType.RING_DESCRIBE
retryPolicy = new com.netflix.astyanax.retry.RetryNTimes(3)
connectTimeout = 2000,
socketTimeout = 11000,
maxTimeoutWhenExhausted = 2000,
maxTimeoutCount = 3,
timeoutWindow = 10000,
connectionPoolName = "MyConnectionPool"
defaultReadConsistencyLevel = "CL_ONE"
defaultWriteConsistencyLevel = "CL_ONE"
Expand All @@ -35,10 +40,14 @@ defaultKeyspace | no | Name of the keyspace to use if one is not specified in th
port | no | Port number used for communicating to Cassandra nodes. Defaults to 9160.
maxConsPerHost | no | The maximum number of connections to be created for any one node. Defaults to 10.
retryCount | no | The number of times Astyanax will retry a call before failing. Has not effect if the retryPolicy property is set. Defaults to 3.
connectionPoolType | no | The connection pool type. Defaults to ROuND_ROBIN. Other values are TOKEN_AWARE, ROUND_ROBIN, and BAG
connectionPoolType | no | The connection pool type. Defaults to ROUND_ROBIN. Other values are TOKEN_AWARE, ROUND_ROBIN, and BAG
connectionPoolMonitor | no | The connection pool monitor implementation. Defaults to new com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor
discoveryType | no | The method of discovering new nodes. Defaults to NONE (no discovery). Other values are RING_DESCRIBE, DISCOVERY_SERVICE, and TOKEN_AWARE
retryPolicy | no | The retry policy to use. Defaults to RetryNTimes. Others values include RunOnce, ConstantBackoff, ExponentialBackoff, BoundedExponentialBackoff, and SleepingRetryPolicy
connectTimeout | no | Socket connect timeout in milliseconds
socketTimeout | no | Socket read/write timeout in milliseconds
maxTimeoutCount | no | Number of allowed timeouts within timeoutWindow milliseconds
timeoutWindow | no | Shut down a host if it times out too many times within this window
connectionPoolName | no | Name used to identify the connection pool. Defaults to the astyanax.clusters configuration key, i.e. "standard" in this example
defaultReadConsistencyLevel | no | Default consistency level used when reading from the cluster. This value can be overwritten on the Query operations.
defaultWriteConsistencyLevel | no | Default consistency level used when reading from the cluster. This value can be overwritten on MutationBatch operation
Expand Down

0 comments on commit 45449c0

Please sign in to comment.