代码之家  ›  专栏  ›  技术社区  ›  Rob Bowman

BizTalk从RabbitMQ接收

  •  0
  • Rob Bowman  · 技术社区  · 7 年前

    我是RabbitMQ的新手,但我现在已经安装到Windows服务器上,并且有几个演示控制台应用程序(C#),可以很愉快地从队列中写入数据。

    以下代码用于从本地服务器上名为“RabbitPoCQueue_2”的队列中提取消息:

    string queueName = "RabbitPoCQueue_2";
    var factory = new ConnectionFactory();
    bool keepGoing = true;
    factory.HostName = "127.0.0.1";
    try
    {
        using (var connection = factory.CreateConnection())
        using (var channel = connection.CreateModel())
        {
            const bool durable = false;
            channel.QueueDeclare(queueName, durable, false, false, null);
    
            System.Console.WriteLine(" [*] Waiting for messages.");
            while (keepGoing)
            {
                var consumer = new EventingBasicConsumer(channel);
                consumer.Received += (model, ea) =>
                {
                    var body = ea.Body;
                    var message = Encoding.UTF8.GetString(body);
                    System.Console.WriteLine(" [x] Received {0}", message);
                };
                channel.BasicConsume(queue: queueName,
                                     autoAck: true,
                                     consumer: consumer);
    
                channel.BasicGet(queue: queueName, autoAck: true);
                System.Console.WriteLine("Press Y to continue or any other key to exit");
                keepGoing = System.Console.ReadKey().Key == ConsoleKey.Y;
            }
        }
    }
    

    我现在需要配置一个BizTalk(2016 FP3 CU5)接收位置来执行同样的操作。我已确保已停止控制台接收器,并且队列中有消息供BizTalk收集。

    我看了这篇文章 https://social.technet.microsoft.com/wiki/contents/articles/7401.biztalk-server-and-rabbitmq.aspx

    问题是,当我启动接收位置时,我没有收到错误,但什么也没有收到。

    WCF接收位置的配置如下所示:

    enter image description here

    在这里:

    enter image description here

    下面是来自RabbitMQ管理控制台的图片,显示了队列上的消息:

    enter image description here

    当我查看RabbitMQ日志文件时,我看到关于启动接收位置的2行。启动.Net控制台应用程序(使用RabbitMQ API)时,我看到3行,如下所示-前2行来自BizTalk,后3行来自控制台应用程序:

    2019-08-28 16:17:45.693 [info] <0.13361.2> connection <0.13361.2> ([::1]:16807 -> [::1]:5672): user 'guest' authenticated and granted access to vhost '/' ** Start of Receive location
    2019-08-28 16:19:57.958 [info] <0.13452.2> accepting AMQP connection <0.13452.2> (127.0.0.1:17173 -> 127.0.0.1:5672)
    2019-08-28 16:19:58.026 [info] <0.13452.2> connection <0.13452.2> (127.0.0.1:17173 -> 127.0.0.1:5672): user 'guest' authenticated and granted access to vhost '/' ** Receive from command line
    2019-08-28 18:56:26.267 [info] <0.13452.2> closing AMQP connection <0.13452.2> (127.0.0.1:17173 -> 127.0.0.1:5672, vhost: '/', user: 'guest')
    2019-08-28 18:56:39.815 [info] <0.17923.2> accepting AMQP connection <0.17923.2> (127.0.0.1:41103 -> 127.0.0.1:5672)
    

    有人能指出我哪里出错了吗?

    0 回复  |  直到 7 年前
    推荐文章