Page 2 of 2

EventHubs

Posted: Sun May 29, 2016 8:36 pm
by Maggette
That was just the first number that came to my mind (for obvious reason :)). If it doesn't work, please elaborate a little bit of what happens (if anything happens)..errors, call stack, etc.

EventHubs

Posted: Sun May 29, 2016 8:40 pm
by Nonius
well, mag, that is a decent offer you're offering. Let me see if I can muster up the energy right now....will revert.



edit: I posted the code for the client. it barfs on binding on the server.

EventHubs

Posted: Sun May 29, 2016 8:56 pm
by Nonius
server side looks like this:



public class SentimentPublisher

{

SentimentMeasurementContainer smc;



PublisherSocket pub = new PublisherSocket()





public SentimentPublisher(SentimentMeasurementContainer smc)

{

this.smc = smc;



this.AddSentimentHandler();

try

{

pub.Bind(@"tcp://xxx.xxx.xxx.xxx:5556");

}

catch

{

throw new Exception("cunt");

}



}

public void Test()

{

try

{

pub.SendMoreFrame("Trump").SendFrame("Fuck");

}

catch

{

throw new Exception("Can't Publish");

}

}

public void ReceiveSentiment(object sender, EventArgs e)

{



SentimentPacket sp = (SentimentPacket)e;

pub.SendMoreFrame(sp.keyword).SendFrame(Convert.ToString(sp.sentiment+": "+sp.tweet));







}



public void AddSentimentHandler()

{



foreach (var x in smc.TheMeasurements)

{

x.Value.AddEventHandler(this.ReceiveSentiment);

}



}

}

EventHubs

Posted: Sun May 29, 2016 9:09 pm
by Maggette
Hence you jump into

"throw new Exception("cunt")" ?



What doe sthe exception say (other than "cunt" ;) )

EventHubs

Posted: Sun May 29, 2016 9:16 pm
by Nonius
this.



[img]/User%20Files/14/Screen%20Shot%202016-05-29%20at%2021.15.12.png[/img]



not exactly revealing, to me at least. Is it the "cunt" thing?

EventHubs

Posted: Sun May 29, 2016 9:53 pm
by Maggette
"not exactly revealing, to me at least"



Same here, sorry...your ZeroMQ seems fine (code wise..."pretty hello wordish").

EventHubs

Posted: Mon May 30, 2016 7:13 pm
by Nonius
finally got it to work, by the way. stupid mistake about the IP address.



just trying a python case and it don't work.



__author__ = 'god'

from socket import socket

import zmq

import sys







# Socket to talk to server



context = zmq.Context()

socket = context.socket(zmq.SUB)



print "Collecting updates from NoniusRe..."

socket.connect ("tcp://66.666.66.666:8080")







topicfilter = "Trump"

socket.setsockopt(zmq.SUBSCRIBE, topicfilter)



# Process 5 updates

total_value = 0

for i in range(0,100):

string = socket.recv()

topic, messagedata = string.split()



print topic, messagedata

EventHubs

Posted: Mon Jun 27, 2016 10:28 am
by Nonius
by the way, I put a subscriber in a .NET project that was published to an azure website. it doesn't work on the website. I presume I'd need to set some azure firewall rule or something like that? anyone had this issue?



Barracuda WAF Cloud Service?

EventHubs

Posted: Mon Jun 27, 2016 10:51 am
by Nonius
nevermind, found out how to setup firewall rules.

EventHubs

Posted: Mon Jun 27, 2016 3:44 pm
by Nonius
what a nightmare. in Powershell, am able to setup a NetworkSecurityGroup. then set up a Virtual Network. both show up as existing. Then trying to assign the NetworkSecurityGroup to the virtual network. it's saying that virtual network doesn't exist!