Dhairya-007 opened a new pull request, #30038:
URL: https://github.com/apache/camel/pull/30038
## Problem
`InfluxDb2Producer` resolves the organization and the bucket for every write
from a header, falling back to the endpoint option:
```java
private String calculateOrgName(Exchange exchange) {
String orgName = exchange.getIn().getHeader(InfluxDb2Constants.ORG,
String.class);
if (ObjectHelper.isNotEmpty(orgName)) {
return orgName;
}
return endpoint.getOrg();
}
private String calculateBucketName(Exchange exchange) {
String bucketName =
exchange.getIn().getHeader(InfluxDb2Constants.BUCKET, String.class);
if (ObjectHelper.isNotEmpty(bucketName)) {
return bucketName;
}
return endpoint.getBucket();
}
```
That is the same pattern the component uses for
`CamelInfluxDB2MeasurementName` and `CamelInfluxDB2WritePrecision`, both of
which carry `@Metadata` and so appear in the catalog and in the component's
header table.
`ORG` and `BUCKET` carried no `@Metadata`:
```java
public static final String ORG = "CamelInfluxDB2Org";
public static final String BUCKET = "CamelInfluxDB2Bucket";
```
So the two headers that let a route write to a different organization or
bucket per exchange - the only way to do it without a second endpoint, since
`org` and `bucket` are both `required = true` endpoint options - are
undiscoverable: they are missing from `influxdb2.json`, from the catalog, and
from the generated header documentation.
## Fix
Add `@Metadata` to both constants, describing each as overriding the
matching endpoint option. The regenerated `influxdb2.json` files are included.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]