You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/03/18 13:20:40 UTC

[GitHub] [camel-kafka-connector-examples] makampf opened a new issue #335: FHIR Source Connector config fails ro resolve endpoint

makampf opened a new issue #335:
URL: https://github.com/apache/camel-kafka-connector-examples/issues/335


   I want to add a source connector for a FHIR server. Therefore I put together the following config:
   
   ```json
   {
     "name": "my-fhir-source-connector",
     "config": {
         "connector.class": "org.apache.camel.kafkaconnector.fhir.CamelFhirSourceConnector",
         "tasks.max": 1,
         "topic": "fhir.input",
         "camel.source.path.apiName": "OPERATION",
         "camel.source.path.methodName": "$customOperation",
         "camel.source.endpoint.serverUrl": "https://url-of-server-com/fhir",
         "camel.source.endpoint.delay": 60000,
         "camel.source.endpoint.password": "password",
         "camel.source.endpoint.username": "user",
         "camel.component.fhir.fhirVersion": "R4"
     }
   }
   ```
   
   The $customOperation returns a Collection Bundle.
   Manually I am able to query this bundle by doing a POST on:
   `https://url-of-server-com/fhir/$customOperation`
   with a request body:
   
   ```xml
   <Parameters xmlns="http://hl7.org/fhir">
       <parameter>
           <name value="domain" />
           <valueString value="customDomain" />
       </parameter>
   </Parameters>
   ```
   
   But I see no possibility to add a request body to the connector config. I played around with `camel.source.endpoint.inBody` but cannot get any result. How can I add parameters/body?
   
   And another question is, if the endpoint URL is correctly. Because it seems the connector constructs the URL like:
   `https://url-of-server-com/fhir/operation/$customOperation`
   instead of
   `https://url-of-server-com/fhir/$customOperation`
   Is this also a problem?
   
   The error log:
   
   ```sh
   org.apache.kafka.connect.errors.ConnectException: Failed to create and start Camel context
   	at org.apache.camel.kafkaconnector.CamelSourceTask.start(CamelSourceTask.java:175)
   	at org.apache.kafka.connect.runtime.WorkerSourceTask.initializeAndStart(WorkerSourceTask.java:225)
   	at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:186)
   	at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:243)
   	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
   	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   	at java.base/java.lang.Thread.run(Thread.java:829)
   Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[From[fhir:operation/$customOperation?dela... because of Failed to resolve endpoint: fhir://operation/$customOperation?delay=60000&password=xxxxxx due to: No matching method for operation/$customOperation, with arguments []
   	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:80)
   	at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
   	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:826)
   	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:716)
   	at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2757)
   	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
   	at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2475)
   	at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
   	at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2494)
   	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:245)
   	at org.apache.camel.main.SimpleMain.doStart(SimpleMain.java:43)
   	at org.apache.camel.support.service.BaseService.start(BaseService.java:119)
   	at org.apache.camel.kafkaconnector.CamelSourceTask.start(CamelSourceTask.java:172)
   	... 8 more
   Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: fhir://operation/$customOperation?delay=60000&password=xxxxxx due to: No matching method for operation/$customOperation, with arguments []
   	at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:962)
   	at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:844)
   	at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:58)
   	at org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:177)
   	at org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:94)
   	at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:74)
   	... 20 more
   Caused by: java.lang.IllegalArgumentException: No matching method for operation/$customOperation, with arguments []
   	at org.apache.camel.support.component.AbstractApiEndpoint.initState(AbstractApiEndpoint.java:172)
   	at org.apache.camel.support.component.AbstractApiEndpoint.configureProperties(AbstractApiEndpoint.java:134)
   	at org.apache.camel.support.DefaultComponent.setProperties(DefaultComponent.java:425)
   	at org.apache.camel.support.component.AbstractApiComponent.createEndpoint(AbstractApiComponent.java:90)
   	at org.apache.camel.support.DefaultComponent.createEndpoint(DefaultComponent.java:171)
   	at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:928)
   	... 25 more
   ```
   
   Thanks in advance for any help or hints


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-kafka-connector-examples] oscerd commented on issue #335: FHIR Source Connector config fails ro resolve endpoint

Posted by GitBox <gi...@apache.org>.
oscerd commented on issue #335:
URL: https://github.com/apache/camel-kafka-connector-examples/issues/335#issuecomment-1072414706


   https://camel.apache.org/components/3.11.x/fhir-component.html#_api_operation
   
   Those are the supported method for the operation API.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-kafka-connector-examples] oscerd commented on issue #335: FHIR Source Connector config fails ro resolve endpoint

