Snowplow Java Tracker 0.9.0 released
We are pleased to announce a new release of the Snowplow Java Tracker. Version 0.9.0 brings some important updates including bumping OkHttp to OkHttp3 version 4 and improving support for a number of Snowplow event timestamps. We’ve also made improvements to the logging within the tracker and fixed a couple of outstanding bugs.
NB. With this release we’ve also moved to publishing our releases on Bintray (snowplow-maven or jcenter). This will require updating the repository in your build configuration to get the latest releases. See the Upgrading section for more information.
Read on below the fold for:
- Support for further timestamp properties
- Update OkHttp to OkHttp3 Version 4
- Updates and bug fixes
- Documentation and help
1. Support for further timestamp properties
The True Timestamp can be set when building an event:
t1.track(PageView.builder().( ... ).trueTimestamp(1423583655000).build());
With this change, the previous
timestamp(long timestamp) method which set the Device Created Timestamp has been deprecated in favour of
deviceCreatedTimestamp(long timestamp) and
trueTimestamp(long timestamp) methods.
Device Sent Timestamp will be automatically attached to each event that is sent using the Java Tracker.
2. Update OkHttp to OkHttp3 Version 4
The previous version of the Java Tracker offered the capability to send events using the OkHttp library. As of 0.9.0 we have upgraded OkHttp to Version 4 of OkHttp3 (#175), which is the current version of the OkHttp3 library. This brings a number of improvements, particularly around security, that are described on the okhttp site.
Updating to OkHttp3 increases the Java minimum supported version to Java 8+. In addition, when creating the OkHttpClientAdapter there are some small differences to previous versions. To create the OkHttpClientAdapter with version 0.9.0 of the Java Tracker you are required to initialise it with an OkHttp3.OkHttpClient, such as below:
import okhttp3.OkHttpClient; ... // Make a new client OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(5, TimeUnit.SECONDS) .readTimeout(5, TimeUnit.SECONDS) .writeTimeout(5, TimeUnit.SECONDS) .build(); // Build the adapter HttpClientAdapter adapter = OkHttpClientAdapter.builder() .url("http://www.acme.com") .httpClient(client) .build();
3. Updates and bug fixes
A big thank you to our community for the following contribution:
Other updates and bugfixes include:
- Update all non-static Loggers to static (#213)
- Fix events sent by example simple-console (#221)
- Alter logging for invalid keys only when adding to TrackerPayload (#186)
- Fix Peru version so vagrant up succeeds (#216)
- Fix Javadoc generation warnings (#219)
To upgrade, alter the repository url in your project to
https://bintray.com/snowplow/snowplow-maven/ and change the version to
0.9.0. Further details and examples for Maven, Gradle and sbt can be found in our setup guide.
This update increases the Java minimum supported version to Java 8+.
The upgrade to OkHttp3 in this release will break implementations that are upgrading from earlier releases. You will need to initialise an OkHttp3Client when creating an OkHttpClientAdapter. An example of this can be found here.
5. Documentation and help
Check out the Java Tracker’s documentation:
The v0.9.0 release page on GitHub has the full list of changes made in this version.