Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Pub/Sub as only messaging infrastructure #3471

Closed
michelleFranke opened this issue Mar 7, 2023 · 3 comments · Fixed by #3481
Closed

Use Pub/Sub as only messaging infrastructure #3471

michelleFranke opened this issue Mar 7, 2023 · 3 comments · Fixed by #3481
Assignees
Labels
C&C Command and Control Feature Request A request for adding new functionality to Hono
Milestone

Comments

@michelleFranke
Copy link
Contributor

This issue is part of the adaption process in order to qualify Hono as a replacement for Google IoT Core customers. (see #3441, #3442)

We want to leverage Hono to natively use Google's scalable messaging infrastructure without the need of deploying Kafka or Amqp when deploying Hono to a Google Cloud Project.

In order to use the native Google Messaging Infrastructure Cloud Pub/Sub without the need to configure Kafka or Amqp, the Command Router has to be adapted to support Cloud Pub/Sub for routing the commands. The Command Router should utilize Cloud Pub/Sub for receiving the commands from the applications and forward the command to the Protocol Adapter instance that the device is connected to. Therefore there should be new implementation classes for the existing Command Router interfaces with a Pub/Sub based approach. Also the internal notification support between Hono components has to be adapted to use Cloud Pub/Sub for sending and receiving notification messages.

More detailed this means we will:

  • add a subscriber functionality with a factory like it is done for the Pub/Sub publisher

  • add a new module “notification-pubsub” which includes a Pub/Sub based implementation of clients for sending and receiving Hono’s notifications

  • add a new module “command-pubsub” which includes a Pub/Sub based implementation of the client for Hono’s Command & Control API

  • add a new implementation package “pubsub” which includes the Pub/Sub based implementation for the command-router API

Pub/Sub Messaging:

The same topic structure is created (command, command_response, command_internal, notification) as for Kafka with the Pub/Sub topic format:

  • projects/PROJECT_ID/topics/TENANT_ID.command
  • projects/PROJECT_ID/topics/TENANT_ID.command_response
  • projects/PROJECT_ID/topics/ADAPTER_INSTANCE_ID.command_internal
  • projects/PROJECT_ID/topics/registry-device.notification
  • projects/PROJECT_ID/topics/registry-tenant.notification

Also Pub/Sub needs the following subscriptions in order to subscribe to a topic:

  • projects/PROJECT_ID/subscriptions/TENANT_ID.command
  • projects/PROJECT_ID/subscriptions/ADAPTER_INSTANCE_ID.command_internal
  • projects/PROJECT_ID/subscriptions/registry-device.notification
  • projects/PROJECT_ID/subscriptions/registry-tenant.notification

The Pub/Sub command message must contain the following attributes:

deviceId: string
tenantId: string
subject: string

If a response is required, the Pub/Sub command message must also contain the following attributes:

response-required: boolean
correlation-id: string

@sophokles73 sophokles73 added C&C Command and Control Feature Request A request for adding new functionality to Hono labels Mar 8, 2023
@sophokles73
Copy link
Contributor

looks reasonable :-)
We would be happy to receive separate PRs for adding the functionality step by step, e.g. let's start with adding support for notifications via Pub/Sub ...

michelleFranke added a commit to sotec-iot/hono that referenced this issue Mar 9, 2023
This PR is a prerequisite in order to use only Pub/Sub as messaging infrastructure. As part of this architecture we added a Pub/Sub based subscriber functionality.

Added new package for the new subscriber functionality.

Used Google's Subscriber to subscribe messages from Google Pub/Sub.

Moved Pub/Sub publisher functionality to publisher package.

Added unittests.

Update documentation.

Signed-off-by: michelle <[email protected]>
michelleFranke added a commit to sotec-iot/hono that referenced this issue Mar 15, 2023
This PR is a prerequisite in order to use only Pub/Sub as messaging infrastructure. As part of this architecture we added a Pub/Sub based subscriber functionality.

Added new package for the new subscriber functionality.

Used Google's Subscriber to subscribe messages from Google Pub/Sub.

Moved Pub/Sub publisher functionality to publisher package.

Added unittests.

Update documentation.

Signed-off-by: michelle <[email protected]>
sophokles73 pushed a commit that referenced this issue Apr 3, 2023
This PR is a prerequisite in order to use only Pub/Sub as messaging infrastructure. As part of this architecture we added a Pub/Sub based subscriber functionality.

