Skip to content

Commit eaf4adc

Browse files
Merge pull request #101 from rudderlabs/master
chore: back-merge master to develop-release 3.1.0
2 parents 3e940b0 + 6eb27ac commit eaf4adc

12 files changed

Lines changed: 113 additions & 71 deletions

File tree

.github/workflows/build-and-quality-checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
with:
1515
fetch-depth: 0
1616

17-
- name: Set up JDK 21
17+
- name: Set up JDK 20
1818
uses: actions/setup-java@v3
1919
with:
20-
java-version: '21'
20+
java-version: '20'
2121
distribution: 'temurin'
2222

2323
- name: Set up Maven

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Version 3.1.0 (December 14, 2023)
2+
- [New](https://github.com/rudderlabs/rudder-sdk-java/pull/86) Update Java to the latest version
3+
- [New](https://github.com/rudderlabs/rudder-sdk-java/pull/83) Improve links in Rudderstack documentation
4+
15
# Version 3.0.0 (January 9, 2023)
26
- [New](https://github.com/rudderlabs/rudder-sdk-java/pull/43) Add CI feature
37
- [New](https://github.com/rudderlabs/rudder-sdk-java/pull/41) Add support for channel object in individual payload

README.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,62 @@
22

33
# What is RudderStack?
44

5-
[RudderStack](https://rudderstack.com/) is a **customer data pipeline** tool for collecting, routing and processing data from your websites, apps, cloud tools, and data warehouse.
5+
[RudderStack](https://rudderstack.com/) is a **customer data pipeline** tool for collecting, routing and processing data from
6+
your websites, apps, cloud tools, and data warehouse.
67

78
## RudderStack's Java SDK
89

9-
RudderStack’s Java SDK allows you to track your customer event data from your Java code. Once enabled, the event requests hit the RudderStack servers. RudderStack then routes the events to the specified destination platforms as configured by you.
10+
RudderStack’s Java SDK allows you to track your customer event data from your Java code. Once enabled, the event requests hit
11+
the RudderStack servers. RudderStack then routes the events to the specified destination platforms as configured by you.
1012

11-
For detailed documentation on the Java SDK, click [here](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-java-sdk/).
13+
For detailed documentation on the Java SDK,
14+
click [here](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-java-sdk/).
1215

1316
## Getting Started with the RudderStack Java SDK
1417

1518
*Add to `pom.xml`:*
1619

1720
```xml
21+
1822
<dependency>
1923
<groupId>com.rudderstack.sdk.java.analytics</groupId>
2024
<artifactId>analytics</artifactId>
21-
<version>3.0.1</version>
25+
<version>3.1.0</version>
2226
</dependency>
2327

2428
```
2529

2630
*or if you're using Gradle:*
2731

2832
```bash
29-
implementation 'com.rudderstack.sdk.java.analytics:analytics:3.0.0'
33+
implementation 'com.rudderstack.sdk.java.analytics:analytics:3.1.0'
3034
```
3135

3236
## Initializing ```RudderClient```
3337

3438
```java
35-
RudderAnalytics analytics = RudderAnalytics
36-
.builder("<WRITE_KEY>")
37-
.setDataPlaneUrl("<DATA_PLANE_URL>")
38-
.build();
39+
RudderAnalytics analytics=RudderAnalytics
40+
.builder("<WRITE_KEY>")
41+
.setDataPlaneUrl("<DATA_PLANE_URL>")
42+
.build();
3943
```
4044

4145
## Sending events
4246

4347
```java
44-
Map<String, Object> map = new HashMap<>();
45-
map.put("name", "John Marshal");
46-
map.put("email", "john@example.com");
47-
analytics.enqueue(IdentifyMessage.builder()
48+
Map<String, Object> map=new HashMap<>();
49+
map.put("name","John Marshal");
50+
map.put("email","john@example.com");
51+
analytics.enqueue(IdentifyMessage.builder()
4852
.userId("6754ds7d9")
4953
.traits(map)
50-
);
54+
);
5155
```
5256

53-
For more information on the different types of events supported by the Java SDK, refer to our [docs](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-java-sdk/).
57+
For more information on the different types of events supported by the Java SDK, refer to
58+
our [docs](https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-java-sdk/).
5459

5560
## Contact Us
5661

57-
If you come across any issues while configuring or using this SDK, feel free to start a conversation on our [Slack](https://resources.rudderstack.com/join-rudderstack-slack) channel. We will be happy to help you.
62+
If you come across any issues while configuring or using this SDK, feel free to start a conversation on
63+
our [Slack](https://resources.rudderstack.com/join-rudderstack-slack) channel. We will be happy to help you.

analytics-cli/pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<plugin>
8989
<groupId>org.jacoco</groupId>
9090
<artifactId>jacoco-maven-plugin</artifactId>
91-
<version>0.8.8</version>
91+
<version>0.8.11</version>
9292
<executions>
9393
<execution>
9494
<id>generate-aggregate-report</id>
@@ -99,6 +99,14 @@
9999
</execution>
100100
</executions>
101101
</plugin>
102+
<plugin>
103+
<groupId>org.apache.maven.plugins</groupId>
104+
<artifactId>maven-compiler-plugin</artifactId>
105+
<configuration>
106+
<source>19</source>
107+
<target>19</target>
108+
</configuration>
109+
</plugin>
102110
</plugins>
103111
</build>
104112
</project>

analytics-core/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,16 @@
7272
<scope>test</scope>
7373
</dependency>
7474
</dependencies>
75+
<build>
76+
<plugins>
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-compiler-plugin</artifactId>
80+
<configuration>
81+
<source>19</source>
82+
<target>19</target>
83+
</configuration>
84+
</plugin>
85+
</plugins>
86+
</build>
7587
</project>

analytics-sample/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@
5454
</execution>
5555
</executions>
5656
</plugin>
57+
<plugin>
58+
<groupId>org.apache.maven.plugins</groupId>
59+
<artifactId>maven-compiler-plugin</artifactId>
60+
<configuration>
61+
<source>19</source>
62+
<target>19</target>
63+
</configuration>
64+
</plugin>
5765
</plugins>
5866
</build>
5967
</project>

analytics/pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<plugin>
7878
<groupId>org.codehaus.mojo</groupId>
7979
<artifactId>templating-maven-plugin</artifactId>
80-
<version>1.0.0</version>
80+
<version>3.0.0</version>
8181
<executions>
8282
<execution>
8383
<goals>
@@ -89,6 +89,14 @@
8989
</execution>
9090
</executions>
9191
</plugin>
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-compiler-plugin</artifactId>
95+
<configuration>
96+
<source>19</source>
97+
<target>19</target>
98+
</configuration>
99+
</plugin>
92100
</plugins>
93101
</build>
94102
</project>

analytics/src/main/java/com/rudderstack/sdk/java/analytics/MessageInterceptor.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,15 @@ abstract class Typed implements MessageInterceptor {
2727
public final Message intercept(Message message) {
2828
// todo: non final so messages can be filtered without duplicating logic?
2929
Message.Type type = message.type();
30-
switch (type) {
31-
case alias:
32-
return alias((AliasMessage) message);
33-
case group:
34-
return group((GroupMessage) message);
35-
case identify:
36-
return identify((IdentifyMessage) message);
37-
case screen:
38-
return screen((ScreenMessage) message);
39-
case page:
40-
return page((PageMessage) message);
41-
case track:
42-
return track((TrackMessage) message);
43-
default:
44-
throw new IllegalArgumentException("Unknown payload type: " + type);
45-
}
30+
return switch (type) {
31+
case alias -> alias((AliasMessage) message);
32+
case group -> group((GroupMessage) message);
33+
case identify -> identify((IdentifyMessage) message);
34+
case screen -> screen((ScreenMessage) message);
35+
case page -> page((PageMessage) message);
36+
case track -> track((TrackMessage) message);
37+
default -> throw new IllegalArgumentException("Unknown payload type: " + type);
38+
};
4639
}
4740

4841
/** Called for every {@link AliasMessage}. */

analytics/src/test/java/com/rudderstack/sdk/java/analytics/TypedInterceptorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import com.rudderstack.sdk.java.analytics.messages.*;
44
import org.junit.Test;
5+
import org.mockito.Answers;
56

67
import static org.mockito.Mockito.mock;
78
import static org.mockito.Mockito.verify;
89

910
public class TypedInterceptorTest {
1011
@Test
1112
public void messagesFanOutCorrectly() {
12-
MessageInterceptor.Typed interceptor = mock(MessageInterceptor.Typed.class);
13+
MessageInterceptor.Typed interceptor = mock(MessageInterceptor.Typed.class, Answers.CALLS_REAL_METHODS);
1314

1415
AliasMessage alias = AliasMessage.builder("foo").userId("bar").build();
1516
interceptor.intercept(alias);

analytics/src/test/java/com/rudderstack/sdk/java/analytics/TypedTransformerTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22

33
import com.rudderstack.sdk.java.analytics.messages.*;
44
import org.junit.Test;
5+
import org.mockito.Answers;
56

7+
import static org.mockito.ArgumentMatchers.eq;
68
import static org.mockito.Mockito.mock;
79
import static org.mockito.Mockito.verify;
810

911
public class TypedTransformerTest {
1012
@Test
1113
public void messagesFanOutCorrectly() {
12-
MessageTransformer.Typed transformer = mock(MessageTransformer.Typed.class);
14+
MessageTransformer.Typed transformer = mock(MessageTransformer.Typed.class, Answers.CALLS_REAL_METHODS);
1315

1416
AliasMessage.Builder alias = AliasMessage.builder("foo").userId("bar");
1517
transformer.transform(alias);
16-
verify(transformer).alias(alias);
18+
verify(transformer).alias(eq(alias));
1719

1820
GroupMessage.Builder group = GroupMessage.builder("foo").userId("bar");
1921
transformer.transform(group);

0 commit comments

Comments
 (0)