Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ibm mq IBM XMS Websphere MQ多线程_Ibm Mq_Xms - Fatal编程技术网

Ibm mq IBM XMS Websphere MQ多线程

Ibm mq IBM XMS Websphere MQ多线程,ibm-mq,xms,Ibm Mq,Xms,我使用xms.net 8.0.0.8,我想在web应用程序中启动多线程xms侦听器 我使用新线程t=new Thread()启动processmessage代码 但出现了一些问题,线程被卡住,无法读取消息?如果有人有多线程xms web应用程序示例,可以共享或告诉我的错误?或者这是xms中多线程的错误吗 public void ProcessMessage() { try { ConnectionFactory = WsHelpe

我使用xms.net 8.0.0.8,我想在web应用程序中启动多线程xms侦听器

我使用新线程t=new Thread()启动processmessage代码

但出现了一些问题,线程被卡住,无法读取消息?如果有人有多线程xms web应用程序示例,可以共享或告诉我的错误?或者这是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)
    {

这些看起来都不对。多线程需要深入的编程知识。你的起点在哪里?确保每个线程都在执行自己与队列管理器的连接。另外,您是为所有线程定义1个MessageListener,还是每个线程都有自己的MessageListener?因为看起来所有线程都使用了1,这会破坏多线程

您是否阅读了MessageListener上的MQ知识中心以及如何处理mutlit线程: