public ServiceReporter(IMetricsRegistry registry, ZmqContext context, string endpoint) : base(registry) { context_ = context; socket_ = context_.Socket(SocketType.DEALER); endpoint_ = "tcp://" + endpoint; }
public WebNect() { this.context = new OpenNI.Context(SAMPLE_XML_FILE); this.sessionManager = new NITE.SessionManager(this.context, "Click", "RaiseHand"); this.context.StartGeneratingAll(); this.sessionManager.SessionStart += new EventHandler<NITE.PositionEventArgs>(sessionManager_SessionStart); this.sessionManager.SessionFocusProgress += new EventHandler<NITE.SessionProgressEventArgs>(sessionManager_SessionProgress); this.sessionManager.SessionEnd += sessionManager_SessionEnd; this.waveDetector = new NITE.WaveDetector(); this.waveDetector.Wave += waveDetector_Wave; this.waveDetector.PointUpdate += new EventHandler<HandEventArgs>(waveDetector_PointUpdate); this.sessionManager.AddListener(this.waveDetector); this.zmq_context = new ZMQ.Context(1); this.zmq_publisher = this.zmq_context.Socket(SocketType.PUB); this.zmq_publisher.Bind(this.SOCKET_SOURCE); Console.WriteLine("ZMQ Socket at {0}", this.SOCKET_SOURCE); this.shouldRun = true; this.readerThread = new Thread(ReaderThread); this.readerThread.Start(); }
public static void serve(){ StorageHandler s=new StorageHandler(); Storage.Processor p=new Storage.Processor(s); ZMQ.Context c=new ZMQ.Context(); TZmqServer tzs=new TZmqServer(p,c,"tcp://127.0.0.1:9090",ZMQ.SocketType.PAIR); tzs.Serve(); }
public Connection(string url) { this.url = url; this.context = new ZMQ.Context(1); this.reqSocket = this.context.Socket (SocketType.REQ); //this.subSocket = this.context.Socket (SocketType.SUB); this.reqSocket.Connect (this.url); //this.subSocket.Connect (this.url); }
public static void CopyDrawings(XmlDocument xmlResult, string url) { //Copy XML and order to GR_Cfg_DocumentQueue and send process-command through message queue to remote Windows service try { DatabaseFactory.InsertDocumentRecord(xmlResult, Triggers.pubOrderNumber, Triggers.dbEnvironment, StagingUtilities.dbSite, C1WebService.SPOrderNumber); } catch (System.Exception dbf1) { Triggers.logEvent = "ERROR QR: " + dbf1.Message; System.Diagnostics.EventLog.WriteEntry(Triggers.logSource, Triggers.logEvent, System.Diagnostics.EventLogEntryType.Information, 234); } Triggers.logEvent = "Signal Message Queue to begin document processing for: " + Triggers.pubOrderNumber + " -> " + C1WebService.SPOrderNumber; System.Diagnostics.EventLog.WriteEntry(Triggers.logSource, Triggers.logEvent, System.Diagnostics.EventLogEntryType.Information, 234); //Send command to ZMQ listener to process newly created record from queue //setup using (ZMQ.Context context = new ZMQ.Context()) { using (ZMQ.Socket requester = context.Socket(ZMQ.SocketType.REQ)) { //connect to remote endpoint, <server> if (Triggers.dbEnvironment == "PROD") { requester.Connect("tcp://192.168.23.19:5555"); //grc000dmzbus } else { requester.Connect("tcp://172.16.1.60:5555"); //grctslsql0 (dev) } //send on the REQ pattern string requestText = "PROCESS:" + Triggers.pubOrderNumber; requester.Send(Encoding.ASCII.GetBytes(requestText.ToCharArray())); //receive Response on the REP pattern string ackMsg = requester.Recv(Encoding.ASCII); Triggers.logEvent = "Message received from ZMQ: " + ackMsg; System.Diagnostics.EventLog.WriteEntry(Triggers.logSource, Triggers.logEvent, System.Diagnostics.EventLogEntryType.Information, 234); } } //If site was not NOVB, disable the C1Order trigger for the order-site and then move the queue record to the appropriate site queue table switch (StagingUtilities.dbSite) { case "NOVB": //do nothing break; default: DatabaseFactory.MoveQueueRecord(Triggers.pubOrderNumber, StagingUtilities.dbSite); break; } }
/// <summary> /// Create Socket using application wide Context /// </summary> /// <param name="type">Socket type</param> public Socket(SocketType type) { lock (_lockObj) { if (_appContext == null) { _appContext = new Context(); } Ptr = _appContext.CreateSocketPtr(type); } Interlocked.Increment(ref _appSocketCount); CommonInit(true); }
public static void serve() { StorageHandler s = new StorageHandler(); Storage.Processor p = new Storage.Processor(s); ZMQ.Context c = new ZMQ.Context(); TZmqServer tzs = new TZmqServer(p, c, "tcp://127.0.0.1:9090", ZMQ.SocketType.PAIR); tzs.Serve(); }
public Client(string address, int port = 4949) { ctx = new Context(4); sock = ctx.Socket(SocketType.REQ); // TODO: set me bmp = new Bitmap(640, 480, PixelFormat.Format16bppRgb555); sock.Connect("tcp://"+address+":"+port.ToString()); buf = new byte[640*480*3]; // w*h*BYTES PER PIXEL! dcmp = new LZ4Decompressor64(); // returns appropriate sized decompressor decompressed = new byte[640 * 480 * 3]; }
/// <summary> /// This function is run as a thread to read ram and raise events when new /// data shows up. /// </summary> internal void Monitor() { pol = ProcessAccess.GetFFXIProcess(polPID, abortMonitorThread); if (pol == null) { OnReaderStatusChanged(new ReaderStatusEventArgs() { Active = true, DataSourceType = this.ParseModeType, StatusMessage = "Failed to find FFXI" }); return; } else { OnReaderStatusChanged(new ReaderStatusEventArgs() { Active = true, DataSourceType = this.ParseModeType, StatusMessage = "Found FFXI" }); pol.Process.Exited += new EventHandler(PolExited); } // Wait for packets published from Windower. using (var ctx = new ZMQ.Context(1)) { using (Socket subscriber = ctx.Socket(SocketType.SUB)) { subscriber.Connect("tcp://localhost:43350"); subscriber.Subscribe(pol.Process.Id.ToString(), Encoding.Unicode); while (!abortMonitorThread.WaitOne(0)) { string address = subscriber.Recv(Encoding.Unicode); string contents = subscriber.Recv(Encoding.Unicode); } } } }
protected virtual void Dispose(bool disposing) { if (_msg != IntPtr.Zero) { Marshal.FreeHGlobal(_msg); _msg = IntPtr.Zero; } if (Ptr != IntPtr.Zero) { int rc = C.zmq_close(Ptr); Ptr = IntPtr.Zero; if (rc != 0) throw new Exception(); } if (_localSocket) { Interlocked.Decrement(ref _appSocketCount); lock (_lockObj) { if (_appSocketCount == 0) { _appContext.Dispose(); _appContext = null; } } } }
public ConsumerMessageStream(String stateStorageDirectory, String brokerAddress, BrokerInfoResponse configuration, ZMQ.Context context) { _stateStorageDirectory = stateStorageDirectory; _brokerAddress = brokerAddress; _configuration = configuration; _context = context; Messages = new ConcurrentQueue <Tuple <Int32, Message> >(); }
public ConsumerContext() { _zeromqContext = new ZMQ.Context(1); }