Does it possible to subscribe the defective topic?

3 posts / 0 new
Last post
Offline
Last seen: 2 years 4 months ago
Joined: 11/01/2021
Posts: 2
Does it possible to subscribe the defective topic?

Hello,

I want to subscribe a topic like

 
<types>
  <module name="msg">
    <struct name="WarningInfo_">
      <member name="msg_one" type="int64"/>
      <member name="msg_tow" type="int64"/>
      <member name="msg_three" type="int64"/>
      <member name="msg_four" type="int64"/>
    </struct >       
  </module>
</type>

I can subscribe I can subscribe complete data that contains all members, but sometimes I need to subscribe the defect topics that missing some members. I try to use QosPolicy :

<type_consistency>
  <prevent_type_widening>false</prevent_type_widening>
  <kind>ALLOW_TYPE_COERCION</kind>
  <ignore_member_names>true</ignore_member_names>
</type_consistency>
 
But it works only when the lack member is the last one(msg_four) , if other member was missing the value will be misplaced.
For example, if the msg_two is missing
 
 <msg_one type="int64">1</msg_one>
 <msg_three type="int64">3</msg_three>
 <msg_four type="int64">4</msg_four>
 
And the subscribed data will be:
 
 <msg_one type="int64">1</msg_one>
 <msg_two type="int64">3</msg_two>
 <msg_three type="int64">4</msg_three>
 <msg_four type="int64">0</msg_four>
 
Does it possible to subscribe the defective topic?
 
Best,
  LeeLi
 
Howard's picture
Offline
Last seen: 1 day 14 hours ago
Joined: 11/29/2012
Posts: 565

You can only do this if you define your data type to be MUTABLE Extensiblity.

Please read through this documentation and look specifically at the discuss on Mutable data types:

https://community.rti.com/static/documentation/connext-dds/6.1.0/doc/manuals/connext_dds_professional/extensible_types_guide/index.htm#extensible_types/Type_Safety_and_System_Evolution.htm%3FTocPath%3D2.%2520Type%2520Safety%2520and%2520System%2520Evolution%7C_____0

https://community.rti.com/static/documentation/connext-dds/6.1.0/doc/manuals/connext_dds_professional/extensible_types_guide/index.htm#extensible_types/Defining_Extensible_Types.htm#2.1.1_@id_Annotation%3FTocPath%3D2.%2520Type%2520Safety%2520and%2520System%2520Evolution%7C2.1%2520Defining%2520Extensible%2520Types%7C_____1

You will need to define your datatype to have mutable extensibility (and likely you'll want to use @autoid(hash), in XML, this would look like:

<struct name="MyMutableType" autoid="hash" extensibility="mutable">
    <member name="x" type="long"/>
</struct>

 

 

Offline
Last seen: 2 years 4 months ago
Joined: 11/01/2021
Posts: 2

Hello Howard,

Your suggestion is very helpful to me.Thank you very much.

Best,

LeeLi