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


C# IMessageConsumer类代码示例

本文整理汇总了C#中IMessageConsumer的典型用法代码示例。如果您正苦于以下问题:C# IMessageConsumer类的具体用法?C# IMessageConsumer怎么用?C# IMessageConsumer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: AddMessageConsumer

 /// <summary>
 /// Add a message consumer to monitor for messages received
 /// </summary>
 public void AddMessageConsumer(IMessageConsumer consumer)
 {
     consumer.Listener += (m) =>
     {
         _lastMsgRecd = DateTime.UtcNow;
     };
 }
开发者ID:blueghostuk,项目名称:trainnotifier-server,代码行数:10,代码来源:NMSConnectionMonitor.cs

示例2: MessageHandler

        public MessageHandler(IMessageConsumer consumer, MessagingClient.EventDelegate callback)
        {
            this.consumer = consumer;
            this.callback = callback;

            AddListener();
        }
开发者ID:martinjuhasz,项目名称:Softwaretechnik,代码行数:7,代码来源:MessageHandler.cs

示例3: Subscribe

 public void Subscribe(IMessageConsumer consumer)
 {
     if (_consumers.Contains(consumer))
     {
         return;
     }
     _consumers.Add(consumer);
 }
开发者ID:Irdis,项目名称:VSTalk,代码行数:8,代码来源:MessageFeed.cs

示例4: NMSConsumer

        public NMSConsumer(IMessageConsumer consumer, String clientId, String subscriptionId)
        {
            this.consumer = consumer;
            this.clientId = clientId;
            this.subscriptionId = subscriptionId;

            consumer.Listener += onMessage;
        }
开发者ID:apakian,项目名称:fluorinefx,代码行数:8,代码来源:NMSConsumer.cs

示例5: Unsubscribe

 public void Unsubscribe(IMessageConsumer consumer)
 {
     if (!_consumers.Contains(consumer))
     {
         return;
     }
     _consumers.Remove(consumer);
 }
开发者ID:Irdis,项目名称:VSTalk,代码行数:8,代码来源:MessageFeed.cs

示例6: Consumer

 public Consumer(IMessageConsumer messageConsumer, string clientId, string topicName)
 {
     _consumer = messageConsumer;
     _clientId = clientId;
     _topicName = topicName;
     _consumer.Listener += Update;
     _running = true;
     Delays = new List<TimeSpan>();
 }
开发者ID:chillitom,项目名称:NmsFailoverTest,代码行数:9,代码来源:Consumer.cs

示例7: RegisterImpl

        public void RegisterImpl(IMessageConsumer impl, string serviceId)
        {
            var rule = MetaData.GetServiceRoutingRule(serviceId);
            if (rule == null)
            {
                throw new Exception();
            }

            implements[rule.GateRule.GetServiceId()] = impl;
        }
开发者ID:fingerpasswang,项目名称:Phial,代码行数:10,代码来源:GateAdaptor.cs

示例8: RegisterDelegate

        public void RegisterDelegate(IMessageConsumer consumer, string serviceId)
        {
            var rule = MetaData.GetServiceRoutingRule(serviceId);
            if (rule == null)
            {
                throw new Exception();
            }

            delegates[rule.GateRule.GetServiceId()] = consumer;
        }
开发者ID:fingerpasswang,项目名称:Phial,代码行数:10,代码来源:GateAdaptor.cs

示例9: FudgeDecodeMessage

 public IMessage FudgeDecodeMessage(ISession session, IMessageConsumer consumer, IMessage message)
 {
     try
     {
         return new ActiveMQObjectMessage { Body = DecodeObject(GetMessage(message)) };
     }
     catch (Exception e)
     {
         return new ActiveMQObjectMessage { Body = e };
     }
 }
开发者ID:BietteMaxime,项目名称:OG-DotNet,代码行数:11,代码来源:FudgeMessageDecoder.cs

