我目前遇到丢失消息的问题.这个错误很少发生,但经常发生,这很烦人.以下是该问题的背景:
超时和消息接收是否可能同时发生?有没有更好的方法来处理服务停止检查以帮助避免此错误?
private void workerFunction()
{
logger.Info("Connecting to queue: " + Settings.Default.goldmine_service_queue);
MessageQueue q = new MessageQueue(Settings.Default.goldmine_service_queue);
q.Formatter = new ActiveXMessageFormatter();
while (serviceStarted)
{
Message currentMessage = null;
try
{
currentMessage = q.Peek(new TimeSpan(0,0,30));
}
catch (System.Messaging.MessageQueueException mqEx)
{
if (mqEx.ToString().Contains("Timeout for the requested operation has expired"))
{
logger.Info("Check for service stop request");
}
else
{
logger.Error("Exception while peeking into MSMQ: " + mqEx.ToString());
}
}
catch (Exception e)
{
logger.Error("Exception while …Run Code Online (Sandbox Code Playgroud) 我的团队更了解BDD.
是否有使用行为驱动开发(BDD)的开源.NET/Java项目?
我想把注意力集中在静态语言示例上.
我在库中创建了一个小的C#类.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace helloWorldLib
{
public class Greeter
{
public string SayHelloWorld(string name)
{
return "Hello world " + name;
}
}
}
Run Code Online (Sandbox Code Playgroud)
图书馆位于
C:\ Documents and Settings\myUser\My Documents\Visual Studio 2008\Projects\Project1\helloWorldLib\bin\Debug\helloWorldLib.dll
你会如何从IronRuby脚本中调用SayHelloWorld?
我知道这看起来很简单,但经过大量研究后我似乎无法找到一致的代码示例.
非常感谢!