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-unsubscr...@camel.apache.org

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


Reply via email to