Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async support on IMessageTypeResolver #305

Closed
gsferreira opened this issue Sep 15, 2022 · 3 comments
Closed

Async support on IMessageTypeResolver #305

gsferreira opened this issue Sep 15, 2022 · 3 comments
Labels
breaking change refactoring Something needs to be refactored
Milestone

Comments

@gsferreira
Copy link
Contributor

Review interface and implementation to use Async/Await.

From

    public interface IMessageTypeResolver
    {
        Type OnConsume(IMessageContext context);

        void OnProduce(IMessageContext context);
    }

To

    public interface IMessageTypeResolver
    {
        Task<Type> OnConsumeAsync(IMessageContext context);

        Task OnProduceAsync(IMessageContext context);
    }
@gsferreira gsferreira added refactoring Something needs to be refactored breaking change labels Sep 15, 2022
@gsferreira gsferreira added this to the v3.0.0 milestone Sep 15, 2022
@mhkolk
Copy link

mhkolk commented Apr 8, 2023

How did this change already make in into master (release)? I'm having issues with this.

The overload

.AddSerializer(
                    resolver => new JsonMessageSerializer(...),
                    resolver => new YourTypeResolver(...))

no longer works.

I downloaded the source, referenced it in my app and debug.

Seems to me the execution never progresses from this this piece of code

        public static IConsumerMiddlewareConfigurationBuilder AddSerializer<TSerializer, TResolver>(
            this IConsumerMiddlewareConfigurationBuilder middlewares,
            Factory<TSerializer> serializerFactory,
            Factory<TResolver> resolverFactory)
            where TSerializer : class, ISerializer
            where TResolver : class, IMessageTypeResolver
        {
            return middlewares.Add(
                resolver => new SerializerConsumerMiddleware(
                    serializerFactory(resolver),
                    resolverFactory(resolver)));
        }

The new SerializerConsumerMiddleware() constructor never gets called.

UPDATE: Had to revert to 2.2.13 to get custom type resolver working.

@mhkolk mhkolk mentioned this issue Apr 8, 2023
4 tasks
@massada
Copy link
Contributor

massada commented Apr 8, 2023

@mhkolk the constructor not being called indicates that the issue is with the middleware not being called. We have no indication of custom resolvers not working with the changes. Both kinds are used throughout the code, integration tests are passing and we have no issues in production.

Can you please provide a repo or snippet with the issue so that we can try to reproduce?

@mhkolk
Copy link

mhkolk commented Apr 11, 2023

This is really weird. I couldnt get the custom type resolver to work with 2.2.15 last week. Spent a day debugging that's why I reverted to 2.2.13. Today I updated again to 2.2.15 and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change refactoring Something needs to be refactored
Development

No branches or pull requests

4 participants