当前位置: 首页>>代码示例>>C#>>正文


C# ISession.CreateProducer方法代码示例

本文整理汇总了C#中ISession.CreateProducer方法的典型用法代码示例。如果您正苦于以下问题:C# ISession.CreateProducer方法的具体用法?C# ISession.CreateProducer怎么用?C# ISession.CreateProducer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISession的用法示例。


在下文中一共展示了ISession.CreateProducer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Publisher

 public Publisher(ISession session, string topicName)
 {
     this.session = session;
     DestinationName = topicName;
     topic = new ActiveMQTopic(DestinationName);
     Producer = session.CreateProducer(topic);
 }
开发者ID:nathard,项目名称:TruckHire,代码行数:7,代码来源:Publisher.cs

示例2: TopicPublisher

 public TopicPublisher(ISession session, string topicName)
 {
     _session = session;
     DestinationName = topicName;
     _topic = new Apache.NMS.ActiveMQ.Commands.ActiveMQTopic(DestinationName);
     Producer = session.CreateProducer(_topic);
 }
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:7,代码来源:TopicPublisher.cs

示例3: UpdateConnection

        // Verbindung zum  Messaging-Server aktualisieren
        public void UpdateConnection()
        {
            try
            {
                // eventuell früher belegte Ressourcen freigeben
                CleanupResources();

                // Verbindung / Session / MessageProducer und -Consumer instanziieren
                if (connectionFactory == null)
                {
                    Console.WriteLine(brokerURL);
                    connectionFactory = new ConnectionFactory(brokerURL);
                }
                connection = connectionFactory.CreateConnection();
                session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
                messageProducer = session.CreateProducer(new ActiveMQTopic(topicName));

                // Thread zum Empfang eingehender Nachrichten starten
                connection.Start();

                Console.WriteLine("Connection geändert, Broker-URL ist " + brokerURL);
            }
            catch (Exception e)
            {
                Console.WriteLine("*** EXCEPTION in updateConnection(): " + e.Message);
            }
        }
开发者ID:TLandmann,项目名称:Bachelor-HSRM-Medieninformatik,代码行数:28,代码来源:Producer.cs

示例4: Queue

        public Queue(MsgDeliveryMode mode = MsgDeliveryMode.NonPersistent)
        {
            Uri msgQueue = new Uri("activemq:tcp://localhost:61616");

            _factory = new ConnectionFactory(msgQueue);
            try
            {
                _connection = _factory.CreateConnection();
            }
            catch (NMSConnectionException ex)
            {
                Log.FatalException("Error connecting to MQ server", ex);
                throw;
            }
            // TODO check _connection for null
            _connection.RequestTimeout = TimeSpan.FromSeconds(60);
            Session = _connection.CreateSession();

            // TODO need to find out if queue exists.
            // It creates a new queue if it doesn't exist.
            _destination = Session.GetDestination("queue://TwitterSearchStream");
            _consumer = Session.CreateConsumer(_destination);

            _producer = Session.CreateProducer(_destination);
            _producer.RequestTimeout = TimeSpan.FromSeconds(60);
            _producer.DeliveryMode = mode;

            _connection.Start();

            _connection.ExceptionListener += _connection_ExceptionListener;
            _connection.ConnectionInterruptedListener += _connection_ConnectionInterruptedListener;
        }
开发者ID:cfmayer,项目名称:Toketee,代码行数:32,代码来源:Queue.cs

示例5: QueuePublisher

 public QueuePublisher(ISession session, string queueName)
 {
     this.session = session;
     DestinationName = queueName;
     queue = SessionUtil.GetQueue(session, DestinationName);
     Producer = session.CreateProducer(queue);
 }
开发者ID:Amphora2015,项目名称:DemoTest,代码行数:7,代码来源:QueuePublisher.cs

示例6: TopicPublisher

 public TopicPublisher(ISession session, string topicName)
 {
     this.session = session;
     DestinationName = topicName;
     topic = SessionUtil.GetTopic(session, DestinationName);
     Producer = session.CreateProducer(topic);
 }
开发者ID:Amphora2015,项目名称:DemoTest,代码行数:7,代码来源:TopicPublisher.cs

示例7: MessageTransporter

 public MessageTransporter()
 {
     _connectionFactory = new Apache.NMS.Stomp.ConnectionFactory("tcp://0.0.0.0:61613");
     _connection = _connectionFactory.CreateConnection();
     _session = _connection.CreateSession();
     _destination = SessionUtil.GetDestination(_session, "queue://testingQueue");
     _messageProducer = _session.CreateProducer(_destination);
     _messageConsumer = _session.CreateConsumer(_destination);
 }
开发者ID:ivankarpey,项目名称:qa,代码行数:9,代码来源:MessageTransporter.cs

示例8: Connect

 private void Connect()
 {
     factory = XmsUtilities.CreateConnectionFactory(destination);
     connection = factory.CreateConnection();
     connection.ExceptionListener += OnError;
     session = connection.CreateSession(transactional, AcknowledgeMode.AutoAcknowledge);
     queue = session.CreateQueue(destination.Queue);
     queue.SetIntProperty(XMSC.DELIVERY_MODE, XMSC.DELIVERY_PERSISTENT);
     producer = session.CreateProducer(queue);
 }
开发者ID:sasha-uk,项目名称:NServiceBus.Xms.2,代码行数:10,代码来源:XmsProducer.cs

示例9: UnparsedQueueManager

    public UnparsedQueueManager(SystemConfig config)
    {
        Uri connecturi = new Uri(config.ACTIVEMQ_URI);
        IConnectionFactory factory = NMSConnectionFactory.CreateConnectionFactory(connecturi);
        connection = factory.CreateConnection();
        session = connection.CreateSession();

        connection.Start();
        IDestination destination = SessionUtil.GetDestination(session, config.UNPARSED_QUEUE);
        producer = session.CreateProducer(destination);
    }
