标签: msmq

无法向MSMQ发送2个DNS名称

我们遇到了将MSMQ消息发送到服务器上的第二个DNS名称的问题.如果我们为同一台服务器发送IP,我们很好,但那不是我们在架构上的地方.关于为什么MSMQ会关心它收到的名字的任何想法?

服务器信息:

物理服务器load-int-01具有与之关联的第二个IP和DNS名称.

  • 第一个IP/DNS:load-int-01用IP10.0.10.10
  • 第二个IP/DNS:load-intv带IP10.0.10.20

使用的队列路径格式:

  • FormatName:DIRECT=OS:load-int-01\private$\MyQueue →工作正常
  • FormatName:DIRECT=OS:load-intv\private$\MyQueue →返回错误...

    队列不存在或您没有足够的权限来执行此操作

我们也尝试使用IP地址,两组IP都可以正常工作.

  • FormatName:DIRECT=TCP:10.0.10.10\private$\MyQueue →工作正常
  • FormatName:DIRECT=TCP:10.0.10.20\private$\MyQueue →工作正常

dns msmq

10
推荐指数
1
解决办法
2796
查看次数

不使用MSMQ的NServiceBus的替代方案

我认为标题总结了......我们有一个.NET 2.0系统试图实现分布式发布/订阅模型.我遇到了NServiceBus,RhinoBus和MassTransit.不幸的是,这些是基于MSMQ的.我的任务是找出使用不同消息替代方案的pub/sub替代方案......

寻求MSMQ替代方案的唯一原因是克服消息大小限制.由于每条消息限制,我们的企业应用消息可能会被截断...

任何指导都非常感谢

.net architecture msmq servicebus

10
推荐指数
2
解决办法
9701
查看次数

MSMQ - 队列进程重启/服务器重启后队列是否存在

MSMQ排队的消息能否在服务/服务器重启后继续存在?我的意思是,如果一个队列有消息并且服务器要经历硬重启,那么重启后消息是否仍然可以在队列中使用?

.net c# distributed msmq

10
推荐指数
1
解决办法
4903
查看次数

枚举MSMQ中的所有传出队列,C#

使用C#和.NET 3.5,如何获取MSMQ中所有传出队列的列表?我找到了关于它的这篇文章,但正如你在下面看到的那样,我没有COM条目Microsoft Message Queue 3.0 Object Library...

我不小心搞了Microsoft Message Queue 3.0对象库

那么如何才能获得当前的传出队列列表?我认为必须有一种方法,因为我可以看到它们Computer Management......

计算机管理+ MSMQ

我能做什么?

c# msmq

10
推荐指数
1
解决办法
3024
查看次数

具有不同消息类型的消息队列

我正在调查Microsoft Message Queues以进行进程间跨网络消息传递.但是,当我收到一个消息,我不知道先验什么对象我得到的类型,所以代码

queue.Formatter = new XmlMessageFormatter(new Type[] { typeof(Wibble) });
Run Code Online (Sandbox Code Playgroud)

收到消息之前无法应用,因为我不知道它是否是一个Wibble.那么我如何收到不同的消息类型?

c# msmq

10
推荐指数
2
解决办法
7228
查看次数

在Windows服务中托管的MSMQ支持的WCF服务在启动时失败

我在Windows服务中托管了一个WCF服务,我将其设置为"自动",因此它将在服务器启动时自动启动.服务端点是MSMQ支持的.

当我手动启动服务时,一切都很好.但是当服务在启动时启动时,我得到一个MSMQ异常:

System.TypeInitializationException: The type initializer for
'System.ServiceModel.Channels.Msmq' threw an exception. ---> 
System.ServiceModel.MsmqException: The version check failed with the error: 
'The Message Queuing service is not available (-1072824309, 0xc00e000b)'. The 
 version of MSMQ cannot be detected All operations that are on the queued channel
 will fail. Ensure that MSMQ is installed and is available.
   at System.ServiceModel.Channels.MsmqQueue.GetMsmqInformation
                   (Version& version, Boolean& activeDirectoryEnabled)
   at System.ServiceModel.Channels.Msmq..cctor()
   --- End of inner exception stack trace ---
Run Code Online (Sandbox Code Playgroud)

看起来MSMQ还没有准备好在服务开始之前使用......有解决方案吗?

wcf windows-services msmq startup

9
推荐指数
1
解决办法
4563
查看次数

MSMQ队列大小是否有限制?

我知道消息的大小限制(4MB),但队列大小是否有限制?最佳练习限制可能吗?

size queue msmq limit

9
推荐指数
1
解决办法
2万
查看次数

MSMQ发送消息到远程队列

我正在尝试将消息发送到远程队列.我的进程没有失败,但我仍然没有看到远程队列上的消息?如果它无法处理消息,我会认为它会失败?

