Metadata-Version: 2.1
Name: rti.connext
Version: 7.3.1.2
Summary: A full Python binding for RTI Connext
Home-page: https://community.rti.com/static/documentation/connext-dds/7.3.1.2/doc/api/connext_dds/api_python/index.html
Author: RTI
Author-email: support@rti.com
License: https://community.rti.com/static/documentation/connext-dds/7.3.1.2/doc/api/connext_dds/api_python/copyright.html
Requires-Dist: dataclasses; python_version < "3.7"

Connext Python API
==================

RTI® Connext® is a connectivity framework for building distributed applications
with requirements for high performance and scalability.

The RTI Connext Python API provides access to most Connext features from
Python.

Documentation
-------------

-  The `Connext Getting Started Guide <https://community.rti.com/static/documentation/connext-dds/7.3.1/doc/manuals/connext_dds_professional/getting_started_guide/index.html>`__
   helps you install the software and run your first RTI Connext Python
   application while learning general concepts of Connext.

-  The `Connext Python API Reference <https://community.rti.com/static/documentation/connext-dds/7.3.1/doc/api/connext_dds/api_python/index.html>`__
   provides an overview of the API, additional examples and the API reference.

-  Additional Connext documentation, including the User's Manual and
   Release Notes is available at the `Connext Community Portal <https://community.rti.com/documentation/>`__.

Hello World Example
-------------------

The following is the basic code to publish and subscribe to a topic
defined by a simple data type.

Define your types:

.. code:: python

   # hello.py

   import rti.types as idl

   @idl.struct
   class HelloWorld:
       message: str = ""

Create a *DataWriter* to publish the HelloWorld Topic:

.. code:: python

   # hello_publisher.py

   import time
   import rti.connextdds as dds
   from hello import HelloWorld

   participant = dds.DomainParticipant(domain_id=0)
   topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
   writer = dds.DataWriter(participant.implicit_publisher, topic)

   for i in range(10):
       writer.write(HelloWorld(message=f'Hello World! #{i}'))
       time.sleep(1)

Create a *DataReader* to subscribe to the HelloWorld Topic:

.. code:: python

   # hello_subscriber.py

   import rti.connextdds as dds
   import rti.asyncio
   from hello import HelloWorld

   participant = dds.DomainParticipant(domain_id=0)
   topic = dds.Topic(participant, 'HelloWorld Topic', HelloWorld)
   reader = dds.DataReader(participant.implicit_subscriber, topic)

   async def print_data():
       async for data in reader.take_data_async():
           print(f"Received: {data}")

   rti.asyncio.run(print_data())