Posted by GitBox <gi...@apache.org>.
oscerd commented on issue #335:
URL: https://github.com/apache/camel-kafka-connector-examples/issues/335#issuecomment-1072414706


   https://camel.apache.org/components/3.11.x/fhir-component.html#_api_operation
   
   Those are the supported method for the operation API.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-kafka-connector-examples] makampf commented on issue #335: FHIR Source Connector config fails ro resolve endpoint

Posted by GitBox <gi...@apache.org>.
makampf commented on issue #335:
URL: https://github.com/apache/camel-kafka-connector-examples/issues/335#issuecomment-1072571987


   Thank you very much, that pointed me in the right direction. I have to learn more about REST and Operation syntax.
   
   With the following connector config:
   ```json
   {
     "name": "my-fhir-source-connector",
     "config": {
       "connector.class": "org.apache.camel.kafkaconnector.fhir.CamelFhirSourceConnector",
       "tasks.max": 1,
       "topic": "fhir.input",
       "camel.source.path.apiName": "OPERATION",
       "camel.source.path.methodName": "onServer?name=$customOperation&useHttpGet=false&extraParameters=domain=testDomain",
       "camel.source.endpoint.serverUrl": "https://url-of-fhir-api-com/fhir",
       "camel.source.endpoint.delay": 60000,
       "camel.source.endpoint.password": "password",
       "camel.source.endpoint.username": "user",
       "camel.component.fhir.fhirVersion": "R4"
     }
   }
   ```
   
   I receive the following error:
   ```sh
   Caused by: [org.apache.camel.RuntimeCamelException - Error invoking onServer with {name=$customOperation, useHttpGet=false, extraParameters={}}: theParameters can not be null] (org.apache.camel.component.fhir.FhirConsumer)
   
   org.apache.camel.RuntimeCamelException: Error invoking onServer with {name=$customOperation, useHttpGet=false, extraParameters={}}: theParameters can not be null
   
   at org.apache.camel.support.component.ApiMethodHelper.invokeMethod(ApiMethodHelper.java:530)
   ```
   
   I tried different variants to pass the required `domain` paramater, e.g. with `parameters` instead of `extraParameters`, or different kinds of brackets, but it doesnt help. Maybe you can help me on how to pass the domain parameter correctly? (_domain=testDomain_)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-kafka-connector-examples] makampf edited a comment on issue #335: FHIR Source Connector config fails ro resolve endpoint

Posted by GitBox <gi...@apache.org>.
makampf edited a comment on issue #335:
URL: https://github.com/apache/camel-kafka-connector-examples/issues/335#issuecomment-1072571987


   Thank you very much, that pointed me in the right direction. I have to learn more about REST and Operation syntax.
   
   With the following connector config:
   ```json
   {
     "name": "my-fhir-source-connector",
     "config": {
       "connector.class": "org.apache.camel.kafkaconnector.fhir.CamelFhirSourceConnector",
       "tasks.max": 1,
       "topic": "fhir.input",
       "camel.source.path.apiName": "OPERATION",
       "camel.source.path.methodName": "onServer?name=$customOperation&useHttpGet=false&extraParameters=domain=testDomain",
       "camel.source.endpoint.serverUrl": "https://url-of-fhir-api-com/fhir",
       "camel.source.endpoint.delay": 60000,
       "camel.source.endpoint.password": "password",
       "camel.source.endpoint.username": "user",
       "camel.component.fhir.fhirVersion": "R4"
     }
   }
   ```
   
   I receive the following error:
   ```sh
   Caused by: [org.apache.camel.RuntimeCamelException - Error invoking onServer with {name=$customOperation, useHttpGet=false, extraParameters={}}: theParameters can not be null] (org.apache.camel.component.fhir.FhirConsumer)
   
   org.apache.camel.RuntimeCamelException: Error invoking onServer with {name=$customOperation, useHttpGet=false, extraParameters={}}: theParameters can not be null
   
   at org.apache.camel.support.component.ApiMethodHelper.invokeMethod(ApiMethodHelper.java:530)
   ```
   
   I tried different variants to pass the required `domain` paramater, e.g. with `parameters` instead of `extraParameters`, or different kinds of brackets, but it doesnt help. Maybe you can help me on how to pass the domain parameter correctly? (_domain=testDomain_)
   
   Thanks in advance


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org