How to ingest raw TCP (hex) and route to the correct Realm/device?

Hi all,

I plan to run OpenRemote in a multi-tenant setup (multiple Realms). Devices send raw TCP hex only (no MQTT/HTTP). I need to accept frames, decode them, map to attributes/assets, and ensure data lands in the correct Realm. I am prototyping a single external Python service that parses TCP and publishes via MQTT into a chosen Realm, but I would prefer to do this inside OR to avoid extra moving parts and future operational complexity.

Questions:

  1. What is the recommended way to ingest and parse incoming TCP hex inside OR, then route the decoded values to the right device in the correct Realm? (Agent plugin, Camel/Netty route, or another pattern?)
  2. For Realm selection, is content-based routing (device ID → Realm) the right approach, or should I run multiple endpoints bound to different Realms? How do I set the Realm context correctly for attribute writes?
  3. What is the best pattern to store device→asset and attribute mappings per Realm so they’re editable in the Console and reloadable by the parser at runtime?

Goal: a fully integrated solution in OR, without an external bridge/service.

Thanks!

Hi,

There is the AbstractTcpServerProtocol that can be implemented to define how to process the incoming data using Netty handlers.

Hi Rich, thank you for clarifying.

One thing I’m still not fully clear on: in OpenRemote an Agent usually belongs to a Realm. If I implement an AbstractTcpServerProtocol that listens on a single TCP port, what is the best practice to make this work “globally”?

My use case:

  • All devices connect to the same TCP port.
  • Each device sends raw hex including a unique identifier (e.g. IMEI).
  • I need to decode the frame and then route the values to the correct asset/device in the correct Realm.

Would the recommended approach be to:

  • create the TCP server agent in one Realm (e.g. Master),
  • and then publish AttributeEvents with fully qualified AttributeRefs so the data ends up in the right Realm?

Or is there another pattern for sharing one TCP server across multiple Realms?

Thanks again!