示例10: DistributableCommandBus

 public DistributableCommandBus(ICommandHandlerProvider handlerProvider,
     ILinearCommandManager linearCommandManager,
     IMessageConsumer commandConsumer,
     string receiveEndPoint,
     bool inProc)
     : base(handlerProvider, linearCommandManager, receiveEndPoint, inProc)
 {
     _commandConsumer = commandConsumer as IInProcMessageConsumer;
     _commandDistributor = _commandConsumer;
     _isDistributor = _commandDistributor is IMessageDistributor;
 }
开发者ID:vebin,项目名称:IFramework,代码行数:11,代码来源:DistributableCommandBus.cs

示例11: btnSubscribe_Click

        private void btnSubscribe_Click(object sender, EventArgs e)
        {
            try
            {
                if (!GlobalFunction.CheckControlInput(txtTopicName, "Topic Name", 0, false)) return;

                if (m_consumer != null)
                {
                    m_consumer.Close();
                }
                if (txtSelector.Text != "")
                {
                    m_consumer = m_mq.CreateConsumer(rdTopic.Checked, txtTopicName.Text, txtSelector.Text);
                }
                else
                {
                    m_consumer = m_mq.CreateConsumer(rdTopic.Checked, txtTopicName.Text);
                }

                m_consumer.Listener += new MessageListener(consumer_listener);
            }
            catch (System.Exception ex)
            {
                GlobalFunction.MsgBoxException(ex.Message, "btnSubscribe_Click");
            }
        }
开发者ID:ideayapai,项目名称:docviewer,代码行数:26,代码来源:Form1.cs

示例12: OpenWireConsumer

        /// <summary>
        /// 消息消费构造器
        /// </summary>
        /// <param name="brokerUri">地址</param>
        /// <param name="username">用户名</param>
        /// <param name="psw">密码</param>
        /// <param name="clientId">客户端标识 兼做队列接收目的地</param>
        /// <param name="isClient">true 客户端;false 服务端</param>
        public OpenWireConsumer(string brokerUri, string username, string psw, string clientId,bool isClient)
        {
            NMSConnectionFactory _factory = new NMSConnectionFactory(brokerUri, clientId);
            _connection = _factory.CreateConnection(username, psw);
            _connection.Start();
            _session = _connection.CreateSession(AcknowledgementMode.AutoAcknowledge);

            if (isClient)
            {
                _qReceiveDest = _session.GetDestination(clientId, DestinationType.TemporaryQueue);
            }
            else
            {
                _qReceiveDest = _session.GetQueue(clientId);
            }

            _messageConsumer = _session.CreateConsumer(_qReceiveDest);
            _messageConsumer.Listener += (message) =>
            {
                if (Listener != null)
                {
                    Listener(message);
                }
            };
        }
开发者ID:OldApple,项目名称:MQProxy,代码行数:33,代码来源:OpenWireMiddleware.cs

示例13: Dispose

        public void Dispose()
        {
            lock (this)
            {
                this.isDisposed = true;
                this.consumer.Dispose();
                this.consumer = null;

                if (this.replyProducer != null)
                {
                    this.replyProducer.Dispose();
                    this.replyProducer = null;
                }

                this.requestReplyCallback = null;

                this.session.Dispose();
                this.session = null;

                this.connection.ConnectionInterrupted -= new EventHandler<NmsConnectionEventArgs>(connection_ConnectionInterrupted);
                this.connection.ConnectionResumed -= new EventHandler<NmsConnectionEventArgs>(connection_ConnectionResumed);

                this.connection = null;
            }
        }
开发者ID:cylwit,项目名称:EasyNMS,代码行数:25,代码来源:NmsConsumer.cs

示例14: 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

示例15: SetUp

		override public void SetUp()
        {
            base.SetUp();
			acknowledgementMode = AcknowledgementMode.Transactional;
            Drain();
            consumer = Session.CreateConsumer(Destination);
            producer = Session.CreateProducer(Destination);
        }
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:8,代码来源:TransactionTest.cs


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