Replies: 2 comments
-
Hi, my suggestion would be to take a look at the brand new |
Beta Was this translation helpful? Give feedback.
-
Hi,
In my previous post i forgot to show the policy I was using, which is this one:
With this changes i was able to enable the policy evaluation when a consumer connector try to request the catalog. In any case, thank you for the policy example you added. Really appreciated. Regards. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
i am currently working with the transfer-02-consumer-pull example you provided and i was able to run this transfer example. My idea was then to extends this example by adding a custom policy by defining a policy evaluation function and then binding it to the policy engine following the instructions provided in tutorial
I couldn't get my policy evaluation function to work but before explaining how i implemented it i wanted to ask first if in the example i was using the policy evaluation is implemented or not.
I am asking that because i also tried to specify a policy just to test the policy mechnanism.
This is the policy i added:
The policy was added correctly (i just called the api ..management/v2/policydefinitions/aPolicy which was returning the policy I specifid so I supposed that the policy was added correctly)
Befrore adding this policy I followed all the previous steps specified in the transfer-02-consumer-pull, I mean I started the two connetors (provider and consumer) i registered the data-plane, added an asset and then I specified the policy I attached above.
After that I create a contract definition for that policy.
A this point, since it is not described anywere I was supposing that the policy I specified was applied to ALL_SCOPES, so I was expecting to see some sort of error in the log already when requesting the catalog, form the consumer connector, considering that no absoluteSpatialPosition is specified in the connector configuration, but nothing happend. I was able to go on by negotiating the contract, getting the aggrement id and at the end I was able to retrieve the asset.
As mentioned above I added an extension on the transfer-00-prerequisites folder to define my custom policy evaluator.
First i implemented my custom service extension this way:
then i defined the custom AtomicConstraintFunction this way:
Then i specified my extension within a file resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension
After re-building the example and running the connector.jar, I noticed on the log these lines:
According to the log i realized that my extension was at least loaded correctly after running the connector. As you can see from the code a posted above, I registered my AtomicConstraintFunction by assenging to it a CATALOGING_SCOPE. I was expecting my policy to be evaluated when a catalog was requesting by a consumer connector. As you can see from the code I also tried to register the function also by assenging ALL_SCOPES.
Anyway in both the cases my policy was not evaluated either in the catalog request or in the other steps because i never noticed the log i added in the evaluate function (CUSTOM POLICY EVALUATION FUNCTION EXECUTED!!) to be printed on the console.
I am wandering what i am missing or doing wrong.
My question are then:
Thanks in advance for the answer.
Beta Was this translation helpful? Give feedback.
All reactions