我正在尝试使用EasyNetQ连接到RabbitMQ.RabbitMQ在远程VM上.
_rabbitBus = RabbitHutch.CreateBus(
string.Format("host={0};virtualhost={1}",
_hostSettings.Host, _hostSettings.VHost),
x => x.Register<IEasyNetQLogger>(l => _logger));
_rabbitBus.Subscribe<Message>(_topic, ReceiveMessage, m => m.WithTopic(_topic));
Run Code Online (Sandbox Code Playgroud)
我得到一个TimeoutException The operation requested on PersistentChannel timed out..远程VM正在回复ping,端口5672和15672打开(使用nmap检查).可以从我的主机访问RabbitMQ管理.
另外,如果RabbitMQ在我的本地机器上运行,它可以正常工作.我尝试从局域网中的其他PC连接到我的计算机上安装的RabbitMQ,它也可以工作.
我假设它与虚拟机上的事实有关,也许连接有问题.但同样,Rabbit的网络管理工作正常.
也在EasyNetQ Test应用程序上测试 - 适用于localhost,但不适用于远程.
输出如下:
DEBUG: Trying to connect
ERROR: Failed to connect to Broker: '192.168.0.13', Port: 5672 VHost: '/'.
ExceptionMessage: 'None of the specified endpoints were reachable'
ERROR: Failed to connected to any Broker. Retrying in 5000 ms
Run Code Online (Sandbox Code Playgroud)
我有这段代码:
WebBrowser wb = new WebBrowser();
wb.Navigate(URL);
HtmlDocument doc = wb.Document;
Run Code Online (Sandbox Code Playgroud)
我应该提一下,我在表单上没有WebBrowser控件,它只是我班上的方法.在此之后,wb.Document和doc也是空的.这是为什么?我该怎么做才能获得这份文件?
我有一个由多个块组成的数据流管道。当元素流经我的处理管道时,我想按 field 对它们进行分组A。为此,我有一个BatchBlock高BoundedCapacity. 我在其中存储我的元素,直到我决定应该释放它们。所以我调用TriggerBatch()方法。
private void Forward(TStronglyTyped data)
{
if (ShouldCreateNewGroup(data))
{
GroupingBlock.TriggerBatch();
}
GroupingBlock.SendAsync(data).Wait(SendTimeout);
}
Run Code Online (Sandbox Code Playgroud)
这就是它的样子。问题是,生成的批次有时包含下一个发布的元素,该元素不应该在那里。
为了显示:
BatchBlock.InputQueue = {A,A,A}
NextElement = B //we should trigger a Batch!
BatchBlock.TriggerBatch()
BatchBlock.SendAsync(B);
Run Code Online (Sandbox Code Playgroud)
在这一点上,我希望我的批次是{A,A,A},但它是{A,A,A,B}
LikeTriggerBatch()是异步的,SendAsync实际上是在实际批处理之前执行的。
我该如何解决这个问题?我显然不想放在Task.Wait(x)那里(我尝试过,它有效,但当然性能很差)。