我注意到在我的本地计算机上远程队列列在Outgoing队列中,但是也没有看到消息.这里非常无知,所有的例子都表明我正在做的事情(或者我认为)是正确的.

代码(简单测试):

    using (var transaction = new TransactionScope())
    {
        using (var queue = new MessageQueue(@"FormatName:DIRECT=OS:mymachine\MyQueueQueue"))
        {
            XDocument xdoc = XDocument.Parse("<root/>");

                 var message = new Message(xdoc.ToString());
                queue.Send(message, MessageQueueTransactionType.Single);
        }

        transaction.Complete();
    }

    Console.Read();
}
Run Code Online (Sandbox Code Playgroud)

我做错了什么?奇怪......没有错误,但在任何地方都看不到消息.写入工作到我的本地队列.

c# msmq

9
推荐指数
1
解决办法
2万
查看次数

重新启动消息队列服务后,服务不接收消息

我们有一个服务从n个消息队列接收消息.但是,如果重新启动消息队列服务,即使消息队列服务已成功重新启动,消息检索服务也会停止接收消息.

我试图专门捕获消息检索服务中抛出的MessageQueueException并再次调用队列的BeginReceive方法.但是,在消息队列服务重新启动的2秒左右,我得到大约1875个异常实例,然后当我们的StartListening方法中抛出另一个MessageQueueException时,服务停止运行.

有没有一种优雅的方法从消息队列服务重新启动恢复?

    private void OnReceiveCompleted(object sender, ReceiveCompletedEventArgs e)
    {
        MessageQueue queue = (MessageQueue)sender;

        try
        {
            Message message = queue.EndReceive(e.AsyncResult);

            this.StartListening(queue);

            if (this.MessageReceived != null)
                this.MessageReceived(this, new MessageReceivedEventArgs(message));
        }
        catch (MessageQueueException)
        {
            LogUtility.LogError(String.Format(CultureInfo.InvariantCulture, StringResource.LogMessage_QueueManager_MessageQueueException, queue.MachineName, queue.QueueName, queue.Path));
            this.StartListening(queue);
        }            
    }

    public void StartListening(MessageQueue queue)
    {
        queue.BeginReceive();
    }
Run Code Online (Sandbox Code Playgroud)

我需要处理这个导致的无限循环问题并清理一下但是你明白了.

发生MessageQueueException时,调用RecoverQueue方法.

    private void RecoverQueue(MessageQueue queue)
    {            
        string queuePath      = queue.Path;
        bool   queueRecovered = false;

        while (!queueRecovered)
        {
            try
            {
                this.StopListening(queue);
                queue.Close();
                queue.Dispose();

                Thread.Sleep(2000);

                MessageQueue newQueue = this.CreateQueue(queuePath);

                newQueue.ReceiveCompleted += new ReceiveCompletedEventHandler(this.OnReceiveCompleted);

                this.StartListening(newQueue); …
Run Code Online (Sandbox Code Playgroud)

c# msmq

9
推荐指数
1
解决办法
2976
查看次数

Python通过win32com运行MessageQueue.Peek,如何正确设置超时时间?

首先,我想说如果有人可以在这里提供帮助,您真是不可思议。

一般问题

我的Python程序需要与MSMQ进行交互。基本上,我想窥视一个队列,如果队列中没有任何内容,则指定一个超时。

但是,尽管我已尽力而为,但当队列中先前没有任何值时,我无法让Peek()等待超时间隔。 您能否指出此代码中缺少的内容?


我当前的代码

现在是我的代码:

from socket import gethostname

import win32com.client
import pythoncom

import clr
clr.AddReference("System")
clr.AddReference("System.Messaging")
from System import TimeSpan
from System.Messaging import MessageQueue


# Source: [1]
# [1] https://docs.microsoft.com/en-us/previous-versions/windows/desktop/msmq/ms707027%28v%3dvs.85%29
MQ_DENY_NONE = 0x0
MQ_PEEK_ACCESS = 0x1
MQ_SEND_ACCESS = 0x2


# Set up queue
pythoncom.CoInitialize()
qinfo = win32com.client.Dispatch("MSMQ.MSMQQueueInfo")
qinfo.FormatName = f"direct=os:{gethostname()}\\PRIVATE$\\MyQueue"
queue = qinfo.Open(MQ_PEEK_ACCESS, MQ_DENY_NONE)

# Receive a value
timeout_sec = 1.0
timespan = TimeSpan.FromSeconds(timeout_sec)
label, body = "", ""
# TODO: timeout value does not appear working. …
Run Code Online (Sandbox Code Playgroud)

python msmq msmq-wcf win32com pythoncom

9
推荐指数
1
解决办法
98
查看次数