Hi Hequn

Yes, the TableFactoryService has a proper method. As I
use StreamTableDescriptor to connect to Kafka, StreamTableDescriptor
actually uses ConnectTableDescriptor which calls TableFactoryUtil to do
service load, and TableFactoryUtil does not use a user defined classloader,
so I can not use `TableFactoryService.find(StreamTableSourceFactory.class,
streamTableDescriptor, classloader)` in StreamTableDescriptor directly.

One solution for me is:
1.add method to TableFactoryUtil to use user defined classloader.
2.add method to ConnectTableDescriptor accordingly.
3.add method to StreamTableDescriptor accordingly.

But I wonder if there is a current solution to register TableSource from
StreamTableDescriptor using user defined classloader.

Your sincerely
Joshua

On Tue, Jan 15, 2019 at 8:26 PM Hequn Cheng <chenghe...@gmail.com> wrote:

> Hi Joshua,
>
> Could you use `TableFactoryService` directly to register TableSource? The
> code looks like:
>
> final TableSource<?> tableSource =
>> TableFactoryService.find(StreamTableSourceFactory.class,
>> streamTableDescriptor, classloader)
>> .createStreamTableSource(propertiesMap);
>> tableEnv.registerTableSource(name, tableSource);
>
>
> Best, Hequn
>
> On Tue, Jan 15, 2019 at 6:43 PM Joshua Fan <joshuafat...@gmail.com> wrote:
>
>> Hi
>>
>> As known, TableFactoryService has many methods to find a suitable service
>> to load. Some of them use a user defined classloader, the others just uses
>> the default classloader.
>>
>> Now I use ConnectTableDescriptor to registerTableSource in the
>> environment, which uses TableFactoryUtil to load service, but
>> TableFactoryUtil just use the default classloader, it is not enough in my
>> case. Because the user may use kafka 0.8 or 0.9, the jars can not be put
>> together in the lib directory.
>>
>> Is there a proper way to use ConnectTableDescriptor to
>> registerTableSource at a user defined classloader?
>>
>> I know SQL Client has their now implementation to avoid
>> use TableFactoryUtil, but I think TableFactoryUtil itself should also
>> provide a method to use user defined classloader.
>>
>> Yours sincerely
>> Joshhua
>>
>

Reply via email to