dotnetcore / CAP

Distributed transaction solution in micro-service base on eventually consistency, also an eventbus with Outbox pattern
http://cap.dotnetcore.xyz
MIT License
6.68k stars 1.28k forks source link

Unavailability of flexible group (queue) names #1482

Closed DuleDimitrov123 closed 9 months ago

DuleDimitrov123 commented 9 months ago

Hi, I am trying to create some flexible queue names in RabbitMQ since I am using it with CAP library. I would like to have queue name like: "test".

As I can see, CAP is creating queue name with the Group from [CapSubscribe] attribute and adds version.

If I set [CapSubscribe("someEvent", Group = "test")], I will get queue: test.v1.

Additionaly, if I set version to string.Empty with the following code when registering CAP, I will get: "test." (with "." after test).

  services.AddCap(options =>
  {
      options.Version = string.Empty;

      options.UseEntityFramework<DbContext>();

      options.UseRabbitMQ(options =>
      {
          ...
      });
  });

Could I somehow set queue name in RabbitMQ to "test" and use it like that?

Thanks!

yang-xiaodong commented 9 months ago

Hi, You can override this method SetSubscribeAttribute

https://github.com/dotnetcore/CAP/blob/e3cffd1e668aff48715a9c34ce147dbf213c3880/src/DotNetCore.CAP/Internal/IConsumerServiceSelector.Default.cs#L169

DuleDimitrov123 commented 9 months ago

Thanks @yang-xiaodong. Closing the issue!