* Added new package for the new subscriber functionality.
* Used Google's Subscriber to subscribe messages from Google Pub/Sub.
* Moved Pub/Sub publisher functionality to publisher package.
* Added unit tests.
* Update documentation.

Signed-off-by: michelle <[email protected]>
michelleFranke added a commit to sotec-iot/hono that referenced this issue Apr 3, 2023
This is the second PR to use Pub/Sub as only messaging infrastructure. As part of this architecture we added a Pub/Sub based approach for the notification functionality.

- Added new module to support sending and receiving notifications with Google Pub/Sub.
- Updated documentation.
- Added unit tests.

Signed-off-by: michelle <[email protected]>
@sophokles73 sophokles73 added this to the 2.4.0 milestone Apr 6, 2023
@sophokles73 sophokles73 linked a pull request Apr 6, 2023 that will close this issue
sophokles73 pushed a commit that referenced this issue Apr 6, 2023
This is the second PR to use Pub/Sub as only messaging infrastructure. As part of this architecture we added a Pub/Sub based approach for the notification functionality.

- Added new module to support sending and receiving notifications with Google Pub/Sub.
- Updated documentation.
- Added unit tests.

Signed-off-by: michelle <[email protected]>
@michelleFranke
Copy link
Contributor Author

@sophokles73 Can we open this issue again? Since the command router functionality is missing. I will add another 2 PRs and then we can mark this as complete.

@sophokles73
Copy link
Contributor

sure, sorry for closing prematurely ...

@sophokles73 sophokles73 reopened this Apr 12, 2023
michelleFranke added a commit to sotec-iot/hono that referenced this issue Apr 12, 2023
This is another PR to use Pub/Sub as only messaging infrastructure. As part of this architecture we updated the documentation for a Pub/Sub based Command & Control API. In a second commit we will provide the new module “command-pubsub” which includes a Pub/Sub based implementation of the client for Hono’s Command & Control API.

- Updated documentation.

Signed-off-by: michelle <[email protected]>
@sophokles73 sophokles73 linked a pull request Apr 14, 2023 that will close this issue
sophokles73 pushed a commit that referenced this issue Apr 14, 2023
This is another PR to use Pub/Sub as only messaging infrastructure. As part of this architecture we updated the documentation for a Pub/Sub based Command & Control API. In a second commit we will provide the new module “command-pubsub” which includes a Pub/Sub based implementation of the client for Hono’s Command & Control API.

Signed-off-by: michelle <[email protected]>
michelleFranke added a commit to sotec-iot/hono that referenced this issue Apr 17, 2023
This is another PR to use Pub/Sub as only messaging infrastructure. As part of this architecture we added a Pub/Sub based implementation of the client for Hono's Command & Control API.

- Added new module to support a Pub/Sub based Command & Control implementation.
- Added constants for duplicate values on Kafka, AMQP and Pub/Sub implementations.
- Added Pub/Sub based admin client manager to manage topics and subscriptions.

Signed-off-by: michelle <[email protected]>
sophokles73 pushed a commit that referenced this issue Apr 28, 2023
This is another PR to use Pub/Sub as only messaging infrastructure. As part of this architecture we added a Pub/Sub based implementation of the client for Hono's Command & Control API.

- Added new module to support a Pub/Sub based Command & Control implementation.
- Added constants for duplicate values on Kafka, AMQP and Pub/Sub implementations.
- Added Pub/Sub based admin client manager to manage topics and subscriptions.

Signed-off-by: michelle <[email protected]>
michelleFranke added a commit to sotec-iot/hono that referenced this issue Apr 28, 2023
This is the last PR to use Pub/Sub as only messaging infrastructure. We added a Pub/Sub based implementation for Hono's Command Router API.

- Added new package to support a Pub/Sub based Command Router implementation.
- Integrate Command & Control implementation

Signed-off-by: michelle <[email protected]>
sophokles73 pushed a commit that referenced this issue May 2, 2023
This is the last PR to use Pub/Sub as only messaging infrastructure. We added a Pub/Sub based implementation for Hono's Command Router API.

- Added new package to support a Pub/Sub based Command Router implementation.
- Integrate Command & Control implementation

Signed-off-by: michelle <[email protected]>
Co-authored-by: Matthias Kaemmer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C&C Command and Control Feature Request A request for adding new functionality to Hono
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants