Skip to content

Commit c9d5519

Browse files
committed
refactor
1 parent 783f3e0 commit c9d5519

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/kotlin/spp/cli/commands/instrument/SubscribeEvents.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import io.vertx.kotlin.coroutines.await
3636
import kotlinx.coroutines.runBlocking
3737
import spp.cli.PlatformCLI
3838
import spp.protocol.ProtocolMarshaller.deserializeLiveInstrumentRemoved
39-
import spp.protocol.SourceServices
39+
import spp.protocol.SourceServices.Provide.toLiveInstrumentSubscriberAddress
4040
import spp.protocol.extend.TCPServiceFrameParser
4141
import spp.protocol.instrument.event.LiveBreakpointHit
4242
import spp.protocol.instrument.event.LiveInstrumentEvent
@@ -88,7 +88,7 @@ class SubscribeEvents : CliktCommand(
8888
).await()
8989
socket!!.handler(FrameParser(TCPServiceFrameParser(vertx, socket)))
9090

91-
vertx.eventBus().consumer<JsonObject>(SourceServices.Provide.LIVE_INSTRUMENT_SUBSCRIBER) {
91+
vertx.eventBus().consumer<JsonObject>(toLiveInstrumentSubscriberAddress(PlatformCLI.developer.id)) {
9292
val liveEvent = Json.decodeValue(it.body().toString(), LiveInstrumentEvent::class.java)
9393

9494
//todo: impl filter on platform
@@ -157,7 +157,7 @@ class SubscribeEvents : CliktCommand(
157157
//register listener
158158
FrameHelper.sendFrame(
159159
BridgeEventType.REGISTER.name.lowercase(),
160-
SourceServices.Provide.LIVE_INSTRUMENT_SUBSCRIBER, null,
160+
toLiveInstrumentSubscriberAddress(PlatformCLI.developer.id), null,
161161
JsonObject().apply { PlatformCLI.developer.accessToken?.let { put("auth-token", it) } },
162162
null, null, socket
163163
)

src/main/kotlin/spp/cli/commands/view/SubscribeView.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameParser
3434
import io.vertx.kotlin.coroutines.await
3535
import kotlinx.coroutines.runBlocking
3636
import spp.cli.PlatformCLI
37-
import spp.protocol.SourceServices.Provide.LIVE_VIEW_SUBSCRIBER
37+
import spp.protocol.SourceServices.Provide.toLiveViewSubscriberAddress
3838
import spp.protocol.artifact.log.Log
3939
import spp.protocol.artifact.log.LogOrderType
4040
import spp.protocol.artifact.log.LogResult
@@ -91,7 +91,7 @@ class SubscribeView : CliktCommand(
9191
).await()
9292
socket!!.handler(FrameParser(TCPServiceFrameParser(vertx, socket)))
9393

94-
vertx.eventBus().consumer<JsonObject>("$LIVE_VIEW_SUBSCRIBER.${PlatformCLI.developer.id}") {
94+
vertx.eventBus().consumer<JsonObject>(toLiveViewSubscriberAddress(PlatformCLI.developer.id)) {
9595
val event = Json.decodeValue(it.body().toString(), LiveViewEvent::class.java)
9696
if (outputFullEvent) {
9797
println(event.metricsData)
@@ -107,7 +107,7 @@ class SubscribeView : CliktCommand(
107107
//register listener
108108
FrameHelper.sendFrame(
109109
BridgeEventType.REGISTER.name.lowercase(),
110-
"$LIVE_VIEW_SUBSCRIBER.${PlatformCLI.developer.id}", null,
110+
toLiveViewSubscriberAddress(PlatformCLI.developer.id), null,
111111
JsonObject().apply { PlatformCLI.developer.accessToken?.let { put("auth-token", it) } },
112112
null, null, socket
113113
)

0 commit comments

Comments
 (0)