Skip to content

Consolidate redundant pub/sub examples #22

Description

@DanBondarenko

Some of the pub/sub examples within the rust_pubsub and minimal_pub_sub crates seem slightly redundant. In particular, the rust_pubsub/simple_{publisher,subscriber} and minimal_pub_sub/minimal_{publisher,subscriber} examples seem to duplicate each other. Furthermore, some may find the multiplicity of pub/sub examples confusing (see discussion on Matrix).

Therefore, I propose that the pub/sub examples be consolidated into a single crate. I'm imagining something like this:

  • Remove the rust_pubsub crate since the features it demonstrates overlap with the minimal_subscriber+minimal_publisher example in the minimal_pub_sub crate.
  • Ensure there's a separate launch file for each example in the minimal_pub_sub crate (some examples don't have a launch file).
    • I propose each of three separate examples have its own launch file: (1) minimal_subscriber+minimal_publisher, (2) zero_copy_publisher+zero_copy_subscriber, (3) minimal_two_nodes. The goal is to clarify how the examples are intended to be run, supporting the reader in understanding which files go together.
  • Optionally refactor code in the minimal_pub_sub crate so it uses the pattern of always using a struct for a node.
    • The rust_pubsub crate follows the pattern of defining a struct for each node (e.g. SimpleSubscriptionNode/SimplePublisherNode) while most examples in the minimal_pub_sub skip the struct and simply use variables inline within the main function. I'm presuming the node-struct pattern is more idiomatic since it's the one used in the documentation.
  • Optionally rename the minimal_pub_sub crate to pub_sub_demo so its naming better aligns with other crates in the repository.

I'm open to any suggestions and ideas. I'm new to the project so apologies in advance if I'm proposing anything foolish.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions