public MessageCenter(SiloInitializationParameters silo, NodeConfiguration nodeConfig, IMessagingConfiguration config, ISiloPerformanceMetrics metrics = null) { this.Initialize(silo.SiloAddress.Endpoint, nodeConfig.Generation, config, metrics); if (nodeConfig.IsGatewayNode) { this.InstallGateway(nodeConfig.ProxyGatewayEndpoint); } }
private void Initialize(IPEndPoint here, int generation, IMessagingConfiguration config, ISiloPerformanceMetrics metrics = null) { if(log.IsVerbose3) log.Verbose3("Starting initialization."); SocketManager = new SocketManager(config); ima = new IncomingMessageAcceptor(this, here, SocketDirection.SiloToSilo); MyAddress = SiloAddress.New((IPEndPoint)ima.AcceptingSocket.LocalEndPoint, generation); MessagingConfiguration = config; InboundQueue = new InboundMessageQueue(); OutboundQueue = new OutboundMessageQueue(this, config); Gateway = null; Metrics = metrics; sendQueueLengthCounter = IntValueStatistic.FindOrCreate(StatisticNames.MESSAGE_CENTER_SEND_QUEUE_LENGTH, () => SendQueueLength); receiveQueueLengthCounter = IntValueStatistic.FindOrCreate(StatisticNames.MESSAGE_CENTER_RECEIVE_QUEUE_LENGTH, () => ReceiveQueueLength); if (log.IsVerbose3) log.Verbose3("Completed initialization."); }
public QueueListener( IMessageTypesCache messageTypesCache, IMessagingLogger messagingLogger, UnprocessedMessagesResender unprocessedMessagesResender, IMessagingConfiguration messagingConfiguration, IListeningAgent listeningAgent, IDocumentMappingInitializer documentMappingInitializer, ISubscriptionAgent subscriptionAgent, ICollectionCreator collectionCreator ) { _messageTypesCache = messageTypesCache; _messagingLogger = messagingLogger; _unprocessedMessagesResender = unprocessedMessagesResender; _messagingConfiguration = messagingConfiguration; _listeningAgent = listeningAgent; _documentMappingInitializer = documentMappingInitializer; _subscriptionAgent = subscriptionAgent; _collectionCreator = collectionCreator; }
internal OutboundMessageQueue(MessageCenter mc, IMessagingConfiguration config) { messageCenter = mc; pingSender = new SiloMessageSender("PingSender", messageCenter); systemSender = new SiloMessageSender("SystemSender", messageCenter); senders = new Lazy <SiloMessageSender> [config.SiloSenderQueues]; for (int i = 0; i < senders.Length; i++) { int capture = i; senders[capture] = new Lazy <SiloMessageSender>(() => { var sender = new SiloMessageSender("AppMsgsSender_" + capture, messageCenter); sender.Start(); return(sender); }, LazyThreadSafetyMode.ExecutionAndPublication); } logger = LogManager.GetLogger("Messaging.OutboundMessageQueue"); stopped = false; }
internal OutboundMessageQueue(MessageCenter mc, IMessagingConfiguration config) { messageCenter = mc; pingSender = new SiloMessageSender("PingSender", messageCenter); systemSender = new SiloMessageSender("SystemSender", messageCenter); senders = new Lazy<SiloMessageSender>[config.SiloSenderQueues]; for (int i = 0; i < senders.Length; i++) { int capture = i; senders[capture] = new Lazy<SiloMessageSender>(() => { var sender = new SiloMessageSender("AppMsgsSender_" + capture, messageCenter); sender.Start(); return sender; }, LazyThreadSafetyMode.ExecutionAndPublication); } logger = TraceLogger.GetLogger("Messaging.OutboundMessageQueue"); stopped = false; }
public Message Message { get; set; } // might hold metadata used by response pipeline public CallbackData( Action<Message, TaskCompletionSource<object>> callback, Func<Message, bool> resendFunc, TaskCompletionSource<object> ctx, Message msg, Action unregisterDelegate, IMessagingConfiguration config) { // We are never called without a callback func, but best to double check. if (callback == null) throw new ArgumentNullException("callback"); // We are never called without a resend func, but best to double check. if (resendFunc == null) throw new ArgumentNullException("resendFunc"); this.callback = callback; this.resendFunc = resendFunc; context = ctx; Message = msg; unregister = unregisterDelegate; alreadyFired = false; this.config = config; }
private void Initialize(IPEndPoint here, int generation, IMessagingConfiguration config, ISiloPerformanceMetrics metrics = null) { if (log.IsVerbose3) { log.Verbose3("Starting initialization."); } SocketManager = new SocketManager(config, this.loggerFactory); ima = new IncomingMessageAcceptor(this, here, SocketDirection.SiloToSilo, this.messageFactory, this.serializationManager, this.loggerFactory); MyAddress = SiloAddress.New((IPEndPoint)ima.AcceptingSocket.LocalEndPoint, generation); MessagingConfiguration = config; InboundQueue = new InboundMessageQueue(this.loggerFactory); OutboundQueue = new OutboundMessageQueue(this, config, this.serializationManager, this.loggerFactory); Metrics = metrics; sendQueueLengthCounter = IntValueStatistic.FindOrCreate(StatisticNames.MESSAGE_CENTER_SEND_QUEUE_LENGTH, () => SendQueueLength); receiveQueueLengthCounter = IntValueStatistic.FindOrCreate(StatisticNames.MESSAGE_CENTER_RECEIVE_QUEUE_LENGTH, () => ReceiveQueueLength); if (log.IsVerbose3) { log.Verbose3("Completed initialization."); } }
public ProxiedMessageCenter( ClientConfiguration config, IPAddress localAddress, int gen, GrainId clientId, IGatewayListProvider gatewayListProvider, MessageFactory messageFactory) { lockable = new object(); MyAddress = SiloAddress.New(new IPEndPoint(localAddress, 0), gen); ClientId = clientId; this.messageFactory = messageFactory; Running = false; MessagingConfiguration = config; GatewayManager = new GatewayManager(config, gatewayListProvider); PendingInboundMessages = new BlockingCollection <Message>(); gatewayConnections = new Dictionary <Uri, GatewayConnection>(); numMessages = 0; grainBuckets = new WeakReference[config.ClientSenderBuckets]; logger = LogManager.GetLogger("Messaging.ProxiedMessageCenter", LoggerType.Runtime); if (logger.IsVerbose) { logger.Verbose("Proxy grain client constructed"); } IntValueStatistic.FindOrCreate(StatisticNames.CLIENT_CONNECTED_GATEWAY_COUNT, () => { lock (gatewayConnections) { return(gatewayConnections.Values.Count(conn => conn.IsLive)); } }); if (StatisticsCollector.CollectQueueStats) { queueTracking = new QueueTrackingStatistic("ClientReceiver"); } }
internal static void InitGlobalBufferPool(IMessagingConfiguration config) { GlobalPool = new BufferPool(config.BufferPoolBufferSize, config.BufferPoolMaxSize, config.BufferPoolPreallocationSize, "Global"); }
public LegacyMongoAgent(IMessagingConfiguration messagingConfiguration) { _messagingConfiguration = messagingConfiguration; _dbName = _messagingConfiguration.Database; }
internal OutgoingMessageSender(string nameSuffix, IMessagingConfiguration config) : base(nameSuffix, config) { }
public LegacyMongoAgent(IMessagingConfiguration messagingConfiguration) { _messagingConfiguration = messagingConfiguration; _dbName = _messagingConfiguration.Database; _db = new Lazy <MongoDatabase>(GetDb); }
internal ClientsReplyRoutingCache(IMessagingConfiguration messagingConfiguration) { clientRoutes = new ConcurrentDictionary <GrainId, Tuple <SiloAddress, DateTime> >(); TIME_BEFORE_ROUTE_CACHED_ENTRY_EXPIRES = messagingConfiguration.ResponseTimeout.Multiply(5); }
public ProxiedMessageCenter(ClientConfiguration config, IPAddress localAddress, int gen, GrainId clientId, IGatewayListProvider gatewayListProvider) { lockable = new object(); MyAddress = SiloAddress.New(new IPEndPoint(localAddress, 0), gen); ClientId = clientId; Running = false; MessagingConfiguration = config; GatewayManager = new GatewayManager(config, gatewayListProvider); PendingInboundMessages = new BlockingCollection<Message>(); gatewayConnections = new Dictionary<Uri, GatewayConnection>(); numMessages = 0; grainBuckets = new WeakReference[config.ClientSenderBuckets]; logger = LogManager.GetLogger("Messaging.ProxiedMessageCenter", LoggerType.Runtime); if (logger.IsVerbose) logger.Verbose("Proxy grain client constructed"); IntValueStatistic.FindOrCreate(StatisticNames.CLIENT_CONNECTED_GATEWAY_COUNT, () => { lock (gatewayConnections) { return gatewayConnections.Values.Count(conn => conn.IsLive); } }); if (StatisticsCollector.CollectQueueStats) { queueTracking = new QueueTrackingStatistic("ClientReceiver"); } }
internal static void CopyNetworkingOptions(IMessagingConfiguration configuration, NetworkingOptions options) { options.OpenConnectionTimeout = configuration.OpenConnectionTimeout; options.MaxSocketAge = configuration.MaxSocketAge; }
internal SocketManager(IMessagingConfiguration config) { cache = new LRU <IPEndPoint, Socket>(MAX_SOCKETS, config.MaxSocketAge, SendingSocketCreator); cache.RaiseFlushEvent += FlushHandler; }
public MessageCenter(IPEndPoint here, int generation, IMessagingConfiguration config, ISiloPerformanceMetrics metrics = null) { Initialize(here, generation, config, metrics); }
public MessagingFacility() { MessagingConfiguration = m_DefaultMessagingConfiguration; }
// Resends are used by the sender, usualy due to en error to send or due to a transient rejection. public bool MayResend(IMessagingConfiguration config) { return(ResendCount < config.MaxResendCount); }
public MessagingFacility WithConfiguration(IMessagingConfiguration configuration) { m_IsExplicitConfigurationProvided = true; MessagingConfiguration = configuration; return(this); }
public bool IsExpirableMessage(IMessagingConfiguration config) { if (!config.DropExpiredMessages) return false; GrainId id = TargetGrain; if (id == null) return false; // don't set expiration for one way, system target and system grain messages. return Direction != Directions.OneWay && !id.IsSystemTarget && !Constants.IsSystemGrain(id); }
// Resends are used by the sender, usualy due to en error to send or due to a transient rejection. public bool MayResend(IMessagingConfiguration config) { return ResendCount < config.MaxResendCount; }
internal SocketManager(IMessagingConfiguration config) { cache = new LRU<IPEndPoint, Socket>(MAX_SOCKETS, config.MaxSocketAge, SendingSocketCreator); cache.RaiseFlushEvent += FlushHandler; }
internal OutgoingMessageSender(string nameSuffix, IMessagingConfiguration config, SerializationManager serializationManager) : base(nameSuffix, config) { this.serializationManager = serializationManager; }
public virtual void ConfigureSubscribers(IMessagingConfiguration configuration) { }