Hi @stefand, thanks for your answer.
So I was able to move a bit forward. Now I am able to register my query handler, and even reply to queries sent through http
POST http://localhost:8024/v2/queries?context=default
accept: application/json
Content-type: application/json
{
"id": "{{$uuid}}",
"name": "org.github.manuelarte.axongo.example.api.GetUserByIDQuery",
"numberOfResponses": 1,
"responseCardinality": "SINGLE",
"responseType": "org.github.manuelarte.axongo.example.api.UserRead",
"responseTypeEncoding": "application/json",
"payloadType": "org.github.manuelarte.axongo.example.api.GetUserByIDQuery",
"payloadContentType": "application/json",
"payload": {
"id": 1
}
}
Now my next step is trying to integrate a Spring Boot App and a Go app through AxonServer Integration, but I am having some difficulties.
If I run my spring boot app, register a query handler for my query org.github.manuelarte.axongo.example.api.GetUserByIDQuery
, and then run the following http call:
POST http://localhost:8024/v2/queries?context=default
accept: application/json
Content-type: application/json
{
"id": "{{$uuid}}",
"name": "org.github.manuelarte.axongo.example.api.GetUserByIDQuery",
"numberOfResponses": 1,
"responseCardinality": "SINGLE",
"responseType": "org.github.manuelarte.axongo.example.api.UserRead",
"responseTypeEncoding": "application/json",
"payloadType": "org.github.manuelarte.axongo.example.api.GetUserByIDQuery",
"payloadContentType": "application/json",
"payload": {
"id": 1
}
}
I get a response like the following:
{
"id": "31097894-0ed9-4d4b-83be-4794a799f313",
"metaData": {
"traceId": "0d1b0d13-467e-4a94-b4d9-6002cb2d43e0",
"correlationId": "0d1b0d13-467e-4a94-b4d9-6002cb2d43e0"
},
"payload": {
"id": 1,
"name": "John",
"surname": "Doe"
},
"payloadType": "org.github.manuelarte.axongo.example.api.UserRead",
"payloadRevision": ""
}
Which is good (special check to the field metaData
), and I get a very similar response, if instead of running my spring boot app, I run my go-app:
{
"id": "12f0fee8-5605-4b0a-965f-fc2edf0fd54e",
"metaData": {},
"payload": {
"id": 1,
"name": "John",
"surname": "Doe"
},
"payloadType": "org.github.manuelarte.axongo.example.api.UserRead",
"payloadRevision": ""
}
The metaData
field is not set.
But the problems come here, if I now run my spring-boot app with only the profile api (so the query handler is not registered), and my go-app with the query handler registered, then I get the following error in my spring-boot app when trying to do a query:
org.axonframework.axonserver.connector.query.AxonServerQueryDispatchException: CANCELLED: Not supported for integration endpoints
at org.axonframework.axonserver.connector.ErrorCode.lambda$static$17(ErrorCode.java:123) ~[axon-server-connector-4.11.2.jar:4.11.2]
at org.axonframework.axonserver.connector.ErrorCode.convert(ErrorCode.java:201) ~[axon-server-connector-4.11.2.jar:4.11.2]
at org.axonframework.axonserver.connector.ErrorCode.convert(ErrorCode.java:232) ~[axon-server-connector-4.11.2.jar:4.11.2]
at org.axonframework.axonserver.connector.ErrorCode.convert(ErrorCode.java:221) ~[axon-server-connector-4.11.2.jar:4.11.2]
at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
...
Any idea why? do you think it’s related to not having the metaData
field filled with the original request id?
And, in case it’s because of the metaData
, how can I “populate” that field? (for example, I also needed to manually populate the field payloadType
, and I did it through the header AxonIQ-PayloadType
, link)
Thanks.