MSMQ - Cannot receive from Multicast queues

后端 未结 2 389
醉酒成梦
醉酒成梦 2021-01-02 19:05

I am trying to get my head around how multicasting works in MSMQ but I cannot receive messages at all, even from the same machine. I\'m obviously doing something wrong but c

2条回答
  •  梦毁少年i
    2021-01-02 19:36

    I solved same my problem by other way:

    1. Create private queue with multicast address.
    2. Create queue in producer by next

      const string QUEUE_PATH = @"formatname:MULTICAST=234.1.1.1:8001"

      MessageQueue mq = new MessageQueue(QUEUE_PATH)

    3. Create consumer queue next (each consumer has different name!):

    consumer1:

    const string QUEUE_PATH = @".\Private$\MSMQ-Task3-Consumer-1";

    MessageQueue mq = !MessageQueue.Exists(QUEUE_PATH) ? MessageQueue.Create(QUEUE_PATH) : new MessageQueue(QUEUE_PATH);

    mq.MulticastAddress = "234.1.1.1:8001";

    consumer2:

    const string QUEUE_PATH = @".\Private$\MSMQ-Task3-Consumer-2";

    MessageQueue mq = !MessageQueue.Exists(QUEUE_PATH) ? MessageQueue.Create(QUEUE_PATH) : new MessageQueue(QUEUE_PATH);

    mq.MulticastAddress = "234.1.1.1:8001";

    Sources can be found here: https://github.com/constructor-igor/TechSugar/tree/master/MessageQueue

    Short Settings explanation can be found: https://github.com/constructor-igor/TechSugar/wiki/MessageQueue

提交回复
热议问题