Beispiel #1
0
        public BackplaneModule(CrossStitchCore core, IClusterBackplane backplane = null, BackplaneConfiguration configuration = null)
        {
            _messageBus = core.MessageBus;
            _log        = new ModuleLog(_messageBus, Name);

            _configuration = configuration ?? BackplaneConfiguration.GetDefault();
            _backplane     = backplane ?? new ZyreBackplane(core, _configuration);

            // Forward messages from the backplane to the IMessageBus
            _backplane.MessageReceived += MessageReceivedHandler;
            _backplane.ClusterMember   += ClusterMemberHandler;
            _backplane.ZoneMember      += ZoneMemberHandler;
        }
Beispiel #2
0
        public ZyreBackplane(CrossStitchCore core, BackplaneConfiguration config = null, ISerializer serializer = null)
        {
            _core       = core;
            _config     = config ?? BackplaneConfiguration.GetDefault();
            _serializer = serializer ?? new JsonSerializer();

            // TODO: Need to expose more zyre options in the config, including broadcast port, broadcast interface,
            // and beacon interval.

            _zyre               = new NetMQ.Zyre.Zyre(core.NodeId);
            _zyre.EnterEvent   += ZyreEnterEvent;
            _zyre.StopEvent    += ZyreStopEvent;
            _zyre.ExitEvent    += ZyreExitEvent;
            _zyre.EvasiveEvent += ZyreEvasiveEvent;
            _zyre.JoinEvent    += ZyreJoinEvent;
            _zyre.LeaveEvent   += ZyreLeaveEvent;
            _zyre.WhisperEvent += ZyreWhisperEvent;
            _zyre.ShoutEvent   += ZyreShoutEvent;
        }