opal icon indicating copy to clipboard operation
opal copied to clipboard

OPAL server does not replicate DataUpdate events correctly when multiple topics are included

Open asafc opened this issue 1 year ago • 0 comments

Issue seems to be with this line of code:

https://github.com/permitio/opal/blob/d9a91ae2f1e0b3be0e138eb73f1de6f3f2d9ae90/packages/opal-server/opal_server/data/data_update_publisher.py#L89

we should create a reduced update message to each topic, so that we can utilize pub sub routing correctly.

Discussed in https://github.com/permitio/opal/discussions/270

Originally posted by h9ing July 13, 2022 HI, I want to know more about entry topic.

OPAL server OPAL_DATA_CONFIG_SOURCES was setting like this: {"config": {"entries": [{"url": "http://10.31.98.154:8080/v1/opal/policyData1", "topics": ["policy_data_1"]}, {"url": "http://10.31.98.154:8080/v1/opal/policyData2", "topics": ["policy_data_2"]}]}}

OPAL client OPAL_DATA_TOPICS was setting like this: policy_data_1

OPAL server log: image

OPAL client log: image

notify to OPAL server topic update request image

I gave OPAL server a update request, and put topic "policy_data_1" & "policy_data_2" to difference entry. I expected to see OPAL client which subscribed topic "policy_data_1" would only fetch topic "policy_data_1" data, but it got both "policy_data_1" and "policy_data_2" data.

question:

  1. When OPAL client start and get config, it will fetch all data in entries, but will not subscribe the topic which in entries. Just like this answer, right?

  2. Why OPAL client only subscribed topic "policy_data_1" data, but it still received topic "policy_data_2" update notification and got topic "policy_data_2" data? So if I want to notify 2 client which subscribe difference topic, I can't put 2 topic update info in the same request?

Thank you!

asafc avatar Jul 14 '22 05:07 asafc