rabbitmq / rabbitmq-stream-dotnet-client

RabbitMQ client for the stream protocol
https://rabbitmq.github.io/rabbitmq-stream-dotnet-client/stable/htmlsingle/index.html
Other
122 stars 42 forks source link

Cannot create consumer in wpf app #148

Closed suprunka closed 2 years ago

suprunka commented 2 years ago

When I create consumer in WPF (.NET 6) I am not able to create consumer. Code stucks at creating consumer and cannot move further. But when I use other project also .NET 6, but service Worker, then I am able to connect and create consumer and producer. Code for configuration is the same in both projects.

var lbAddressResolver = new AddressResolver(new IPEndPoint(addresses[0], 5552)); var config = new StreamSystemConfig { UserName = "app_positionoverviewconsumer_dev", Password = "upassword", VirtualHost = "mobo", AddressResolver = lbAddressResolver, Endpoints = new List {lbAddressResolver.EndPoint }, ClientProvidedName="PositionEngineConsume-locr" }; var system = await StreamSystem.Create(config);

            const string stream = "test2";
            await system.CreateStream(new StreamSpec(stream));

            // Create a consumer 
            var consumer = await system.CreateConsumer(
                new ConsumerConfig
                {
                    Reference = Guid.NewGuid().ToString(),
                    Stream = stream,
                    OffsetSpec = new OffsetTypeTimestamp(TimeSpan.FromMinutes(35).Ticks),
                    MessageHandler = async (consumer, ctx, message) =>
                    {
                        Console.WriteLine($"message: {Encoding.Default.GetString(message.Data.Contents.ToArray())} - consumed");
                        await Task.CompletedTask;
                    }
                });

Platform: .NET 6 I am using the latest Client version: 1.0.0-rc.4 RabbitMQ:3.9.13 image

Gsantomaggio commented 2 years ago

does the consumer work without WPF? In a console application for example

Gsantomaggio commented 2 years ago

it seems to be related to this issue https://github.com/rabbitmq/rabbitmq-stream-dotnet-client/issues/147 right? HAve you solved it?

suprunka commented 2 years ago

yes, the issue #147 has been solved. Consumer works perfectly without WPF, I tested now in ConsoleApp.

suprunka commented 2 years ago

Do you have update, why it doesn't work?

lukebakken commented 2 years ago

We need a COMPLETE WPF application that we can compile and run to reproduce this issue. We don't have time to guess how to reproduce.

Please provide a git repository with code to reproduce. This is all I should have to do:

git clone https://url/repo.git
cd repo
dotnet build
dotnet run
lukebakken commented 2 years ago

Closing the issue for now, but I will re-open it if we get a means to reproduce what is reported.