-
Notifications
You must be signed in to change notification settings - Fork 230
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
[API]: Endpoint for retrieving all policies #1698
Conversation
Signed-off-by: Altair-Bueno <[email protected]>
Signed-off-by: Altair-Bueno <[email protected]>
*/ | ||
@Immutable | ||
@JsonParsableCommand(typePrefix = ThingSearchCommand.TYPE_PREFIX, name = QueryPolicies.NAME) | ||
public final class QueryPolicies extends AbstractCommand<QueryPolicies> implements ThingSearchQueryCommand<QueryPolicies> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be wise to use an abstract class to avoid code duplication, but:
- I'm not sure what level of abstraction you are aiming for
- Not even sure if it makes sense, just doing some rough changes until I learn the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say to wait for abstracting it before it really provides a benefit, e.g. in reacting to the command in a similar way when applying the things/policies query.
Signed-off-by: Altair-Bueno <[email protected]>
Signed-off-by: Altair-Bueno <[email protected]>
Hey @thjaeckle . I've been struggling to comprehend the control flow of the
However, I'm curious as I don't understand the reasoning behind this approach. It appears quite complex and involves multiple messages between distributed services. Have you considered the possibility of using a more straightforward approach? On paper, a database query seems to be more performant and resource-efficient, as it would only require one microservice and the optimised database (in the end, Mongo is designed for high performance reads). PS: This comment really help me out to finally gasp where things came from Line 105 in 58ce86b
|
@Altair-Bueno this approach is basically done in order to not transfer 200 search results in a single message across the cluster (with a max. thing size of 100 KiB this would be a 20 MiB message). The solution to still be able to retrieve (max page size) 200 results in a single page at the search API is to
So yes, it is complex - but it is required to not exceed messaging limits. |
Thanks for your response Thomas. I do understand now the motivation behind performing multiple asks to the things service instead a single big one. However, that doesn't explain why asking each actor was chosen over a database query from the gateway component itself. The only reason I can think of is to avoid stale data to be served (e.g. a thing with changes that hasn't been persisted yet), but IMHO that seems acceptable given the drawbacks of the current approach: increased pressure on Akka, latency and software complexity. If one would like a more precise representation of the actual twin, a Please keep in mind that I have little experience with Akka/actors and this might be common practice in actor systems. It just doesn't click with me to rely so heavily on actors when other approaches exists, specially when we are already relying on the database for the ID query. |
As I wrote:
The search index does not necessarily have all of the information which the thing contains - its purpose is "only" to return with a list of matching IDs to a query. As things and policies apply the event sourcing pattern (e.g. in order to provide history and audit log capabilities), we cannot "simply" query their database from the gateway (as the actual state would have to be constructed based on persisted events) - which you should not do anyways in service oriented architectures - to use the database of another service without the other service being aware. This is not going to change or be simplified as I don't see how this can work otherwise. |
@Altair-Bueno this is no longer in work, or is it? |
Hi Thomas. Indeed, we are no longer working on this. I've recently been reassigned, and unfortunately, this feature development slipped through the cracks. I apologize for any inconvenience this may have caused. |
@Altair-Bueno ok, no problem - thanks for letting us know 👍 |
See #1683