Skip to content

Commit

Permalink
Merge pull request #59 from sportradar/v3
Browse files Browse the repository at this point in the history
release v3.1.0
  • Loading branch information
ignastraskevicius-projects authored Feb 19, 2024
2 parents 711f219 + 59fe517 commit af79a6f
Show file tree
Hide file tree
Showing 169 changed files with 9,225 additions and 1,152 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
### Unified Feed SDK 2.x changelog
### Unified Feed SDK 3.x changelog

**3.0.0 (2023-XX-YY)**
**3.1.0 (2024-02-19)**
* SDK can be used in a construct close-with-resources
* recovering after network outages no longer causes message duplication
* Markets are no longer excluded from messages handed over to the listener when descriptions of markets are unavailable
* Fix: faulty market descriptions are attempted to be re-fetched irrespective from exception handling strategy configured

**3.0.0 (2023-10-24)**
* Consistent casing used in naming in java code as per Google java style guidelines (refer to Migration Guide)
* Upgrading Apache http client library from 4 to 5
* methods getName/s exposed more consistently in classes: categoryData, sportData, currentSeason, drawResult, manager, tournamentInfo
Expand Down
Binary file removed SportEventHierarchy-light.png
Binary file not shown.
Binary file removed SportEventHierarchy.png
Binary file not shown.
94 changes: 0 additions & 94 deletions SportEventHierarchy.uml

This file was deleted.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.sportradar.unifiedodds.sdk</groupId>
<artifactId>unified-feed-sdk-parent</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
<packaging>pom</packaging>
<name>Unified Odds Feed SDK - parent</name>
<description>UnifiedFeed SDK is a client library that enables easier integration with the Betradar XML feeds. SDK exposes XML feed service interface in a more user-friendly way and isolates the client from having to do XML feed parsing, proper connection handling, error recovery, event queuing, data caching and dispatching. It also makes a client solution more stable and robust when it comes to feed handling, especially with the release of new and updated XML feed versions.</description>
Expand Down
Binary file modified sdk-core/.DS_Store
Binary file not shown.
7 changes: 5 additions & 2 deletions sdk-core/build-tools/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,8 @@
<property name="excludedClasses" value="ArrayIndexOutOfBoundsException,
Class, Object, Override, Void, void,
Deprecated, SafeVarargs, SuppressWarnings,
val, var,
val, var, NonNull, AllArgsConstructor, NoArgsConstructor, RequiredArgsConstructor, AccessLevel,
Getter, Setter,
Exception, IllegalArgumentException, IllegalStateException,
IndexOutOfBoundsException, InterruptedException, NullPointerException,
RuntimeException, SecurityException, UnsupportedOperationException, Throwable,
Expand All @@ -1688,7 +1689,9 @@
Assertions,
Mockito, ArgumentMatchers"/>
</module>
<module name="ClassTypeParameterName"/>
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z]{1,}$"/>
</module>
<module name="CommentsIndentation"/>
<module name="ConstantName"/>
<module name="CovariantEquals"/>
Expand Down
7 changes: 7 additions & 0 deletions sdk-core/build-tools/toxiproxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ghcr.io/shopify/toxiproxy:2.7.0

COPY config.conf /app/config/proxies.json

EXPOSE 8093
ENTRYPOINT ["/toxiproxy"]
CMD ["-host=0.0.0.0", "-config=/app/config/proxies.json"]
8 changes: 8 additions & 0 deletions sdk-core/build-tools/toxiproxy/config.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "rabbit-proxy",
"listen": "[::]:8093",
"upstream": "rabbit:5672",
"enabled": true
}
]
29 changes: 26 additions & 3 deletions sdk-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.sportradar.unifiedodds.sdk</groupId>
<artifactId>unified-feed-sdk</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>

<name>Unified Odds Feed SDK</name>

