Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>1.11.3</version>
<version>1.11.4</version>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -94,9 +94,19 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.11.0</version>
<version>5.18.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.25.5</version>
</dependency>
<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.1.10.5</version>
</dependency>
</dependencies>

<build>
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Optimove Java SDK
# Optimove Java SDK

This SDK provides a Java library for working with customer engagement data. The library includes classes for getting engagement data, as well as metadata about the engagement.

Expand All @@ -10,7 +10,7 @@ To use this SDK in your project, you'll need to add it as a dependency in your M
<dependency>
<groupId>io.github.maryan-opti</groupId>
<artifactId>Optimove-SDK-Engagement-java</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</dependency>
```
Then, you can import the necessary classes from the SDK into your Java code:
Expand Down Expand Up @@ -136,4 +136,4 @@ DataFileStream<GenericRecord> dataFileStream = engagement.getCustomersFileStream
logger.error("Invalid file path: " + e.getMessage(), e);
// handle error
}
```
```
2 changes: 1 addition & 1 deletion settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
<password>v1g4IfBrB5oOjsWQNrd3EsMJmwzELR9qZ4t4i5J5qNNx</password>
</server>
</servers>
</settings>
</settings>
13 changes: 11 additions & 2 deletions src/main/java/optimove/sdk/engagement/Engagement.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,17 @@ public DataFileStream<GenericRecord> getCustomersFileStream(String srcFileName)
throw new IllegalArgumentException("srcFileName is null or empty");
}

try (ReadChannel readChanel = StorageSingleton.getReadChanel(this.settings.getBucketName(), srcFileName, this.settings.getDecryptionKey());
InputStream targetStream = Channels.newInputStream(readChanel)) {
try {
// Do NOT wrap the ReadChannel and InputStream in try-with-resources here –
// doing so would close them immediately, making the returned DataFileStream unusable
// and causing a ClosedChannelException when the caller tries to read.

ReadChannel readChannel = StorageSingleton.getReadChanel(
this.settings.getBucketName(),
srcFileName,
this.settings.getDecryptionKey());

InputStream targetStream = Channels.newInputStream(readChannel);

DatumReader<GenericRecord> datumReader = new GenericDatumReader<>();
return new DataFileStream<>(targetStream, datumReader);
Expand Down
Loading