Exemple #1
0
        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 = activeMqConsumer.CreateConsumer(rdTopic.Checked ? TopicType.Topic : TopicType.Queue, txtTopicName.Text, txtSelector.Text);
                }
                else
                {
                    m_consumer = activeMqConsumer.CreateConsumer(rdTopic.Checked ? TopicType.Topic : TopicType.Queue, txtTopicName.Text);
                }
                activeMqConsumer.SetMessageType(rdMsgTypeText.Checked?MessageType.Text : MessageType.Byte);

                m_consumer.Listener += new MessageListener(activeMqConsumer.consumer_listener);
            }
            catch (System.Exception ex)
            {
                GlobalFunction.MsgBoxException(ex.Message, "btnSubscribe_Click");
            }
        }
Exemple #2
0
        private static void ConsumerReceiveMessage()
        {
            m_consumer = activeMqConsumer.CreateConsumer(TopicType.Topic, "ActiveMq test", "Filter='test'");

            m_consumer.Listener += new MessageListener(activeMqConsumer.consumer_listener);
        }