-
Notifications
You must be signed in to change notification settings - Fork 10
Getting Started
Appengine-counter can be found in maven-central. To use it in your project, include the following dependency information:
<dependency>
<groupId>com.theupswell.appengine.counter</groupId>
<artifactId>appengine-counter</artifactId>
<version>2.0.1</version>
</dependency>
The appengine-counter project has recently been transferred to a new package structure which will be released to maven central shortly.
<dependency>
<groupId>io.instacount.appengine.counter</groupId>
<artifactId>appengine-counter</artifactId>
<version>2.0.2-SNAPSHOT</version>
</dependency>
Sharded counters can be accessed via an implementation of ShardedCounterService. Currently, the only implementation is ShardedCounterServiceImpl, which, if Counter deletion is required, requires a TaskQueue (the "/default" queue is used by default).
<queue-entries>
<queue>
<name>deleteCounterShardQueue</name>
<!-- add any further queue configuration here -->
</queue>
</queue-entries>
Don't forget to add a URL mapping for the default queue, or for the queue mapping you specify below! By default, the ShardedCounterService uses the default queue URL. See here for how to configure your push queue URL endpoints. This project includes a default implementation of a servlet that can handle counter deletion, but you must wire it into your web framework in order for it to function properly. See here for an example.
Note that this queue is not required to be defined if Counter deletion won't be utilized by your application..
Next, be sure to register the appengine-counter entities that are required by the ShardedCounterService, as follows:
ObjectifyService.factory().register(CounterData.class);
ObjectifyService.factory().register(CounterShardData.class);
ObjectifyService.factory().register(CounterShardOperationData.class);
Counter data may optionally be indexed by supplying an instance of CounterIndexes. Any of the fields on a Counter may optionally be indexed or non-indexed via this mechanism. If not specified on a particular counter, the default is to not index any fields of a counter.
In a future release, the CounterService interface will be enhanced to allow for retrieving a pagable list of Counters, as well as allowing for sorting and filtering. This enhancement lays the groundwork for this. See issue #19 for more details.
To utilize the ShardedCounterService with Spring, see here.
To utilize the ShardedCounterService with Guice, see here.
To use appengine-counter, see here.