开发者ID:arunappulal,项目名称:all,代码行数:11,代码来源:unparsed_queue_manager.cs

示例10: ActiveProducer

        public ActiveProducer(IConnection amqConnection, ISession amqSession, String amqQueueName, EasyNetQ.IBus rabbitBus)
        {
            _rabbitBus = rabbitBus;

            ActiveMQQueue topic = new ActiveMQQueue(amqQueueName);
            _amqProducer = amqSession.CreateProducer(topic);
            countOfMessages = 0;
            _timProducer = new Timer(2000);
            _timProducer.Elapsed += _timProducer_Elapsed;
            _timProducer.Enabled = true;
            log.Info("Producer Connected to Queue '" + amqQueueName + "'");
        }
开发者ID:parampavar,项目名称:angtut,代码行数:12,代码来源:ActiveProducer.cs

示例11: Connect

 public void Connect()
 {
     log.Debug("New physical producer created. About to connect.");
     factory = XmsUtilities.CreateConnectionFactory(address);
     connection = factory.CreateConnection();
     connection.ExceptionListener += OnError;
     session = connection.CreateSession(transactional, AcknowledgeMode.AutoAcknowledge);
     queue = session.CreateQueue(address.Queue);
     queue.SetIntProperty(XMSC.DELIVERY_MODE, XMSC.DELIVERY_PERSISTENT);
     producer = session.CreateProducer(queue);
     connected = true;
     log.Debug("New physical producer successfully connected.");
 }
开发者ID:sasha-uk,项目名称:NServiceBus.Xms.3,代码行数:13,代码来源:XmsProducer.cs

示例12: ActiveMq

        public ActiveMq(bool durable)
        {
            _connectionFactory = new ConnectionFactory("tcp://localhost:61616");
            _connectionFactory.AsyncSend = true;
            _connectionFactory.ProducerWindowSize = int.MaxValue;
            _connection = _connectionFactory.CreateConnection();
            _connection.ClientId = "13AC0CF8-65FE-4638-8B85-62210DD89BEE";
            _connection.Start();
            _session = _connection.CreateSession();
            ActiveMQTopic topic = new ActiveMQTopic("topic");
            _consumer = _session.CreateDurableConsumer(topic, "durable", "2 > 1", false);

            _producer = _session.CreateProducer(topic);
            _producer.DeliveryMode = durable ? MsgDeliveryMode.Persistent : MsgDeliveryMode.NonPersistent;
        }
开发者ID:bling,项目名称:MessageQueuePerfTest,代码行数:15,代码来源:ActiveMq.cs

示例13: Stomp

        public Stomp(bool durable)
        {
            _connectionFactory = new ConnectionFactory("tcp://localhost:61613");
            _connection = _connectionFactory.CreateConnection();
            _connection.ClientId = "13AC0CF8-65FE-4638-8B85-62210DD89BEE";
            _connection.Start();
            _session = _connection.CreateSession();

            var topic = _session.GetQueue("exampleQueue");

            _producer = _session.CreateProducer(topic);
            _producer.DeliveryMode = durable ? MsgDeliveryMode.Persistent : MsgDeliveryMode.NonPersistent;

            _consumer = _session.CreateConsumer(topic);
        }
开发者ID:bling,项目名称:MessageQueuePerfTest,代码行数:15,代码来源:Stomp.cs

示例14: TestQueueRollbackConsumerListener

        public void TestQueueRollbackConsumerListener()
        {
            connection.Start();

            this.session = connection.CreateSession(AcknowledgementMode.Transactional);
            ITemporaryQueue queue = session.CreateTemporaryQueue();
            IMessageProducer producer = session.CreateProducer(queue);
            IMessage message = session.CreateTextMessage("Test Message");
            producer.Send(message);
            session.Commit();

            IMessageConsumer consumer = session.CreateConsumer(queue);

            consumer.Listener += new MessageListener(OnMessageListener);

            Thread.Sleep(500);

            // first try.. should get 2 since there is no delay on the
            // first redeliver..
            Assert.AreEqual(2, counter);

            Thread.Sleep(1000);

            // 2nd redeliver (redelivery after 1 sec)
            Assert.AreEqual(3, counter);

            Thread.Sleep(2000);

            // 3rd redeliver (redelivery after 2 seconds) - it should give up after
            // that
            Assert.AreEqual(4, counter);

            // create new message
            producer.Send(session.CreateTextMessage("Test Message Again"));
            session.Commit();

            Thread.Sleep(500);

            // it should be committed, so no redelivery
            Assert.AreEqual(5, counter);

            Thread.Sleep(1500);

            // no redelivery, counter should still be 5
            Assert.AreEqual(5, counter);

            session.Close();
        }
开发者ID:ThorTech,项目名称:apache-nms,代码行数:48,代码来源:MessageListenerRedeliveryTest.cs

示例15: Server

        public Server()
        {
            InitializeComponent();
            listBox1.DataSource = listener;

            //服务端
            String brokerUri = "stomp:tcp://" + host + ":" + port + "?transport.useLogging=true";
            factory = new NMSConnectionFactory(brokerUri);
            connection = factory.CreateConnection(user, password);
            connection.Start();
            session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
            consumer = session.CreateConsumer(session.GetQueue(re_destination));
            producer = session.CreateProducer();
            listener.Add("Starting up Listener.");
            listener.Add("Waiting for messages...");
            t1 = new Thread(new ThreadStart(StartListener));
        }
开发者ID:OldApple,项目名称:MQProxy,代码行数:17,代码来源:Server.cs


注:本文中的ISession.CreateProducer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。