rticommunity / rticonnextdds-connector

RTI Connector for Connext DDS is a lightweight technology that enables DDS data to be accessed with Javascript (Node.js), Python, and Lua.
Other
56 stars 33 forks source link

Expose writer dispose of instance #67

Closed tom-wp closed 4 years ago

tom-wp commented 4 years ago

It is possible to publish topic instances through the RTIDDSConnector_write() function but there is no equivalent function for disposing of a published instance. The lack of this feature currently prevents us from using this connector in our Go applications where other services watch for the removal of instances.

This could be implemented through a similar interface, by setting the key values in the Output Instance structure, then calling RTIDDSConnector_dispose().

samuelraeburn commented 4 years ago

Hi @tom-wp What language binding are you using? In the Python and JavaScript connectors, this behaviour is already supported.

tom-wp commented 4 years ago

Hi @samuelraeburn I am using the Go connector. Looking at the JavaScript connector I see this is already implemented as a string that is passed into the connector write function.

tom-wp commented 4 years ago

Thank you for the pointers @samuelraeburn. I have this working in the Go connector as:

func (output *Output) Dispose() error {
    paramsCStr := C.CString(`{"action":"dispose"}`)
    defer C.free(unsafe.Pointer(paramsCStr))
    C.RTIDDSConnector_write(unsafe.Pointer(output.connector.native), output.nameCStr, paramsCStr)
    return nil
}

I will close off the issue here and add it to the Go connector.