Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): improvement on sync kraken version #197

Closed
wants to merge 12 commits into from
4 changes: 2 additions & 2 deletions kraken-app/kraken-app-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-app-agent</artifactId>
<name>kraken-app-agent</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-app</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
Expand Down
4 changes: 2 additions & 2 deletions kraken-app/kraken-app-controller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-app-controller</artifactId>
<name>kraken-app-controller</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-app</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
Expand Down
6 changes: 3 additions & 3 deletions kraken-app/kraken-app-hub/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-app-hub</artifactId>
<name>kraken-app-hub</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-app</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>

<properties>
Expand All @@ -23,7 +23,7 @@
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-gateway</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>

</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions kraken-app/kraken-app-portal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion kraken-app/kraken-app-portal/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kraken-app-portal",
"private": true,
"version": "1.0.0-rc.0",
"version": "2.0.0-snapshot.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
20 changes: 10 additions & 10 deletions kraken-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-app</artifactId>
<name>kraken-app</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>pom</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-platform</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>


Expand Down Expand Up @@ -40,42 +40,42 @@
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-core</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-data</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-sync</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-gateway</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-controller</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-mef</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-test</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-auth</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
8 changes: 4 additions & 4 deletions kraken-java-sdk/kraken-java-sdk-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>
<artifactId>kraken-java-sdk-auth</artifactId>
<name>kraken-java-sdk-auth</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
Expand All @@ -33,13 +33,13 @@
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-core</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<!-- test -->
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-test</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
10 changes: 5 additions & 5 deletions kraken-java-sdk/kraken-java-sdk-controller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-java-sdk-controller</artifactId>
<name>kraken-java-sdk-controller</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>

<dependencies>

<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-core</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>

<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-auth</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -63,7 +63,7 @@
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-test</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions kraken-java-sdk/kraken-java-sdk-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-java-sdk-core</artifactId>
<name>kraken-java-sdk-core</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>

<dependencies>
Expand Down Expand Up @@ -155,7 +155,7 @@
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-test</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions kraken-java-sdk/kraken-java-sdk-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-java-sdk-data</artifactId>
<name>kraken-java-sdk-data</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>
<dependencies>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-core</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-test</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
10 changes: 5 additions & 5 deletions kraken-java-sdk/kraken-java-sdk-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-java-sdk-gateway</artifactId>
<name>kraken-java-sdk-gateway</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>

<dependencies>

<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-data</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>

<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-auth</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>

<!-- spring cloud gateway -->
Expand Down Expand Up @@ -94,7 +94,7 @@
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-test</artifactId>
<scope>test</scope>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions kraken-java-sdk/kraken-java-sdk-mef/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-java-sdk-mef</artifactId>
<name>kraken-java-sdk-mef</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>

<dependencies>
Expand Down
8 changes: 4 additions & 4 deletions kraken-java-sdk/kraken-java-sdk-sync/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>kraken-java-sdk-sync</artifactId>
<name>kraken-java-sdk-sync</name>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</parent>
<dependencies>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-data</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
</dependency>
<dependency>
<groupId>com.consoleconnect.kraken</groupId>
<artifactId>kraken-java-sdk-test</artifactId>
<version>1.0.0-rc.0</version>
<version>2.0.0-snapshot.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
import com.consoleconnect.kraken.operator.core.repo.MgmtEventRepository;
import com.consoleconnect.kraken.operator.core.repo.SystemInfoRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

@Service
@RequiredArgsConstructor
public class PushKrakenVersionService {
private static final String KEY = "CONTROL_PLANE";
private final SystemInfoRepository systemInfoRepository;
private final MgmtEventRepository eventRepository;
private final MgmtEventRepository mgmtEventRepository;

@Scheduled(cron = "${app.cron-job.sync-system-info-from-control-plane:-}")
public void runIt() {
Expand All @@ -23,12 +27,24 @@ public void runIt() {
.findOneByKey(KEY)
.ifPresent(
systemInfoEntity -> {
MgmtEventEntity entity = new MgmtEventEntity();
entity.setStatus(EventStatusType.WAIT_TO_SEND.name());
entity.setPayload(systemInfoEntity);
entity.setResourceId(systemInfoEntity.getId().toString());
entity.setEventType(MgmtEventType.CLIENT_SYSTEM_INFO.name());
eventRepository.save(entity);
Page<MgmtEventEntity> mgmtEventEntities =
mgmtEventRepository.search(
MgmtEventType.CLIENT_SYSTEM_INFO.name(), null, Pageable.ofSize(1));
if (CollectionUtils.isEmpty(mgmtEventEntities.getContent())) {
MgmtEventEntity entity = new MgmtEventEntity();
entity.setStatus(EventStatusType.WAIT_TO_SEND.name());
entity.setPayload(systemInfoEntity);
entity.setResourceId(systemInfoEntity.getId().toString());
entity.setEventType(MgmtEventType.CLIENT_SYSTEM_INFO.name());
eventRepository.save(entity);
} else {
// if sync system info event exists, update state to wait_to_send to re-active the
// event
MgmtEventEntity eventEntity = mgmtEventEntities.getContent().get(0);
eventEntity.setStatus(EventStatusType.WAIT_TO_SEND.name());
eventEntity.setPayload(systemInfoEntity);
eventRepository.save(eventEntity);
}
});
}
}
Loading
Loading