Skip to content

Commit d13a0e9

Browse files
committed
Use automated generation of proto java classes
1 parent cdd4108 commit d13a0e9

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

src/main/java/alice/dip/EndOfRunKafkaConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import com.google.protobuf.InvalidProtocolBufferException;
1515

16-
import alice.dip.AlicePB.NewStateNotification;
16+
import ch.cern.alice.o2.control.kafka.Kafka;
1717

1818
import java.time.Duration;
1919
import java.util.Arrays;
@@ -70,7 +70,7 @@ public void run() {
7070
byte[] cucu = record.value();
7171

7272
try {
73-
NewStateNotification info = NewStateNotification.parseFrom(cucu);
73+
Kafka.NewStateNotification info = Kafka.NewStateNotification.parseFrom(cucu);
7474
AliDip2BK.log(1, "KC_EOR.run",
7575
"New Kafka mess; partition=" + record.partition() + " offset=" + record.offset() + " L=" + cucu.length
7676
+ " RUN=" + info.getEnvInfo().getRunNumber() + " " + info.getEnvInfo().getState() + " ENVID = "

src/main/java/alice/dip/StartOfRunKafkaConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import com.google.protobuf.InvalidProtocolBufferException;
1515

16-
import alice.dip.AlicePB.NewStateNotification;
16+
import ch.cern.alice.o2.control.kafka.Kafka;
1717

1818
import java.time.Duration;
1919
import java.util.Arrays;
@@ -67,7 +67,7 @@ public void run() {
6767
NoMess = NoMess + 1;
6868

6969
try {
70-
NewStateNotification info = NewStateNotification.parseFrom(cucu);
70+
Kafka.NewStateNotification info = Kafka.NewStateNotification.parseFrom(cucu);
7171
AliDip2BK.log(1, "KC_SOR.run",
7272
"New Kafka mess; partition=" + record.partition() + " offset=" + record.offset() + " L=" + cucu.length
7373
+ " RUN=" + info.getEnvInfo().getRunNumber() + " " + info.getEnvInfo().getState() + " ENVID = "

src/main/proto/kafka.proto

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @license
3+
* Copyright 2019-2020 CERN and copyright holders of ALICE O2.
4+
* See http://alice-o2.web.cern.ch/copyright for details of the copyright holders.
5+
* All rights not expressly granted are reserved.
6+
*
7+
* This software is distributed under the terms of the GNU General Public
8+
* License v3 (GPL Version 3), copied verbatim in the file "COPYING".
9+
*
10+
* In applying this license CERN does not waive the privileges and immunities
11+
* granted to it by virtue of its status as an Intergovernmental Organization
12+
* or submit itself to any jurisdiction.
13+
*/
14+
15+
/**
16+
* @file kafka.proto - defined and maintained by Control System:
17+
* https://github.com/AliceO2Group/Control/blob/cb4ebcbdd91ade13515865df03d75313100f0309/core/integration/kafka/protos/kafka.proto
18+
* Do not edit or copy this file to other locations!
19+
*/
20+
21+
syntax = "proto3";
22+
package kafka;
23+
option go_package = "github.com/AliceO2Group/Control/core/integration/kafka/protos;kafka";
24+
option java_package = "ch.cern.alice.o2.control.kafka";
25+
26+
message NewStateNotification {
27+
EnvInfo envInfo = 1;
28+
uint64 timestamp = 2; // ms since epoch
29+
}
30+
31+
message ActiveRunsList {
32+
repeated EnvInfo activeRuns = 1;
33+
uint64 timestamp = 2; // ms since epoch
34+
}
35+
36+
message EnvInfo {
37+
string environmentId = 1;
38+
optional uint32 runNumber = 2;
39+
optional string runType = 3;
40+
string state = 4;
41+
repeated string detectors = 5;
42+
uint64 enterStateTimestamp = 6; // ms since epoch.
43+
}

0 commit comments

Comments
 (0)