Custom sensor Sensor topic does not show in gazebo harmonic

I have created a custom sensor named dummy_sensor which publish a string. Sensor is publishing data correctly when it uses in sdf file but does not create GZ->ROS Bridge when it is using in xacro file. Although sensor shows in gazebo entity tree There is no sensor topic.

<plugin filename="DummySensorSystem" name="custom::DummySensorSystem">
 </plugin>

<gazebo reference="roof_link">
    <sensor name="dummy_sensor" type="custom">
        <always_on>1</always_on>
        <update_rate>1</update_rate>
        <topic>dummy_sensor</topic>
    </sensor>
</gazebo>

Can anyone help me to figure it out the problem?

This is a question better targeted at robotics.stackexchange.com .

If you have differences between urdf and sdf behavior, use gz sdf --print to find out what’s wrong.