apache / apache/camel-kafka-connector-examples

FHIR Source Connector config fails ro resolve endpoint

Open
#335 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
69
Forks
42
PR merge metrics
No merged PRs in 30d

Description

I want to add a source connector for polling Bundles from a FHIR API. 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-fhir-api-com/fhir",
"camel.source.endpoint.delay": 60000,
"camel.source.endpoint.password": "password",
"camel.source.endpoint.username": "user",
"camel.component.fhir.fhirVersion": "R4"
}
}
```

(This results in the error message listed at the end.)

The `$customOperation` returns a Collection Bundle.
Manually I am able to query this bundle by doing a POST on:
`https://url-of-fhir-api-com/fhir/$customOperation`
with a request body:

```xml




```

1. 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?

2. And another question is, if the endpoint URL is correct? Because it seems the connector constructs the URL like:
`https://url-of-fhir-api-com/fhir/operation/$customOperation`
instead of
`https://url-of-fhir-api-com/fhir/$customOperation`
Is this also a problem?

3. Also, the log does not show the full URL it is accessing. Does it ignore the `serverUrl` property?

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied CamelFhirSourceConnector JSON and the endpoint-resolution stack trace. Inspect how the connector maps camel.source.path and camel.source.endpoint properties, then reproduce the generated fhir://operation/$customOperation endpoint. Done means the configuration behavior for the operation URL and request body is established and documented or corrected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.