static void InstantiateExchAndQueues(string[] paramList) { // by convention, the args are a stringified set of parameters, in this order: // typeID, host, exch, uid, pwd, port, typeID /// worker listens to the "magic" queue and routing established on startup /// worker posts to *.workUpdate/workComplete/workerCommand.{myWorker} messages /// worker listens to *.workRequest/workerCommand.{myWorker} messages // build the queues string typeID = paramList[(int)StringifiedParameters.TypeIDOffset]; string thisHost = paramList[(int)StringifiedParameters.HostOffset]; string thisExchName = paramList[(int)StringifiedParameters.ExchOffset]; string thisUid = paramList[(int)StringifiedParameters.UidOffset]; string thisPwd = paramList[(int)StringifiedParameters.PwdOffset]; int thisPort = Convert.ToInt32(paramList[(int)StringifiedParameters.PortOffset]); List <string> routes = new List <string>(); routes.Add("*.workRequest." + typeID); routes.Add("*.workerCommand." + typeID); string queueName = "worker." + typeID; thisExch = new QueueingModel(thisExchName, "topic", queueName, routes, thisHost, thisUid, thisPwd, thisPort); }
static public void TestQModelPub() { QueueingModel pubQueue = new QueueingModel( exchName, exchType, "QModel", "QModel", hostName, uid, pwd, port); for (int i = 0; i < 5; i++) { string outMsg = "Hello World " + i.ToString(); ModelRequests.Add(outMsg); pubQueue.PostMessage(outMsg); } pubQueue.CloseConnections(); }
static public void TestQModel() { QueueingModel pubQueue = new QueueingModel("AnalysisFarm", "AnalysisRequest", "localhost", "", "", "", "", 5); while (!Console.KeyAvailable) { if (pubQueue.QueueEmpty()) { pubQueue.PostTestMessages(); } } pubQueue.CloseConnections(); }
public void InitProcess(string procName) { string queueName = "ClientQueue"; clientProcess = null; if (procName != null) { queueName = "ServerQueue"; clientProcess = new Process(); clientProcess.StartInfo.FileName = procName; } QueueCommon.ConnectionDetail listenDetail = thisConnectionDetail.UpdateQueueDetail(queueName, thisConnectionDetail.routeKeys); queueClient = new QueueingModel(listenDetail); }
static void TestQModelRead() { QueueingModel subQueue = new QueueingModel( exchName, exchType, "QModel", "QModel", hostName, uid, pwd, port); while (!subQueue.QueueEmpty()) { string gotOne = subQueue.ReadMessageAsString(); if (ModelRequests.Contains(gotOne)) { ModelRequests.Remove(gotOne); } } subQueue.CloseConnections(); }
//=================================== // private internal methods private void InitControlQueue() { // set up the local control queues List <string> routes = new List <string>(); routes.Add("*.farmRequest.proxy"); // the queueingmodel class binds an exchange and queue for straightforward applications where only one channel is needed controlQueue = new QueueingModel( settings.exchName, "topic", ControlBaseName, routes, settings.host, settings.user, settings.pass, settings.port); controlQueue.SetListenerCallback(HandlePosts); if (auditLog != null) { auditLog.WriteEntry("Queue Initialized"); } }
static void Main(string[] args) { string hostName = "localhost"; string uid = "guest"; string pwd = "guest"; int port = 5672; string exchangeName = "refExch"; int messagesSent = 0; QueueingModel subQueue = new QueueingModel(exchangeName, "direct", "AnalysisFarm", "AnalysisRequest", "localhost", uid, pwd, port); while (!Console.KeyAvailable) { if (!subQueue.QueueEmpty()) { string gotOne = subQueue.ReadMessageAsString(); Console.WriteLine(gotOne); } } subQueue.CloseConnections(); }
static void ShutdownQueues() { thisExch.CloseConnections(); thisExch = null; }
static void TestQModelReadAsync() { asyncModel = new QueueingModel( exchName, exchType, "QModel", "QModel", hostName, uid, pwd, port); asyncModel.SetListenerCallback(PullModel); }