コード例 #1
0
        public void CorrelationId_Test()
        {
            var doc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
                                    new XElement("mess", new XElement("messtype", "OPUstart"), new XElement("starttype", "2")));

            var message = new TextMessage();

            message.WriteXml(doc, Encoding.UTF8);

            string correlationID;

            using (var adapter = new MqSeriesQueueMessageAdapter(_configuration))
            {
                adapter.Connect();
                correlationID = adapter.Send(message)
                                .CorrelationId;
                adapter.Disconnect();
            }

            using (var adapter = new MqSeriesQueueMessageAdapter(_configuration))
            {
                adapter.Connect();
                try
                {
                    adapter.Receive(correlationID);
                }
                catch (MessagingException ex)
                {
                    Logger.LogError(ex, string.Empty);
                }
                finally
                {
                    adapter.Disconnect();
                }
            }
        }
コード例 #2
0
 public void MQSeriesMessageAdapter_ConnectDisconnect()
 {
     using var adapter = new MqSeriesQueueMessageAdapter(_configuration);
     adapter.Connect();
     adapter.Disconnect();
 }