Skip to main content

create_worker_client

Function create_worker_client 

Source
pub fn create_worker_client(
    channel: BoxCloneSyncChannel,
) -> WorkerServiceClient<BoxCloneSyncChannel>
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 ChannelResolvers should use this function in their get_worker_client_for_url implementations to ensure consistent behavior with built-in implementations.

§Example

use datafusion_distributed::{create_worker_client, BoxCloneSyncChannel, ChannelResolver};
/// use tonic::transport::Channel;

#[async_trait]
impl ChannelResolver for MyResolver {
    async fn get_worker_client_for_url(
        &self,
        url: &Url,
    ) -> Result<WorkerServiceClient<BoxCloneSyncChannel>, DataFusionError> {
        let channel = Channel::from_shared(url.to_string())?.connect().await?;
        Ok(create_worker_client(BoxCloneSyncChannel::new(channel)))
    }
}