Abstract: A real-time control system has been operating successfully for the TJ-II stellarator since 1997. It was designed and built as a set of distributed and autonomous systems based on VMEbus and OS9 RTOS. At present, an upgrade, based on the VxWorks operating system, is being undertaken. As this process is gradual, both current and future real-time control systems must work simultaneously until this upgrade is completed. A new communication middleware architecture that implements XML-based Messages Distribution Service has been developed and applied for this. It has been created in response to the need to standardize the message publish-subscribe programming model for the TJ-II distributed control systems. It permits data, events and commands to be sent and received between distributed control applications that run on different real-time operating systems (OS9 and VxWorks) as well as Java-based applications running on any Windows or Linux platform. It has been fully tested and found to be both reliable and safe. Specific software tools have been developed to create, manage and monitor any distributed control variables involved in TJ-II experiments.