public Actor(NetMQContext context, IShimHandler <T> shimHandler, T state) { this.m_self = context.CreatePairSocket(); this.m_shim = new Shim <T>(shimHandler, context.CreatePairSocket()); this.m_self.Options.SendHighWatermark = 1000; this.m_self.Options.SendHighWatermark = 1000; this.m_state = state; m_receiveEventDelegatorHelper = new EventDelegatorHelper <NetMQActorEventArgs <T> >(() => m_self.ReceiveReady += OnReceive, () => m_self.ReceiveReady += OnReceive); m_sendEventDelegatorHelper = new EventDelegatorHelper <NetMQActorEventArgs <T> >(() => m_self.SendReady += OnReceive, () => m_self.SendReady += OnSend); //now binding and connect pipe ends string endPoint = string.Empty; while (true) { Action bindAction = () => { endPoint = GetEndPointName(); m_self.Bind(endPoint); }; try { bindAction(); break; } catch (NetMQException nex) { if (nex.ErrorCode == ErrorCode.EFAULT) { bindAction(); } } } m_shim.Pipe.Connect(endPoint); //Initialise the shim handler this.m_shim.Handler.Initialise(state); //Create Shim thread handler CreateShimThread(state); // Mandatory handshake for new actor so that constructor returns only // when actor has also initialized. This eliminates timing issues at // application start up. m_self.WaitForSignal(); }
public Actor(NetMQContext context, IShimHandler <T> shimHandler, T state) { this.self = context.CreatePairSocket(); this.shim = new Shim <T>(shimHandler, context.CreatePairSocket()); this.self.Options.SendHighWatermark = 1000; this.self.Options.SendHighWatermark = 1000; this.state = state; //now binding and connect pipe ends string endPoint = string.Empty; while (true) { Action bindAction = () => { endPoint = GetEndPointName(); self.Bind(endPoint); }; try { bindAction(); break; } catch (NetMQException nex) { if (nex.ErrorCode == ErrorCode.EFAULT) { bindAction(); } } } shim.Pipe.Connect(endPoint); //Initialise the shim handler this.shim.Handler.Initialise(state); //Create Shim thread handler CreateShimThread(state); }