> I was not exactly suggesting to have AsyncAuthenticationProvider
> extend the current interface :)

Thank you for clarifying. :) You mentioned a bridging class in the
community meeting yesterday, but I misunderstood its implementation.

Your AsyncAuthBridge implementation makes sense to me. The main
modification I'll make is that we'll use an authenticate method instead of
a canPublish method.

Thanks,
Michael

On Fri, Sep 3, 2021 at 2:04 PM Matteo Merli <matteo.me...@gmail.com> wrote:

> On Fri, Sep 3, 2021 at 11:51 AM Michael Marshall <mikemars...@gmail.com>
> wrote:
> > The new interface would be called AsyncAuthenticationProvider, and it
> would
> > extend the existing AuthenticationProvider interface. It would have one
> > additional method "authenticateAsync" and it would be up to the
> > implementation to make sure that there is no blocking on the netty thread
> > pool.
>
> I was not exactly suggesting to have AsyncAuthenticationProvider
> extend the current interface :)
>
> The callers should be always using the async interface, so we don't
> need to have the sync methods in the new interface.
>
> Instead we'd have 2 interface and bridging class that would look like:
>
> class AsyncAuthBridge implements AsyncAuthenticationProvider {
>       AuthenticationProvider delegate;
>       Executor e;
>
>      CompletableFuture<Boolean> canPublishAsync(String topic,
> AuthenticationDataSource s) {
>          CompletableFuture<Boolean> f = new CompletableFuture<>();
>          e.execute(() -> {
>                f.complete(delegate.canPublish(topic, s));
>          }
>          return f;
>     }
> }
>

Reply via email to