Expand Down Expand Up @@ -124,6 +124,12 @@
<version>${rabbitMQ.http.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>eu.rekawek.toxiproxy</groupId>
<artifactId>toxiproxy-java</artifactId>
<version>2.1.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
Expand Down Expand Up @@ -239,7 +245,12 @@
<version>2.12.5</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down Expand Up @@ -778,7 +789,19 @@
<version>3.1.0</version>
<executions>
<execution>
<id>pre-integration-test</id>
<id>require-toxiproxy-unless-toxiproxy-tests-skipped</id>
<phase>pre-integration-test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<skip>${skipITs}</skip>
<mainClass>com.sportradar.unifiedodds.sdk.integrationtest.preconditions.PreconditionsForProxiedRabbitIntegrationTests</mainClass>
<classpathScope>test</classpathScope>
</configuration>
</execution>
<execution>
<id>require-rabbit-unless-IT-skipped</id>
<phase>pre-integration-test</phase>
<goals>
<goal>java</goal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"VisibilityModifier",
}
)
public class UofSdk {
public class UofSdk implements AutoCloseable {

/**
* The logger instance used for the UofSdk logs
Expand Down Expand Up @@ -520,6 +520,7 @@ public boolean isOpen() {
*
* @throws IOException if the AMQP connection closure fails
*/
@Override
public void close() throws IOException {
if (!this.feedOpened) {
logger.warn("Invoked close on already closed UofSdk instance");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ public interface ChannelMessageConsumer {
* @param receivedAt - the time when message was received (in milliseconds since EPOCH UTC)
*/
void onMessageReceived(String routingKey, byte[] body, AMQP.BasicProperties properties, long receivedAt);

String getConsumerDescription();
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ public void onMessageReceived(
messageConsumer.onMessageReceived(unmarshalledMessage, body, routingKeyInfo, timestamp);
}

@Override
public String getConsumerDescription() {
return messageConsumer.getConsumerDescription();
}

private void dispatchUnparsableMessage(String msg, byte[] body, Urn eventId, MessageTimestamp timestamp) {
logger.warn(msg);
messageConsumer.onMessageDeserializationFailed(body, eventId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code
*/
package com.sportradar.unifiedodds.sdk.impl;

import com.sportradar.unifiedodds.sdk.LoggerDefinitions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MessageTrafficLogger {

private static final String TRAFFIC_LOG_DELIMITER = "<~>";

private static final Logger TRAFFIC_LOGGER = LoggerFactory.getLogger(
LoggerDefinitions.UfSdkTrafficLog.class
);

private MessageTrafficLogger() {}

public static void logReceivedOnClosedChannel(
String consumerDescription,
String routingKey,
byte[] body
) {
TRAFFIC_LOGGER.debug(
"{} {} {} {} {}",
consumerDescription,
TRAFFIC_LOG_DELIMITER,
routingKey,
TRAFFIC_LOG_DELIMITER,
"received on closed channel: " + new String(body)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.sportradar.unifiedodds.sdk.caching.ProfileCache;
import com.sportradar.unifiedodds.sdk.caching.markets.MarketDescriptionProvider;
import com.sportradar.unifiedodds.sdk.entities.SportEvent;
import com.sportradar.unifiedodds.sdk.impl.TimeUtils;
import java.util.Map;

/**
Expand All @@ -23,22 +24,26 @@ public class NameProviderFactoryImpl implements NameProviderFactory {
private final ProfileCache profileCache;
private final NameExpressionFactory expressionFactory;
private final ExceptionHandlingStrategy exceptionHandlingStrategy;
private final TimeUtils time;

@Inject
public NameProviderFactoryImpl(
MarketDescriptionProvider descriptorProvider,
ProfileCache profileCache,
NameExpressionFactory expressionFactory,
SdkInternalConfiguration cfg
SdkInternalConfiguration cfg,
TimeUtils time
) {
Preconditions.checkNotNull(descriptorProvider);
Preconditions.checkNotNull(profileCache);
Preconditions.checkNotNull(expressionFactory);
Preconditions.checkNotNull(time);

this.descriptorProvider = descriptorProvider;
this.profileCache = profileCache;
this.expressionFactory = expressionFactory;
this.exceptionHandlingStrategy = cfg.getExceptionHandlingStrategy();
this.time = time;
}

@Override
Expand All @@ -56,7 +61,8 @@ public NameProvider buildNameProvider(
marketId,
specifiers,
producerId,
exceptionHandlingStrategy
exceptionHandlingStrategy,
time
);
}
}
Loading

0 comments on commit af79a6f

Please sign in to comment.