我使用 xms.net 8.0.0.8,我想在 Web 应用程序中启动多线程 xms 侦听器。
我使用 new Thread t=new Thread()... 开始处理消息代码
但是出了点问题,线程被卡住并且没有读取消息?如果有人有 Web 应用程序的多线程 xms 示例可以分享或告诉我的错误?或者这是 xms 中多线程的任何错误?
public void ProcessMessage()
{
try
{
ConnectionFactory = WsHelper.CreateConnectionFactoryWMQ();
Connection = WsHelper.CreateConnection(ConnectionFactory);
if (QueueMessage.MessageCallType == MessageCallType.WithoutControl)
Session = WsHelper.CreateSessionWithAutoAcknowledge(Connection);
else
Session = WsHelper.CreateSessionWithSessionTransaction(Connection);
Destination = WsHelper.CreateDestination(Session, QueueMessage.QueueName);
MessageConsumer = WsHelper.CreateConsumer(Session, Destination, QueueMessage);
MessageListener messageListener = new MessageListener(NewMessageProcess);
MessageConsumer.MessageListener = messageListener;
this.Connection.Start();
while (true)
{
if (stopping)
{
MessageConsumer.Close();
return;
}
Thread.Sleep(1000);
}
}
catch(ThreadAbortException ex)
{
throw ex;
}
catch (Exception ex)
{
throw ex;
}
}
private void NewMessageProcess(IBM.XMS.IMessage msg)
{