- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用以下代码发送消息:
var transaction = new MessageQueueTransaction())
transaction.Begin( );
var message = new Message
{
Body = myContent,
Recoverable = true
};
m_oMessageQueue.Send( message , myTransaction );
transaction.Commit( );
并使用 BeginRecieve
和 ReceiveCompleted
事件处理程序接收它。
如果我的事件处理程序在调用 EndRecieve
之前失败,消息是否应该保留在队列中并可供后续调用接收?我看到的行为是消息永远消失了。 (或者可能有一个超时时间,在该时间点之后它会再次可用?)
更新接收消息的代码如下所示。
var messageQueue = new MessageQueue( myPath );
messageQueue.ReceiveCompleted += messageQueue_ReceiveCompleted_ThrowException;
messageQueue.BeginReceive();
出于测试目的,我在 messageQueue_ReceiveCompleted_ThrowException 事件处理程序中抛出异常。
然后我用一个有效的事件处理程序重复上面的代码,但我没有被调用。
最佳答案
看起来问题在于您将 BeginReceive
与事务队列一起使用。 From MSDN :
Note Do not use the asynchronous call BeginReceive with transactions. If you want to perform a transactional asynchronous operation, call BeginPeek, and put the transaction and the (synchronous) Receive method within the event handler you create for the peek operation. Your event handler might contain functionality as shown in the following C# code.
对于这样的失败,我认为消息通常会进入死信队列或产生否定确认,具体取决于您如何配置 MessageQueue
(这可以解释为什么您看不到它们) .你可以read more about those options here .
关于c# - 如果我的函数在处理时失败,System.MessageQueue (MSMQ) 消息是否会丢失?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1405855/
我在其他帖子上看到过这个错误,但不是针对这种情况。 我有两个类使用 MessageQueue 做同样的事情。因此,我将队列的创建和处理抽象为一个辅助类。我遇到了这个错误,而且我看不出如何多次处理队列。
我还有两个问题。1. 如何将消息队列名称作为命令行参数传递?例如我写道: char src[50] , dest[50]; strcpy(src , "/"); strcpy(dest , argv[
据我了解,如果 MessageQueue 中只有带有 future 时间戳的消息,则 MessageQueue 会阻塞 Looper 的循环直到那个时间到来。但如果 MessageQueue 完全为空
我一直在浏览有关消息队列的文档,但似乎找不到我正在寻找的信息。我想要完成的任务是在每次调用 MySQL 数据库过程时记录该过程的名称,以便跟踪每个过程的调用频率。我的想法是在调用时将名称记录到 Mes
我一直在查看处理来自 MSMQ 的消息的服务的示例代码。在代码中,在 ReceiveCompletedEventHandler 的开头立即调用 EndReceive() 方法,然后它开始实际处理消息的
我只想在异步方法中接收我的消息!它卡住了我的用户界面 public async void ProcessMessages() { MessageQueue MyMess
我目前有一个后台线程。在这个线程中是一个无限循环。 这个循环偶尔更新数据库中的一些值,然后在 MessageQueue 上监听 1 秒(使用 queue.Receive(TimeSpan.FromSe
我用 C# 编写的应用程序使用 .NET 中的 MessageQueue 类与另一个远程应用程序进行消息通信,MessageQueue 应始终与远程 messageQueue 在所有情况下“连接”(存
我想先将一个类添加到 MessageQueue 的 MessageContent,然后再将其添加到 QueueStorage。 示例 class udpates { public int us
我正在调试 Android 框架,Handler 处理消息的速度很慢,所以我也许应该检查 Handler 的 MessageQueue 以查看消息是否具有低优先级或队列太长。 我查看了 Handler
我在使用基本的 Microsoft Message Queue 实现时遇到以下问题: 在读取端,消息的 Formatter 属性始终为 null,无论我在发送端输入什么。 发送代码: System.M
我发布这个问题是因为我想知道我对基础知识的想法是否正确。 应该清楚的是,UI-Thread 包含一个 MessageQueue,它与一个 Looper 相关联,以从队列中获取消息/可运行对象以进行处理
我已取消选择在专用队列上发送消息的权限,但 MessageQueue.CanWrite 从未返回 false。我可以切换接收消息权限,并且 CanRead 属性会按预期响应。为什么 CanWrite
我想在 MSMQ 消息队列上使用 Linq。据我所知,我需要将消息队列转换为 IEnumerable Howerver var queryableQ = new MessageQueue(myQueu
我正在使用 PeekCompleted 从 MessageQueue 中读取消息,我在这里执行我的过程,如果一切正常,我需要将其从队列中删除!目前我正在使用 MyMessageQueue.Receiv
我使用以下代码发送消息: var transaction = new MessageQueueTransaction()) transaction.Begin( ); var message = n
这个问题在这里已经有了答案: 关闭 13 年前。 Possible Duplicate: Java and MSMQ 我有一个由另一个组编写的 windows/C# 进程,它将 xml 格式的消息泵
我正在使用 Philip Semanchunk 的 posix_ipc python 模块从 posix 消息队列中读取数据。我编写的 C++ 程序使用包含数据的结构填充队列。我的 python 程序
我目前遇到丢失消息的问题。此错误很少发生,但经常发生,足以令人厌烦。以下是问题的背景: 我已经在 goldmine_service_queue 上打开了消息日志,它是 Windows 2003 服务器
我如何判断一个远程消息队列exists ?文档指出“存在”方法不适用于远程机器。 以下无效(我知道队列路径是准确的,因为我能够将消息发送到队列): if (!MessageQueue.Exists(@
我是一名优秀的程序员,十分优秀!