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

Add service subscription configuration #90

Open
1 of 4 tasks
brothercorvo opened this issue Oct 1, 2024 · 2 comments
Open
1 of 4 tasks

Add service subscription configuration #90

brothercorvo opened this issue Oct 1, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@brothercorvo
Copy link
Contributor

brothercorvo commented Oct 1, 2024

Description

Currently, a digitalpy_service is hardcoded to subscribe to two topics,

  1. the command topic which allows the service manager to send command
  2. the response topic which is the generic topic to which the integration manager publishes all responses.

This approach is problematic for two reasons:

  1. Overhead and inefficiency: All services receive all responses, leading to unnecessary processing and potential performance degradation.
  2. Complexity in integration manager: The logic in the integration manager to decide whether to publish a response or not becomes overly complex and difficult to maintain.

Solutions

To address these issues, I propose modifying the service configuration to include a list of specific topics to which the service should subscribe. This allows for more granular control and avoids the unnecessary overhead of receiving all responses. An example service configuration might look like this:

[dp_helloworld.simple_tcp]
__class = digitalpy.core.service_management.domain.model.service_configuration.ServiceConfiguration
status = STOPPED
name = SimpleTCPService
port = 8443
host = 0.0.0.0
protocol = TCPNetwork
flows = [Flow1, Flow2, Flow3] # this is the new attribute

Each flow is assumed to end with a standard "done" topic, which is dynamically subscribed to by the service. For example:

[Flow1]
?Flow1?Push
Subject?Flow1?DoWork
??Done # this is the generic final topic

[Flow2]
?Flow2?Push
Subject?Flow2?DoDifferentWork
??Done

Benefits

  • Improved performance: Services will only receive the responses they are interested in, reducing unnecessary message processing.
  • Simpler logic in the integration manager: By having services subscribe only to specific topics, the logic in the integration manager becomes simpler and more maintainable.
  • Easier scalability: Adding new flows or services becomes easier, as topics can be added dynamically in the configuration without needing to modify the core service or integration manager logic.

Tasks

Once this is done this feature can be marked complete

@brothercorvo brothercorvo added the enhancement New feature or request label Oct 1, 2024
@brothercorvo
Copy link
Contributor Author

each service MUST be able to:

  • subscribe and subscribe to ANY topic
  • retrieve a list of subscribed topics

while this list can be initially part of the service configuration, when the service is installed it should be moved to a DB

if the name of the flow is equal to the name of the topic a service can simply react to action 'done', in alternative the topic name should be added to the key

@naman108
Copy link
Contributor

naman108 commented Oct 13, 2024

Ok the best way I can think to solve this is by a bit of a complex topic implementation. In essence it will follow the sequence:

  1. Receive request in API Service
  2. Send request to subject
  3. Send request from subject to integration manager
  4. Send request from integration manager to service management core service
  5. Send command from service management core service to digitalpy service with a config in the format COMMAND_<service_id>_<command>, the service will be subscribed to the topic COMMAND_<service_id>
  6. The service will process the command and if there is a response it will send the response with the same config name, the same id and the action done to the integration manager.
  7. The integration manager will publish the response to the service management core service
  8. The service management core service will send this response to the command response handler
  9. Command response handler will push the response with the same action to the integration manager
  10. The integration manager will publish the response
  11. The API Service will send the response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants