Move ZMQ to a separate module

This commit is contained in:
Alexander Nozik 2023-02-26 20:23:30 +03:00
parent fca718cfc4
commit 3ef471d49e
2 changed files with 9 additions and 1 deletions

View File

@ -208,5 +208,8 @@ public class DeviceNameSpace(
}
}
/**
* Serve devices from [deviceManager] as OPC-UA
*/
public fun OpcUaServer.serveDevices(deviceManager: DeviceManager): DeviceNameSpace =
DeviceNameSpace(this, deviceManager).apply { startup() }

View File

@ -51,13 +51,18 @@ class DemoController : Controller(), ContextAware {
context.launch {
device = deviceManager.install("demo", DemoDevice)
//starting magix event loop
magixServer = startMagixServer(RSocketMagixFlowPlugin(), ZmqMagixFlowPlugin())
magixServer = startMagixServer(
RSocketMagixFlowPlugin(), //TCP rsocket support
ZmqMagixFlowPlugin() //ZMQ support
)
//Launch device client and connect it to the server
val deviceEndpoint = MagixEndpoint.rSocketWithTcp("localhost")
deviceManager.connectToMagix(deviceEndpoint)
//connect visualization to a magix endpoint
val visualEndpoint = MagixEndpoint.rSocketWithWebSockets("localhost")
visualizer = visualEndpoint.startDemoDeviceServer()
//serve devices as OPC-UA namespace
opcUaServer.startup()
opcUaServer.serveDevices(deviceManager)
}