1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.technical.tracking
21 
22 import akka.actor.typed.Behavior
23 import org.make.api.technical.KafkaProducerBehavior
24 import org.make.core.MakeSerializable
25 import org.make.core.technical.IdGenerator
26 
27 class PanoramicProducerBehavior extends KafkaProducerBehavior[PanoramicEvent, PanoramicEventWrapper] {
28   override protected val topicKey: String = PanoramicProducerBehavior.topicKey
29   override protected def wrapEvent(event: PanoramicEvent): PanoramicEventWrapper = {
30     PanoramicEventWrapper(
31       version = MakeSerializable.V1,
32       id = IdGenerator.uuidGenerator.nextId(),
33       date = event.createdAt,
34       eventType = "PanoramicEvent",
35       event = event
36     )
37   }
38 }
39 
40 object PanoramicProducerBehavior {
41   def apply(): Behavior[PanoramicEvent] = new PanoramicProducerBehavior().createBehavior(name)
42   val name: String = "panoramic-events-producer"
43   val topicKey: String = "tracking-panoramic"
44 }
Line Stmt Id Pos Tree Symbol Tests Code
28 6106 1100 - 1134 Select org.make.api.technical.tracking.PanoramicProducerBehavior.topicKey PanoramicProducerBehavior.topicKey
30 6817 1224 - 1422 Apply org.make.api.technical.tracking.PanoramicEventWrapper.apply PanoramicEventWrapper.apply(org.make.core.MakeSerializable.V1, org.make.core.technical.IdGenerator.uuidGenerator.nextId(), event.createdAt, "PanoramicEvent", event)
31 7529 1263 - 1282 Select org.make.core.MakeSerializable.V1 org.make.core.MakeSerializable.V1
32 6670 1295 - 1329 Apply org.make.core.technical.IdGenerator.nextId org.make.core.technical.IdGenerator.uuidGenerator.nextId()
33 6261 1344 - 1359 Select org.make.api.technical.tracking.PanoramicEvent.createdAt event.createdAt
34 7700 1379 - 1395 Literal <nosymbol> "PanoramicEvent"
41 5973 1554 - 1558 Select org.make.api.technical.tracking.PanoramicProducerBehavior.name PanoramicProducerBehavior.this.name
41 7363 1507 - 1559 Apply org.make.api.technical.KafkaProducerBehavior.createBehavior new PanoramicProducerBehavior().createBehavior(PanoramicProducerBehavior.this.name)
42 6944 1581 - 1608 Literal <nosymbol> "panoramic-events-producer"
43 6182 1634 - 1654 Literal <nosymbol> "tracking-panoramic"