• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IMessageConsumer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IMessageConsumer类属于命名空间,在下文中一共展示了IMessageConsumer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: MessageSubscriber

 public MessageSubscriber(IAdvancedBus bus,
     IMessageConsumer messageConsumer, 
     ILogger logger, 
     IEnvironment environment,
     IExchange exchange,
     IQueue queue)
 {
     _messageConsumer = messageConsumer;
     _bus = bus;
     _logger = logger;
     _environment = environment;
     _exchange = exchange;
     _queue = queue;
 }
开发者ID:radicalgeek,项目名称:SampleMicroservice,代码行数:14,代码来源:MessageSubscriber.cs


示例12: WebApiApplication

        static WebApiApplication()
        {
            try
            {
                Configuration.Instance.UseLog4Net()
                                      .RegisterMessageContextType(typeof(MessageContext));

                _Logger = IoCFactory.Resolve<ILoggerFactory>().Create(typeof(WebApiApplication));

                _CommandDistributor = new CommandDistributor("tcp://127.0.0.1:5000",
                                                                new string[] {
                                                                    "tcp://127.0.0.1:5001"
                                                                    , "tcp://127.0.0.1:5002"
                                                                    , "tcp://127.0.0.1:5003"
                                                                }
                                                               );

                Configuration.Instance.RegisterCommandConsumer(_CommandDistributor, "CommandDistributor")
                             .CommandHandlerProviderBuild(null, "CommandHandlers")
                             .RegisterDisposeModule()
                             .RegisterMvc();

                _EventPublisher = IoCFactory.Resolve<IEventPublisher>();
                _EventPublisher.Start();
                _DomainEventConsumer = IoCFactory.Resolve<IMessageConsumer>("DomainEventConsumer");
                _DomainEventConsumer.Start();
                _ApplicationEventConsumer = IoCFactory.Resolve<IMessageConsumer>("ApplicationEventConsumer");
                _ApplicationEventConsumer.Start();

                var commandHandlerProvider = IoCFactory.Resolve<ICommandHandlerProvider>();
                _CommandConsumer1 = new CommandConsumer(commandHandlerProvider,
                                                           "tcp://127.0.0.1:5001");
                _CommandConsumer2 = new CommandConsumer(commandHandlerProvider,
                                                           "tcp://127.0.0.1:5002");
                _CommandConsumer3 = new CommandConsumer(commandHandlerProvider,
                                                           "tcp://127.0.0.1:5003");

                _CommandConsumer1.Start();
                _CommandConsumer2.Start();
                _CommandConsumer3.Start();
                _CommandDistributor.Start();

                _CommandBus = IoCFactory.Resolve<ICommandBus>() as IMessageConsumer;
                _CommandBus.Start();
            }
            catch (Exception ex)
            {
                _Logger.Error(ex.GetBaseException().Message, ex);
            }
        }
开发者ID:vebin,项目名称:IFramework,代码行数:50,代码来源:Global.asax.cs


示例13: AddLocalInstanceSubscription

 public void AddLocalInstanceSubscription(IMessageConsumer consumer)
 {
     localInstanceSubscriptions.Write(writer =>
     {
         foreach (var type in reflection.GetMessagesConsumed(consumer))
         {
             List<WeakReference> value;
             if (writer.TryGetValue(type.FullName, out value) == false)
             {
                 value = new List<WeakReference>();
                 writer.Add(type.FullName, value);
             }
             value.Add(new WeakReference(consumer));
         }
     });
     RaiseSubscriptionChanged();
 }
开发者ID:endeavour,项目名称:rhino-tools,代码行数:17,代码来源:PhtSubscriptionStorage.cs


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


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


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


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


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


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


示例20: Connect

        public void Connect()
        {
            while (!ableToSendEvents) {
                Uri connecturi = null;
                //if (textBoxSIPIPAddress.Text.StartsWith("ssl://"))
                //{
                Console.WriteLine ("Trying to connect to ActiveMQ broker ");
                //	connecturi = new Uri("activemq:" + textBoxSIPIPAddress.Text + ":" + textBoxSIPPort.Text + "?transport.ClientCertSubject=E%[email protected], CN%3DCommunication Tool"); // Connect to the ActiveMQ broker
                //}
                //else
                //{
                //log4.Debug(name + ": Trying to connect to ActiveMQ broker via non-secure connection");
                connecturi = new Uri ("activemq:tcp://localhost:61616"); // Connect to the ActiveMQ broker
                //}
                //Console.WriteLine("activeMQ::About to connect to " + connecturi);

                try {

                    // NOTE: ensure the nmsprovider-activemq.config file exists in the executable folder.
                    IConnectionFactory factory = new ConnectionFactory (connecturi);

                    // Create a new connection and session for publishing events
                    activeMQConnection = factory.CreateConnection ();
                    activeMQSession = activeMQConnection.CreateSession ();

                    IDestination destination = SessionUtil.GetDestination (activeMQSession, "topic://SIFTEO");
                    //Console.WriteLine("activeMQ::Using destination: " + destination);

                    // Create the producer
                    activeMQProducer = activeMQSession.CreateProducer (destination);
                    activeMQProducer.DeliveryMode = MsgDeliveryMode.Persistent;
                    destination = SessionUtil.GetDestination (activeMQSession, "topic://XVR.CCC");
                    activeMQConsumer = activeMQSession.CreateConsumer (destination);
                    //activeMQConsumer.Listener += new MessageListener(OnCCCMessage);

                    // Start the connection so that messages will be processed
                    activeMQConnection.Start ();
                    //activeMQProducer.Persistent = true;

                    // Enable the sending of events
                    //log4.Debug(name + ": ActiveMQ connected on topics XVR.CCC and XVR.SDK");
                    ableToSendEvents = true;

                } catch (Exception exp) {
                    // Report the problem in the output.log (Program Files (x86)\E-Semble\XVR 2012\XVR 2012\XVR_Data\output_log.txt)
                    //Console.WriteLine("*** AN ACTIVE MQ ERROR OCCURED: " + exp.ToString() + " ***");
                    //log4.Error(name + ": Error connecting to ActiveMQ broker: " + exp.Message);
                    //log4.Error((exp.InnerException != null) ? exp.InnerException.StackTrace : "");

                    Console.WriteLine (exp.Message);
                }
                System.Threading.Thread.Sleep (1000);
            }
        }
开发者ID:rooch84,项目名称:TangibleInvestigator,代码行数:54,代码来源:AMQConnector.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMessageContext类代码示例发布时间:2022-05-24
下一篇:
C# IMessageClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap