質問

My Queue name is "TaskQueue" but when i run code, create new queue which name is "System_String:mscorlib_TaskQueue". My Subscriber code below. What is my fault?

var bus = RabbitHutch.CreateBus("host=localhost;username=guest;password=guest");
bus.SubscribeAsync<string>("TaskQueue", (msg) =>
    Task.Factory.StartNew(() =>
    {
       Console.WriteLine("Got Message: {0}", msg);
    }));
役に立ちましたか?

解決

Basically you're doing it right. However, TaskQueue is the subscription id and not the name of the queue which gets generated.

By default EasyNetQ will use the subscription id and the type of the message for generating the name of the queue. Hence, it's named System_String:mscorlib_TaskQueue So all subscriptions with the id TaskQueue will be treated as concurrent consumers.

See https://github.com/EasyNetQ/EasyNetQ/wiki/Subscribe

You could change this behavior with Taking Control Of The SubscriptionId Generation

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top