|
1 | | -/************* |
2 | | - * cil |
3 | | - **************/ |
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright CERN and copyright holders of ALICE O2. This software is |
| 4 | + * distributed under the terms of the GNU General Public License v3 (GPL |
| 5 | + * Version 3), copied verbatim in the file "COPYING". |
| 6 | + * |
| 7 | + * See http://alice-o2.web.cern.ch/license for full licensing information. |
| 8 | + * |
| 9 | + * In applying this license CERN does not waive the privileges and immunities |
| 10 | + * granted to it by virtue of its status as an Intergovernmental Organization |
| 11 | + * or submit itself to any jurisdiction. |
| 12 | + */ |
4 | 13 |
|
5 | 14 | package alice.dip; |
6 | 15 |
|
|
19 | 28 | import java.util.concurrent.ArrayBlockingQueue; |
20 | 29 | import java.util.concurrent.BlockingQueue; |
21 | 30 |
|
| 31 | +import alice.dip.kafka.BeamModeEventsKafkaProducer; |
22 | 32 | import cern.dip.BadParameter; |
23 | 33 | import cern.dip.DipData; |
24 | 34 | import cern.dip.DipTimestamp; |
@@ -46,19 +56,28 @@ public class DipMessagesProcessor implements Runnable { |
46 | 56 | private BlockingQueue<MessageItem> outputQueue = new ArrayBlockingQueue<MessageItem>(100); |
47 | 57 |
|
48 | 58 | private final LuminosityManager luminosityManager; |
| 59 | + private BeamModeEventsKafkaProducer beamModeEventsKafkaProducer; |
49 | 60 |
|
50 | 61 | public DipMessagesProcessor(BookkeepingClient bookkeepingClient, LuminosityManager luminosityManager) { |
51 | 62 |
|
52 | 63 | this.bookkeepingClient = bookkeepingClient; |
53 | 64 | this.luminosityManager = luminosityManager; |
54 | | - |
| 65 | + this.beamModeEventsKafkaProducer = null; |
55 | 66 | Thread t = new Thread(this); |
56 | 67 | t.start(); |
57 | 68 |
|
58 | 69 | currentAlice = new AliceInfoObj(); |
59 | 70 | loadState(); |
60 | 71 | } |
61 | 72 |
|
| 73 | + /** |
| 74 | + * Setter of events producer |
| 75 | + * @param beamModeEventsKafkaProducer - instance of BeamModeEventsKafkaProducer to be used to send events |
| 76 | + */ |
| 77 | + public void setEventsProducer(BeamModeEventsKafkaProducer beamModeEventsKafkaProducer) { |
| 78 | + this.beamModeEventsKafkaProducer = beamModeEventsKafkaProducer; |
| 79 | + } |
| 80 | + |
62 | 81 | /* |
63 | 82 | * This method is used for receiving DipData messages from the Dip Client |
64 | 83 | */ |
@@ -399,6 +418,9 @@ public void newSafeMode(long time, int val) { |
399 | 418 | } else { |
400 | 419 |
|
401 | 420 | currentFill.setBeamMode(time, "LOST BEAMS"); |
| 421 | + if (beamModeEventsKafkaProducer != null) { |
| 422 | + beamModeEventsKafkaProducer.sendEvent(currentFill.fillNo, currentFill, time); |
| 423 | + } |
402 | 424 | AliDip2BK.log(5, "ProcData.newSafeBeams", " CHANGE BEAM MODE TO LOST BEAMS !!! "); |
403 | 425 | } |
404 | 426 |
|
@@ -580,6 +602,9 @@ public void newBeamMode(long date, String BeamMode) { |
580 | 602 | ); |
581 | 603 | bookkeepingClient.updateLhcFill(currentFill); |
582 | 604 | saveState(); |
| 605 | + if (beamModeEventsKafkaProducer != null) { |
| 606 | + beamModeEventsKafkaProducer.sendEvent(currentFill.fillNo, currentFill, date); |
| 607 | + } |
583 | 608 | } else { |
584 | 609 | currentFill.endedTime = date; |
585 | 610 | bookkeepingClient.updateLhcFill(currentFill); |
|
0 commit comments