pub fn create_worker_client(
channel: BoxCloneSyncChannel,
) -> Box<dyn WorkerChannel>Expand description
Creates a [WorkerServiceClient] with high default message size limits.
This is a convenience function that wraps [WorkerServiceClient::new] and configures
it with max_decoding_message_size(usize::MAX) and max_encoding_message_size(usize::MAX)
to avoid message size limitations for internal communication.
Users implementing custom [ChannelResolver]s should use this function in their
get_worker_client_for_url implementations to ensure consistent behavior with built-in
implementations.
ยงExample
struct MyResolver;
#[async_trait::async_trait]
impl ChannelResolver for MyResolver {
async fn get_worker_client_for_url(&self, url: &Url) -> Result<Box<dyn WorkerChannel>> {
let channel = Channel::from_shared(url.to_string())
.map_err(|err| DataFusionError::External(Box::new(err)))?
.connect()
.await
.map_err(|err| DataFusionError::External(Box::new(err)))?;
Ok(grpc::create_worker_client(grpc::BoxCloneSyncChannel::new(channel)))
}
}