protected Device(IZmqContext ctx, string frontEndEndpoint, string backendEndpoint, SocketType frontendType, SocketType backendType, bool enableCapture = false) { if (ctx == null) { throw new ArgumentNullException("ctx"); } if (string.IsNullOrEmpty(frontEndEndpoint)) { throw new ArgumentNullException("frontEndEndpoint"); } if (string.IsNullOrEmpty(backendEndpoint)) { throw new ArgumentNullException("backendEndpoint"); } this._ctx = ctx; this._frontendType = frontendType; this._backendType = backendType; this._enableCapture = enableCapture; this._ownSockets = true; this._needsBinding = true; this.FrontEndEndpoint = frontEndEndpoint; this.BackendEndpoint = backendEndpoint; }
public CastleZmqSocketFactory(IZmqContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } _context = context; }
public RequestPoll(IZmqContext context) { this._context = context; this._endpoint2Sockets = new ConcurrentDictionary <string, EndpointPoll>(StringComparer.InvariantCultureIgnoreCase); this._socketsInUse = new HashSet <IZmqSocket>(); this._context.Disposing += OnZmqContextDisposing; }
public RequestPoll(IZmqContext context) { this._context = context; this._endpoint2Sockets = new ConcurrentDictionary<string, EndpointPoll>(StringComparer.InvariantCultureIgnoreCase); this._socketsInUse = new HashSet<IZmqSocket>(); this._context.Disposing += OnZmqContextDisposing; }
public WorkerPool(IZmqContext ctx, string frontEndEndpoint, string backendEndpoint, Action <byte[], IZmqSocket> proc, int workers, bool enableCapture = false) : base(ctx, frontEndEndpoint, backendEndpoint, enableCapture) { this._ctx = ctx; this._backendEndpoint = backendEndpoint; this._proc = proc; this._workers = workers; }
public RemoteRequestListener2(IZmqContext context, string endpoint, int workers, LocalInvocationDispatcher dispatcher, SerializationStrategy serializationStrategy) { _endpoint = endpoint; _dispatcher = dispatcher; _serializationStrategy = serializationStrategy; _reply = context.Rep(); }
public WorkerPool(IZmqContext ctx, string frontEndEndpoint, string backendEndpoint, Action<byte[], IZmqSocket> proc, int workers, bool enableCapture = false) : base(ctx, frontEndEndpoint, backendEndpoint, enableCapture) { this._ctx = ctx; this._backendEndpoint = backendEndpoint; this._proc = proc; this._workers = workers; }
public RemoteRequestService(IZmqContext context, RemoteEndpointRegistry endpointRegistry, SerializationStrategy serializationStrategy, RequestPoll requestPoll) { this._context = context; this._endpointRegistry = endpointRegistry; this._serializationStrategy = serializationStrategy; this._requestPoll = requestPoll; }
public RemoteRequest(IZmqContext context, string endpoint, RequestMessage requestMessage, SerializationStrategy serializationStrategy) : base(context, endpoint) { this._endpoint = endpoint; this._requestMessage = requestMessage; this._serializationStrategy = serializationStrategy; this.Timeout = 30 * 1000; }
public RemoteRequestListener(IZmqContext context, string endpoint, int workers, LocalInvocationDispatcher dispatcher, SerializationStrategy serializationStrategy) { this._context = context; this._endpoint = endpoint; this._workers = workers; this._dispatcher = dispatcher; this._serializationStrategy = serializationStrategy; var count = Interlocked.Increment(ref localAddUseCounter); this._localEndpoint = "inproc://rrworker_" + count; }
public MonitoredSocket(IZmqContext context, IZmqSocket socket) { this._socket = socket; this._monitor = new Castle.Zmq.Monitor(socket, context); this._monitor.SocketEvent += (sender, args) => { switch (args.Event) { case MonitorEvents.BindFailed: case MonitorEvents.AcceptFailed: case MonitorEvents.CloseFailed: if (!_inError) { _inError = true; Thread.MemoryBarrier(); FireError(args); } break; case MonitorEvents.ConnectRetried: case MonitorEvents.Closed: case MonitorEvents.Disconnected: if (!_disconnected) { _disconnected = true; _connected = false; Thread.MemoryBarrier(); FireDisconnected(args); } break; case MonitorEvents.Connected: case MonitorEvents.Listening: if (!_connected) { _connected = true; _inError = _disconnected = false; Thread.MemoryBarrier(); FireConnected(args); } break; } }; }
protected BaseRequest(IZmqContext context, string endpoint) { if (context == null) { throw new ArgumentNullException("context"); } if (endpoint == null) { throw new ArgumentNullException("endpoint"); } this._context = context; this._endpoint = endpoint; this.Timeout = Socket.InfiniteTimeout; }
protected Device(IZmqContext ctx, string frontEndEndpoint, string backendEndpoint, SocketType frontendType, SocketType backendType, bool enableCapture = false) { if (ctx == null) throw new ArgumentNullException("ctx"); if (string.IsNullOrEmpty(frontEndEndpoint)) throw new ArgumentNullException("frontEndEndpoint"); if (string.IsNullOrEmpty(backendEndpoint)) throw new ArgumentNullException("backendEndpoint"); this._ctx = ctx; this._frontendType = frontendType; this._backendType = backendType; this._enableCapture = enableCapture; this._ownSockets = true; this._needsBinding = true; this.FrontEndEndpoint = frontEndEndpoint; this.BackendEndpoint = backendEndpoint; }
public Monitor(IZmqSocket socket, IZmqContext context, string monitorName = null, MonitorEvents events = MonitorEvents.All) { if (socket == null) { throw new ArgumentNullException("socket"); } if (context == null) { throw new ArgumentNullException("context"); } if (monitorName != null) { if (!monitorName.StartsWith("inproc://")) { monitorName = "inproc://" + monitorName; } } else { monitorName = "inproc://temp" + Rnd.Next(0, Int32.MaxValue); } this._monitorName = monitorName; // Creates a inproc socket pair var res = Native.Monitor.zmq_socket_monitor(socket.Handle(), monitorName, (int)events); if (res == Native.ErrorCode) { Native.ThrowZmqError("Monitor"); } // Connects to the newly created socket pair this._pairSocket = context.Pair(); this._pairSocket.Connect(this._monitorName); this._thread = new Thread(EventsWorker) { IsBackground = true }; this._thread.Start(); }
protected BasePublisher(IZmqContext context, string endpoint, Func <T, byte[]> serializer) { if (context == null) { throw new ArgumentNullException("context"); } if (endpoint == null) { throw new ArgumentNullException("endpoint"); } if (serializer == null) { throw new ArgumentNullException("serializer"); } this._context = context; this._endpoint = endpoint; this._serializer = serializer; }
protected BaseSubscriber(IZmqContext context, string endpoint, Func <byte[], T> deserializer) { if (context == null) { throw new ArgumentNullException("context"); } if (endpoint == null) { throw new ArgumentNullException("endpoint"); } if (deserializer == null) { throw new ArgumentNullException("deserializer"); } this._context = context; this._endpoint = endpoint; this._deserializer = deserializer; }
public Monitor(IZmqSocket socket, IZmqContext context, string monitorName = null, MonitorEvents events = MonitorEvents.All) { if (socket == null) throw new ArgumentNullException("socket"); if (context == null) throw new ArgumentNullException("context"); if (monitorName != null) { if (!monitorName.StartsWith("inproc://")) monitorName = "inproc://" + monitorName; } else { monitorName = "inproc://temp" + Rnd.Next(0, Int32.MaxValue); } this._monitorName = monitorName; // Creates a inproc socket pair var res = Native.Monitor.zmq_socket_monitor(socket.Handle(), monitorName, (int)events); if (res == Native.ErrorCode) { Native.ThrowZmqError("Monitor"); } // Connects to the newly created socket pair this._pairSocket = context.Pair(); this._pairSocket.Connect(this._monitorName); this._thread = new Thread(EventsWorker) { IsBackground = true }; this._thread.Start(); }
public ZmqRpcCleaner(IZmqContext context) { _context = context; }
public MySub(IZmqContext context, string endpoint) : base(context, endpoint, Deserializer) { }
public SharedQueue(IZmqContext ctx, string frontEndEndpoint, string backendEndpoint, bool enableCapture = false) : base(ctx, frontEndEndpoint, backendEndpoint, SocketType.Router, SocketType.Dealer, enableCapture) { }
public static IZmqSocket Dealer(this IZmqContext source) { return(source.CreateSocket(SocketType.Dealer)); }
public static IZmqSocket XSub(this IZmqContext source) { return(source.CreateSocket(SocketType.XSub)); }
public Forwarder(IZmqContext ctx, string frontEndEndpoint, string backendEndpoint, bool enableCapture = false) : base(ctx, frontEndEndpoint, backendEndpoint, SocketType.XSub, SocketType.XPub, enableCapture) { }
public static IZmqSocket Req(this IZmqContext source) { return(source.CreateSocket(SocketType.Req)); }
public static IZmqSocket Pair(this IZmqContext source) { return(source.CreateSocket(SocketType.Pair)); }