Move ZMQ to a separate module
This commit is contained in:
parent
fca718cfc4
commit
3ef471d49e
@ -208,5 +208,8 @@ public class DeviceNameSpace(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serve devices from [deviceManager] as OPC-UA
|
||||||
|
*/
|
||||||
public fun OpcUaServer.serveDevices(deviceManager: DeviceManager): DeviceNameSpace =
|
public fun OpcUaServer.serveDevices(deviceManager: DeviceManager): DeviceNameSpace =
|
||||||
DeviceNameSpace(this, deviceManager).apply { startup() }
|
DeviceNameSpace(this, deviceManager).apply { startup() }
|
@ -51,13 +51,18 @@ class DemoController : Controller(), ContextAware {
|
|||||||
context.launch {
|
context.launch {
|
||||||
device = deviceManager.install("demo", DemoDevice)
|
device = deviceManager.install("demo", DemoDevice)
|
||||||
//starting magix event loop
|
//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
|
//Launch device client and connect it to the server
|
||||||
val deviceEndpoint = MagixEndpoint.rSocketWithTcp("localhost")
|
val deviceEndpoint = MagixEndpoint.rSocketWithTcp("localhost")
|
||||||
deviceManager.connectToMagix(deviceEndpoint)
|
deviceManager.connectToMagix(deviceEndpoint)
|
||||||
|
//connect visualization to a magix endpoint
|
||||||
val visualEndpoint = MagixEndpoint.rSocketWithWebSockets("localhost")
|
val visualEndpoint = MagixEndpoint.rSocketWithWebSockets("localhost")
|
||||||
visualizer = visualEndpoint.startDemoDeviceServer()
|
visualizer = visualEndpoint.startDemoDeviceServer()
|
||||||
|
|
||||||
|
//serve devices as OPC-UA namespace
|
||||||
opcUaServer.startup()
|
opcUaServer.startup()
|
||||||
opcUaServer.serveDevices(deviceManager)
|
opcUaServer.serveDevices(deviceManager)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user