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 26 class TrackingProducerBehavior extends KafkaProducerBehavior[TrackingEvent, TrackingEventWrapper] { 27 override protected val topicKey: String = TrackingProducerBehavior.topicKey 28 override protected def wrapEvent(event: TrackingEvent): TrackingEventWrapper = { 29 TrackingEventWrapper( 30 version = MakeSerializable.V1, 31 id = event.requestContext.sessionId.value, 32 date = event.createdAt, 33 eventType = "TrackingEvent", 34 event = event 35 ) 36 } 37 } 38 39 object TrackingProducerBehavior { 40 def apply(): Behavior[TrackingEvent] = new TrackingProducerBehavior().createBehavior(name) 41 val name: String = "tracking-events-producer" 42 val topicKey: String = "tracking-events" 43 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 27 | 7533 | 1054 - 1087 | Select | org.make.api.technical.tracking.TrackingProducerBehavior.topicKey | TrackingProducerBehavior.topicKey | |
| 29 | 5937 | 1175 - 1373 | Apply | org.make.api.technical.tracking.TrackingEventWrapper.apply | TrackingEventWrapper.apply(org.make.core.MakeSerializable.V1, event.requestContext.sessionId.value, event.createdAt, "TrackingEvent", event) | |
| 30 | 6672 | 1213 - 1232 | Select | org.make.core.MakeSerializable.V1 | org.make.core.MakeSerializable.V1 | |
| 31 | 6221 | 1245 - 1281 | Select | org.make.core.session.SessionId.value | event.requestContext.sessionId.value | |
| 32 | 7704 | 1296 - 1311 | Select | org.make.api.technical.tracking.TrackingEvent.createdAt | event.createdAt | |
| 33 | 6888 | 1331 - 1346 | Literal | <nosymbol> | "TrackingEvent" | |
| 40 | 7365 | 1502 - 1506 | Select | org.make.api.technical.tracking.TrackingProducerBehavior.name | TrackingProducerBehavior.this.name | |
| 40 | 6976 | 1456 - 1507 | Apply | org.make.api.technical.KafkaProducerBehavior.createBehavior | new TrackingProducerBehavior().createBehavior(TrackingProducerBehavior.this.name) | |
| 41 | 6188 | 1529 - 1555 | Literal | <nosymbol> | "tracking-events-producer" | |
| 42 | 7560 | 1581 - 1598 | Literal | <nosymbol> | "tracking-events" |