0

I'm building a simple Azure Worker Role to Subscribe to a zeromq Publisher (using NetMQ in the worker) and store messages into Azure Tables.

Everything works fine when I run the worker on my dev machine. Messages come in and are written to the table.

However, when I deploy the worker to Azure something stops working. I can attach to the worker and see that it is stuck on the blocking subscriberSocket.Receive() call. From the point of view of the worker, no messages ever turn up at the subscribing socket.

I've RDP'd on to the worker and using netstat I can see the outgoing connection from the subscribing socket to the remote publisher is established, so it doesn't look like a firewall issue.

From the logs / diagnostic info everything seems to be normal, it's just that no messages are ever received.

Is there some Azure configuration I've missed? Something that would allow outgoing connections but prevent data getting through?

Relevant part of the worker code:

private async Task RunAsync(CancellationToken cancellationToken)
    {
        Trace.TraceInformation("Running Task.");
        using (var eDDNcontext = NetMQContext.Create())
        using (var subscriberSocket = eDDNcontext.CreateSubscriberSocket())
        {
            Trace.TraceInformation("Subscribing to EDDN.");


            var endpoint = GetEndpoint("EDDNEndpoint");
            subscriberSocket.Connect("tcp://eddn-relay.elite-markets.net:9500");
            subscriberSocket.Subscribe(String.Empty);

            while (!cancellationToken.IsCancellationRequested)
            {
                Byte[] rawMessage = subscriberSocket.Receive();  //Azure deployment gets stuck on this blocking call.
                if (rawMessage.Length < 3) continue;
                using (MemoryStream memoryStream = new MemoryStream(rawMessage))
                {
                    //Read past the first two bytes of the zlib header.
                    memoryStream.Seek(2, SeekOrigin.Begin);
                    using (DeflateStream deflateStream = new DeflateStream(memoryStream, CompressionMode.Decompress))
                    using (StreamReader reader = new StreamReader(deflateStream, Encoding.UTF8))
                    {
  • how often publisher send messages? maybe you are missing the first message? – somdoron Jan 20 '15 at 10:38
  • @somdoron I don't have control over the publisher, but from listening on my local machine it looks like it's in the range of 10s of messages an hour. I've left the worker going for over a day with nothing happening. I have had the worker and my local machine listening at the same time. The local sees the messages, the worker does not. – verve_rat Jan 20 '15 at 17:38
  • Can you provide a minimal azure netmq project connecting to that service I can also deploy in azure in order to debug it? I'm pretty sure it is firewall thing (we had some firewall issues as well when trying to work in azure, but not with worker role, just VM). – somdoron Jan 21 '15 at 17:15
  • 1
    anyway I suggest disable the windows firewall completely on the virtual machine and trying again – somdoron Jan 21 '15 at 17:16
  • If you are using the Classic VM, you will need to set up your endpoints. Be advised that using 127.0.0.1 may not be valid. You may also find that plugging in your external dynamic ip will probably cause a NetMQ exception. Use the dynamic ip address instead. It will be shown in your ipconfig /all | find "IPv4" command. – Rudy Hinojosa Apr 20 '17 at 18:14

0 Answers0