/// <summary> /// Initializes an instance of a NetMQSenderManager constructing a NetMQSender from the specified NetMQContext and /// connects it to the specified address /// </summary> /// <param name="context"></param> public NetMQSenderManager(NetMQContext context, String address) { var sender = new NetMQSender(context.CreateDealerSocket(), new BinarySerializer(), address); sender.Connect(); Route<object>(new NetMQSenderFactory(address, context)); }
public AsyncBrocker(NetMQContext context, string address) { _socket = context.CreateDealerSocket(); _socket.Options.SendHighWatermark = 1; _socket.Options.ReceiveHighWatermark = 1; _socket.Bind(address); _socket.ReceiveReady += SocketReceiveReady; _poller.AddSocket(_socket); _poller.PollTillCancelledNonBlocking(); }
/// <summary> /// Create the DEALER socket and connect it to QUEUE backend. /// Set the identity. /// Send the initial READY message. /// </summary> private static DealerSocket GetWorkerSocket(NetMQContext ctx, bool verbose, int id) { var worker = ctx.CreateDealerSocket(); worker.Options.Identity = Encoding.UTF8.GetBytes("Worker_" + id); worker.Connect(Commons.QueueBackend); if (verbose) Console.WriteLine("[WORKER] {0} sending 'READY'.", Encoding.UTF8.GetString(worker.Options.Identity)); // send READY worker.Send(Commons.PPPReady); return worker; }