Example #1
0
 public ServiceReporter(IMetricsRegistry registry, ZmqContext context,
   string endpoint)
   : base(registry) {
   context_ = context;
   socket_ = context_.Socket(SocketType.DEALER);
   endpoint_ = "tcp://" + endpoint;
 }
Example #2
0
 public ServiceReporter(IMetricsRegistry registry, ZmqContext context,
                        string endpoint)
     : base(registry)
 {
     context_  = context;
     socket_   = context_.Socket(SocketType.DEALER);
     endpoint_ = "tcp://" + endpoint;
 }
Example #3
0
        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;
            }
        }
Example #4
0
        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];
        }
Example #5
0
        /// <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);
                    }
                }
            }
        }