0 Replies - 341 Views - Last Post: 29 August 2012 - 11:55 AM Rate Topic: -----

#1 critikull  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-August 12

C#.net Message Queue Connecting to PHP

Posted 29 August 2012 - 11:55 AM

Wasn't sure whether to post in php or here. I want to receive a data feed from a client who uses a .net message queue framework but we do not run a windows server to accept it, we run a linux box.

I wrote this to accept the feed in C#.net to test getting the data from them using my personal server at home:

    [WebService(Name = "DataFeedTESTV1_0", Namespace = "http://www.sendercompany.com/webservices/datafeed/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
        private MessageQueue mq;
        private string dataFeedName = "DataFeedMe";
        public Service()
        {
            try
            {
                mq = new MessageQueue();
                mq.Formatter = new BinaryMessageFormatter();
                mq.MessageReadPropertyFilter.ArrivedTime = true;
                mq.MessageReadPropertyFilter.LookupId = true;
                mq.Path = @".\Private$\" + dataFeedName;
                EnsureQueueExists(mq.Path);
            }
            catch {
                System.Diagnostics.EventLog.WriteEntry(dataFeedName, "Cannot make a connection.");
            }
        }

        // Creates the queue if it does not already exist.
        void EnsureQueueExists(string path)
        {
            try
            {
                if (!MessageQueue.Exists(path))
                {
                    MessageQueue.Create(path, true);
                }
            }
            catch (MessageQueueException mqe)
            {
                System.Diagnostics.EventLog.WriteEntry(dataFeedName, mqe.ToString());
            }
        }

        public function receiveData(String name) { }



They push data using:

    static void Main(string[] args)
        {
            using (DataFeedTest.DataFeedTestV1_0 dfClient = new DataFeedTest.DataFeedTestV1_0())
            {
                try
                {
                    Console.WriteLine("about to send");
                    dfClient.receiveData("Test");
                    Console.WriteLine("send success");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }



I come from a background in Java/C++/C and this code is alien to me. What I am trying to do is rewrite our code in PHP to accept the incoming data to be used on our webserver which runs linux.

I am not asking SO to write this for me but to help me understand how this code works. For my questions: "RDF" = the datafeed I use to accept the data and "SDF" - the datafeed they use to send the data.

1. I run the RDF and it starts to run on the default host/port (localhost:1448), now when I run the SDF it successfully sends the message, how did the SDF know to point to the localhost:1448 configuration with only a:

    DataFeedTest.DataFeedTestV1_0 dfClient = new DataFeedTest.DataFeedTestV1_0()



2. If I want to rewrite the RDF in php what tutorials could I look at to help me accept this feed? Is it some REST/SOAP/POST/GET api?

This question is long winded but I really need some guidance and I appreciate any comment or suggestion to help me move forward.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1