• 大小: 0.23M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-23
  • 语言: 其他
  • 标签: 其他  

资源简介

NMSPublishSubscribe.zip

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Apache.NMS;
using Apache.NMS.ActiveMQ;

namespace Publish
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create the Connection Factory
            IConnectionFactory factory = new ConnectionFactory(“tcp://localhost:61616/“);
            using (IConnection connection = factory.CreateConnection())
            {
                //Create the Session
                using (ISession session = connection.CreateSession())
                {
                    //Create the Producer for the topic/queue
                    IMessageProducer prod = session.CreateProducer(
                        new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic(“testing“));

                    //Send Messages
                    int i = 0;
                    while (!Console.KeyAvailable)
                    {
                        ITextMessage msg = prod.CreateTextMessage();
                        msg.Text = i.ToString();
                        Console.WriteLine(“Sending: “ + msg.Text);
                        prod.Send(msg true 1 TimeSpan.MinValue);

                        System.Threading.Thread.Sleep(250);
                        i++;
                    }
                }
            }

            Console.ReadLine();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2009-05-29 22:14  NMSPublishSubscribe\
     文件        1392  2009-05-29 22:17  NMSPublishSubscribe\NMSPublishSubscribe.sln
     文件       22528  2009-06-01 11:07  NMSPublishSubscribe\NMSPublishSubscribe.suo
     目录           0  2009-05-31 08:44  NMSPublishSubscribe\Publish\
     目录           0  2009-05-29 22:14  NMSPublishSubscribe\Publish\bin\
     目录           0  2009-05-29 22:25  NMSPublishSubscribe\Publish\bin\Debug\
     文件      258048  2009-04-16 16:26  NMSPublishSubscribe\Publish\bin\Debug\Apache.NMS.ActiveMQ.dll
     文件       85008  2009-04-16 16:26  NMSPublishSubscribe\Publish\bin\Debug\Apache.NMS.ActiveMQ.xml
     文件       40960  2009-04-16 16:25  NMSPublishSubscribe\Publish\bin\Debug\Apache.NMS.dll
     文件        5632  2009-05-31 09:41  NMSPublishSubscribe\Publish\bin\Debug\Publish.exe
     文件       13824  2009-05-31 09:41  NMSPublishSubscribe\Publish\bin\Debug\Publish.pdb
     文件       14328  2009-05-31 09:51  NMSPublishSubscribe\Publish\bin\Debug\Publish.vshost.exe
     文件         490  2007-07-21 02:33  NMSPublishSubscribe\Publish\bin\Debug\Publish.vshost.exe.manifest
     文件        1419  2009-05-31 08:44  NMSPublishSubscribe\Publish\Program.cs
     目录           0  2009-05-29 22:14  NMSPublishSubscribe\Publish\Properties\
     文件        1436  2009-05-29 22:14  NMSPublishSubscribe\Publish\Properties\AssemblyInfo.cs
     文件        3001  2009-05-29 22:17  NMSPublishSubscribe\Publish\Publish.csproj
     目录           0  2009-05-29 22:42  NMSPublishSubscribe\Subscribe\
     目录           0  2009-05-29 22:14  NMSPublishSubscribe\Subscribe\bin\
     目录           0  2009-05-29 22:25  NMSPublishSubscribe\Subscribe\bin\Debug\
     文件      258048  2009-04-16 16:26  NMSPublishSubscribe\Subscribe\bin\Debug\Apache.NMS.ActiveMQ.dll
     文件       85008  2009-04-16 16:26  NMSPublishSubscribe\Subscribe\bin\Debug\Apache.NMS.ActiveMQ.xml
     文件       40960  2009-04-16 16:25  NMSPublishSubscribe\Subscribe\bin\Debug\Apache.NMS.dll
     文件        5632  2009-05-29 22:42  NMSPublishSubscribe\Subscribe\bin\Debug\Subscribe.exe
     文件       13824  2009-05-29 22:42  NMSPublishSubscribe\Subscribe\bin\Debug\Subscribe.pdb
     文件       14328  2009-06-01 09:42  NMSPublishSubscribe\Subscribe\bin\Debug\Subscribe.vshost.exe
     文件         490  2007-07-21 02:33  NMSPublishSubscribe\Subscribe\bin\Debug\Subscribe.vshost.exe.manifest
     文件        1296  2009-05-29 22:42  NMSPublishSubscribe\Subscribe\Program.cs
     目录           0  2009-05-29 22:14  NMSPublishSubscribe\Subscribe\Properties\
     文件        1440  2009-05-29 22:14  NMSPublishSubscribe\Subscribe\Properties\AssemblyInfo.cs
     文件        3005  2009-05-29 22:17  NMSPublishSubscribe\Subscribe\Subscribe.csproj
............此处省略0个文件信息

评论

共有 条评论