https://github.com/rticommunity/rticonnextdds-connector-go
RTI Connector for Connext DDS is a lightweight technology that enables DDS data to be accessed with Go.
https://github.com/rticommunity/rticonnextdds-connector-go
dds golang golang-bindings rti-connector rti-connext-dds
Last synced: about 1 month ago
JSON representation
RTI Connector for Connext DDS is a lightweight technology that enables DDS data to be accessed with Go.
- Host: GitHub
- URL: https://github.com/rticommunity/rticonnextdds-connector-go
- Owner: rticommunity
- License: other
- Created: 2018-09-10T11:10:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2026-01-12T23:10:23.000Z (about 2 months ago)
- Last Synced: 2026-01-13T02:45:59.594Z (about 2 months ago)
- Topics: dds, golang, golang-bindings, rti-connector, rti-connext-dds
- Language: C
- Homepage:
- Size: 138 MB
- Stars: 35
- Watchers: 9
- Forks: 16
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# RTI Connector for Connext DDS - Go
[](https://github.com/rticommunity/rticonnextdds-connector-go/actions/workflows/build.yml)
[](https://goreportcard.com/report/github.com/rticommunity/rticonnextdds-connector-go)
[](https://github.com/rticommunity/rticonnextdds-connector-go/actions/workflows/build.yml)
[](https://github.com/rticommunity/rticonnextdds-connector-go/blob/master/go.mod)
[](https://godocs.io/github.com/rticommunity/rticonnextdds-connector-go)
> A lightweight, easy-to-use Go binding for RTI Connext DDS that enables rapid development of distributed applications.
## Table of Contents
- [Overview](#overview)
- [Key Features](#key-features)
- [Quick Start](#quick-start)
- [Installation](#installation)
- [Usage Examples](#usage-examples)
- [Platform Support](#platform-support)
- [Development](#development)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Support](#support)
## Overview
**RTI Connector** for Connext DDS is a lightweight, easy-to-use API that provides access to the power and functionality of [RTI Connext DDS](http://www.rti.com/products/index.html). Built on [XML-Based Application Creation](https://community.rti.com/static/documentation/connext-dds/6.0.0/doc/manuals/connext_dds/xml_application_creation/RTI_ConnextDDS_CoreLibraries_XML_AppCreation_GettingStarted.pdf) and Dynamic Data, it enables rapid prototyping and development of distributed applications.
Originally created by the RTI Research Group for demos and proof-of-concepts, RTI Connector is perfect for developers who need to quickly integrate DDS communication into their Go applications without the complexity of the full RTI Connext DDS Professional SDK.
## Key Features
โจ **Simple API** - Easy-to-use Go interface that hides DDS complexity
๐ **Rapid Development** - Get up and running with DDS in minutes
๐ **Dynamic Data** - No need to generate code from type definitions
๐ **XML Configuration** - Define data types and QoS policies declaratively in XML
๐ **Cross-Platform** - Supports Linux x64, macOS, and Windows x64
## Quick Start
### Prerequisites
- Go 1.21 or later
- Supported platform (Linux x64, macOS, Windows x64)
### Installation
1. **Create a new project directory and initialize a Go module:**
```bash
mkdir my-rti-project
cd my-rti-project
go mod init my-rti-project
```
2. **Get the Go package:**
```bash
go get github.com/rticommunity/rticonnextdds-connector-go
```
3. **Download RTI Connector libraries:**
```bash
go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest
```
4. **Set library path (for runtime):**
```bash
# macOS (Apple Silicon/ARM64) - v1.4.0+
export DYLD_LIBRARY_PATH=$(pwd)/rticonnextdds-connector/lib/osx-arm64:$DYLD_LIBRARY_PATH
# macOS (Intel/x86_64) - requires v1.3.1
# go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest -version v1.3.1
export DYLD_LIBRARY_PATH=$(pwd)/rticonnextdds-connector/lib/osx-x64:$DYLD_LIBRARY_PATH
# Linux
export LD_LIBRARY_PATH=$(pwd)/rticonnextdds-connector/lib/linux-x64:$LD_LIBRARY_PATH
# Windows (PowerShell)
$env:PATH = "$(pwd)\rticonnextdds-connector\lib\win-x64;$env:PATH"
```
> **๐ก macOS Users**: Use `osx-arm64` for Apple Silicon Macs (M1/M2/M3). Intel Mac support (`osx-x64`) requires v1.3.1. Check your architecture with `uname -m` (arm64 = Apple Silicon, x86_64 = Intel).
> **๐ก New to RTI Connector Go?** Try the [go-get-example](examples/go-get-example/) first - it provides a complete walkthrough of this installation process with a simple working example.
### Your First DDS Application
1. **Create an XML configuration file** (`ShapeExample.xml`):
```xml
```
2. **Create a publisher** (`publisher.go`):
```go
package main
import (
"log"
"time"
rti "github.com/rticommunity/rticonnextdds-connector-go"
)
func main() {
// Create connector
connector, err := rti.NewConnector("MyParticipantLibrary::Zero", "./ShapeExample.xml")
if err != nil {
log.Fatal(err)
}
defer connector.Delete()
// Get output (writer)
output, err := connector.GetOutput("MyPublisher::MySquareWriter")
if err != nil {
log.Fatal(err)
}
// Publish data
for i := 0; i < 10; i++ {
output.Instance.SetString("color", "BLUE")
output.Instance.SetInt("x", i*10)
output.Instance.SetInt("y", i*20)
output.Instance.SetInt("shapesize", 30)
output.Write()
log.Printf("Published sample %d", i)
time.Sleep(time.Second)
}
}
```
3. **Create a subscriber** (`subscriber.go`):
```go
package main
import (
"log"
rti "github.com/rticommunity/rticonnextdds-connector-go"
)
func main() {
// Create connector
connector, err := rti.NewConnector("MyParticipantLibrary::Zero", "./ShapeExample.xml")
if err != nil {
log.Fatal(err)
}
defer connector.Delete()
// Get input (reader)
input, err := connector.GetInput("MySubscriber::MySquareReader")
if err != nil {
log.Fatal(err)
}
// Read data
log.Println("Waiting for data...")
for {
connector.Wait(-1) // Wait indefinitely for data
input.Take()
numSamples, _ := input.Samples.GetLength()
for i := 0; i < numSamples; i++ {
if valid, _ := input.Infos.IsValid(i); valid {
color, _ := input.Samples.GetString(i, "color")
x, _ := input.Samples.GetInt(i, "x")
y, _ := input.Samples.GetInt(i, "y")
shapesize, _ := input.Samples.GetInt(i, "shapesize")
log.Printf("Received: color=%s, x=%d, y=%d, size=%d", color, x, y, shapesize)
}
}
}
}
```
4. **Run your application:**
Make sure you've completed the installation steps above (including library download and path setup), then:
```bash
# Terminal 1 - Start subscriber
go run subscriber.go
# Terminal 2 - Start publisher
go run publisher.go
```
You should see the subscriber receiving data published by the publisher!
## Library Management
The installation above uses our automated library download tool. For advanced scenarios, see our comprehensive guides:
- **[Library Management Documentation](docs/LIBRARY_MANAGEMENT.md)** - Complete guide to library installation options
- **[Go Get Users Guide](docs/GO_GET_USERS.md)** - Specific help for `go get` workflow
### Library Download Tool Options
```bash
# Download specific version
go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest -version v1.3.1
# Check what's currently installed
go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest -current
# List available versions
go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest -list
```
## Usage Examples
Explore our comprehensive examples to learn different patterns and use cases:
| Example | Description | Key Features |
|---------|-------------|--------------|
| [Simple](examples/simple/) | Basic publisher/subscriber | Getting started, basic data flow |
| [Go Get Example](examples/go-get-example/) | For `go get` users | Inline XML, library download workflow |
| [Shapes Demo](examples/array/) | Array data handling | Complex data types, arrays |
| [JSON Integration](examples/go_struct/) | Go struct mapping | JSON serialization, struct binding |
| [Request-Reply](examples/request_reply/) | RPC pattern | Synchronous communication |
| [Security](examples/security/) | Secure communication | Authentication, encryption |
| [Multiple Files](examples/module/) | Modular configuration | XML organization, reusability |
**๐ [Browse all examples โ](examples/README.md)**
## Platform Support
RTI Connector supports the following platforms with automated CI testing:
| Platform | Architecture | CI Status | Notes |
|----------|-------------|-----------|-------|
| **Linux** | x86_64 | โ
Tested on Ubuntu 22.04 (ubuntu-latest) | |
| **Linux** | ARM64 | โ
Supported (libraries included) | |
| **macOS** | Apple Silicon (ARM64) | โ
Tested on macos-latest | v1.4.0+ |
| **macOS** | Intel (x86_64) | โ ๏ธ Use v1.3.1 | Removed in v1.4.0 |
| **Windows** | x86_64 | โ
Tested on Windows Server 2022 (windows-latest) | |
> ๐ **Note**: Starting with v1.4.0, Intel Mac (`osx-x64`) and 32-bit ARM Linux (`linux-arm`) support have been removed. If you need these platforms, use v1.3.1: `go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest -version v1.3.1`
### Version Information
To check the version of your installed RTI libraries:
```bash
go run github.com/rticommunity/rticonnextdds-connector-go/cmd/download-libs@latest -current
```
## Development
### Building and Testing
For contributors and developers working with the source code:
```bash
# Clone and setup
git clone https://github.com/rticommunity/rticonnextdds-connector-go.git
cd rticonnextdds-connector-go
make download-libs
# Run all tests with coverage
make test-local
# Run comprehensive test suite with quality checks
./test_improvements.sh
# Build all packages
go build ./...
# Run static analysis
go vet ./...
# Format code
go fmt ./...
```
### Threading Model
> โ ๏ธ **Important**: The Connector Native API does not implement thread safety. You are responsible for protecting calls to Connector in multi-threaded applications.
The native code was originally designed for single-threaded environments (RTI Prototyper and Lua). While we've added support for Go, Python, and JavaScript, thread safety remains the developer's responsibility.
## Documentation
- ๏ฟฝ **[API Reference](https://godocs.io/github.com/rticommunity/rticonnextdds-connector-go)** - Complete Go API documentation
- ๐ **[Examples](examples/README.md)** - Comprehensive examples and tutorials
- ๐งช **[Testing Guide](TESTING.md)** - Development and testing guidelines
- ๐ **[Library Management](docs/LIBRARY_MANAGEMENT.md)** - Managing RTI Connector libraries
- ๐ **[Go Get Users Guide](docs/GO_GET_USERS.md)** - Complete guide for `go get` users
- ๐ค **[Contributing](CONTRIBUTING.md)** - How to contribute to the project
### Additional Resources
- [RTI Connext DDS Documentation](https://community.rti.com/documentation)
- [XML-Based Application Creation Guide](https://community.rti.com/static/documentation/connext-dds/6.0.0/doc/manuals/connext_dds/xml_application_creation/RTI_ConnextDDS_CoreLibraries_XML_AppCreation_GettingStarted.pdf)
- [RTI Community Forum](https://community.rti.com/forums/technical-questions)
## Contributing
We welcome contributions! Here's how to get started:
1. **๐ [Sign the CLA](CONTRIBUTING.md)** - Required for all contributions
2. **๐ด Fork and clone** the repository
3. **๐ง Make your changes** with tests
4. **โ
Run quality checks**: `make test-local` or `./test_improvements.sh`
5. **๐ค Submit a pull request**
All contributions are automatically tested for quality, including:
- Build verification across platforms
- Code linting and formatting
- Comprehensive test suite validation
- Coverage analysis
## Support
### Getting Help
- ๐ฌ **[RTI Community Forum](https://community.rti.com/forums/technical-questions)** - Technical questions and discussions
- ๐ **[GitHub Issues](https://github.com/rticommunity/rticonnextdds-connector-go/issues)** - Bug reports and feature requests
- ๐ง **[Contact RTI](mailto:sales@rti.com)** - Commercial support and licensing
---
**Ready to get started?** Check out our [Quick Start](#quick-start) guide or explore the [examples](examples/README.md)!