mkristofik commented on issue #33839:
URL: https://github.com/apache/arrow/issues/33839#issuecomment-1402056272
Here's the workaround I'm using, which seems to do what I want thus far.
Could someone confirm whether this is a valid approach?
```java
private static class HeaderMiddleware implements FlightClientMiddleware {
private final Map<String, String> headers;
private HeaderMiddleware(Map<String, String> headers) {
this.headers = headers;
}
@Override
public void onBeforeSendingHeaders(CallHeaders outgoingHeaders) {
for (Map.Entry<String, String> kv : headers.entrySet()) {
outgoingHeaders.insert(kv.getKey(), kv.getValue());
}
}
@Override public void onHeadersReceived(CallHeaders headers) { }
@Override public void onCallCompleted(CallStatus status) { }
static class Factory implements FlightClientMiddleware.Factory {
Map<String, String> headers;
Factory(Map<String, String> headers) {
this.headers = headers;
}
@Override
public FlightClientMiddleware onCallStarted(CallInfo info) {
return new HeaderMiddleware(headers);
}
}
}
```
And then the construction of the client...
```java
BufferAllocator alloc = /* ... */
Location loc = /* ... */
Map<String, String> headers = /* ... */
FlightClient client = FlightClient.builder(alloc, loc)
.intercept(new HeaderMiddleware.Factory(headers))
.build();
```
--
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]