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

feat: switch ContractNegotiation to connector client #123

Merged

Conversation

janpmeyer
Copy link
Contributor

What this PR changes/adds

Swith to use contract Negotiation Service.

Why it does that

refactoring

Linked Issue(s)

Closes #54

@janpmeyer janpmeyer self-assigned this Oct 20, 2023
@janpmeyer janpmeyer added the enhancement New feature or request label Oct 20, 2023
@janpmeyer
Copy link
Contributor Author

janpmeyer commented Oct 20, 2023

@ndr-brt I run into a problem what i dont understand.

If i start the ContractNegotiation on a buttonClick this message is sent to the Consumer Connector.

image

The Provider Connector gets an Error on Transforming the ContractRequestMessage:

java.lang.NullPointerException: Asset id must not be null
2023-10-20T06:13:48.449237191Z 	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
2023-10-20T06:13:48.449243202Z 	at org.eclipse.edc.connector.contract.spi.types.offer.ContractOffer$Builder.build(ContractOffer.java:106)
2023-10-20T06:13:48.449245027Z 	at org.eclipse.edc.protocol.dsp.negotiation.transform.to.JsonObjectToContractRequestMessageTransformer.transform(JsonObjectToContractRequestMessageTransformer.java:85)
2023-10-20T06:13:48.449246577Z 	at org.eclipse.edc.protocol.dsp.negotiation.transform.to.JsonObjectToContractRequestMessageTransformer.transform(JsonObjectToContractRequestMessageTransformer.java:37)
2023-10-20T06:13:48.449247984Z 	at org.eclipse.edc.core.transform.TransformerContextImpl.transform(TransformerContextImpl.java:60)
2023-10-20T06:13:48.449249400Z 	at org.eclipse.edc.core.transform.TypeTransformerRegistryImpl.transform(TypeTransformerRegistryImpl.java:55)
2023-10-20T06:13:48.449250806Z 	at org.eclipse.edc.protocol.dsp.negotiation.api.controller.DspNegotiationApiController.handleMessage(DspNegotiationApiController.java:307)
2023-10-20T06:13:48.449252216Z 	at org.eclipse.edc.protocol.dsp.negotiation.api.controller.DspNegotiationApiController.initiateNegotiation(DspNegotiationApiController.java:132)
2023-10-20T06:13:48.449253602Z 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2023-10-20T06:13:48.449255040Z 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2023-10-20T06:13:48.449264079Z 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2023-10-20T06:13:48.449265684Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2023-10-20T06:13:48.449267069Z 	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
2023-10-20T06:13:48.449268531Z 	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:134)
2023-10-20T06:13:48.449269894Z 	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:177)
2023-10-20T06:13:48.449271266Z 	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
2023-10-20T06:13:48.449274223Z 	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:81)
2023-10-20T06:13:48.449275767Z 	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478)
2023-10-20T06:13:48.449277186Z 	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400)
2023-10-20T06:13:48.449278600Z 	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
2023-10-20T06:13:48.449280043Z 	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:261)
2023-10-20T06:13:48.449281414Z 	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
2023-10-20T06:13:48.449282719Z 	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
2023-10-20T06:13:48.449284007Z 	at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
2023-10-20T06:13:48.449285410Z 	at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
2023-10-20T06:13:48.449287624Z 	at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
2023-10-20T06:13:48.449289927Z 	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
2023-10-20T06:13:48.449292267Z 	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:240)
2023-10-20T06:13:48.449295137Z 	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:697)
2023-10-20T06:13:48.449296842Z 	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
2023-10-20T06:13:48.449298184Z 	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
2023-10-20T06:13:48.449299478Z 	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:357)
2023-10-20T06:13:48.449300788Z 	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:311)
2023-10-20T06:13:48.449302190Z 	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
2023-10-20T06:13:48.449305606Z 	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
2023-10-20T06:13:48.449307067Z 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:529)
2023-10-20T06:13:48.449309065Z 	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
2023-10-20T06:13:48.449311382Z 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
2023-10-20T06:13:48.449313998Z 	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
2023-10-20T06:13:48.449315412Z 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
2023-10-20T06:13:48.449316729Z 	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
2023-10-20T06:13:48.449318558Z 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
2023-10-20T06:13:48.449319993Z 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
2023-10-20T06:13:48.449321408Z 	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192)
2023-10-20T06:13:48.449322825Z 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
2023-10-20T06:13:48.449324171Z 	at org.eclipse.jetty.server.Server.handle(Server.java:563)
2023-10-20T06:13:48.449325479Z 	at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
2023-10-20T06:13:48.449326785Z 	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
2023-10-20T06:13:48.449328077Z 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
2023-10-20T06:13:48.449329477Z 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
2023-10-20T06:13:48.449330859Z 	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
2023-10-20T06:13:48.449332271Z 	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
2023-10-20T06:13:48.449333627Z 	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
2023-10-20T06:13:48.449334988Z 	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
2023-10-20T06:13:48.449336336Z 	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
2023-10-20T06:13:48.449337696Z 	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
2023-10-20T06:13:48.449339066Z 	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)
2023-10-20T06:13:48.449340512Z 	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
2023-10-20T06:13:48.449341946Z 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
2023-10-20T06:13:48.449344998Z 	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
2023-10-20T06:13:48.449346457Z 	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
2023-10-20T06:13:48.449347858Z 	at java.base/java.lang.Thread.run(Thread.java:833)

I think the asset Id should be set. But it seems like it doesn't.

Mabey you see the problem? I will take a closer look again later this day.

@ndr-brt
Copy link
Member

ndr-brt commented Oct 20, 2023

@janpmeyer in fact that field is not used in that juncture (there's a PR that will address this: eclipse-edc/Connector#3549), the assetId for starting the negotiation is coming out of the policy target field, but that cannot be accepted because the odrl context is not specified, just add the "@context": "http://www.w3.org/ns/odrl.jsonld" attribute in the policy object and everything should work correctly

@janpmeyer janpmeyer requested a review from ndr-brt October 20, 2023 09:20
@janpmeyer janpmeyer marked this pull request as ready for review October 20, 2023 09:20
@janpmeyer
Copy link
Contributor Author

Thanks for the suggestion.

Added the context to the policy. Seems working now.

@ndr-brt ndr-brt merged commit 198e9a2 into eclipse-edc:main Oct 20, 2023
3 checks passed
farhin23 pushed a commit to FraunhoferISST/edc-dashboard that referenced this pull request Mar 5, 2024
* feat(api-management): switch to use contractNegotiation service (eclipse-edc#56)

* feat: remove old Policy model and use correct one (eclipse-edc#56)
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

Successfully merging this pull request may close these issues.

connector client: switch ContractAgreementService
2 participants