public LuaObject Receive(IMessageQueue queue, int position) { var messageId = queue.ReadInt32(position); var message = this.registry.GetDefinition(messageId); Dictionary<LuaObject, LuaObject> table = new Dictionary<LuaObject, LuaObject>(); foreach (var property in message.Properties) { var key = LuaObject.FromString(property.Name); switch (property.PropertyType) { case PropertyTypes.Int32: table[key] = LuaObject.FromNumber(queue.ReadInt32(position + property.Offset)); break; case PropertyTypes.Single: table[key] = LuaObject.FromNumber(queue.ReadFloat(position + property.Offset)); break; case PropertyTypes.String: table[key] = LuaObject.FromString( ExtensionMethods.ReadStringContent(queue, position + queue.ReadInt32(position + property.Offset))); break; default: throw new NotImplementedException(); } } return LuaObject.FromTable(table); }
public LifxGateway(IMessageQueue messageQueue) : base("Lifx") { _messageQueue = messageQueue; _canCreateDevices = false; _token = ConfigurationManager.AppSettings["lifx.token"]; _localClient.DeviceDiscovered += async (s, e) => { lock (_deviceLock) { var device = _devices.Cast<LifxDevice>().SingleOrDefault(d => d.Id.Equals(e.Id)); if (device == null) { device = new LifxDevice(e); _devices.Add(device); } } await _localClient.GetLightStateAsync(e); }; _localClient.VariableChanged += (s, e) => { var device = _devices.Cast<LifxDevice>().SingleOrDefault(d => d.Id.Equals(e.Item1.Id)); if (device != null) { device.Name = e.Item1.Name; } var variable = $"{Name}.{e.Item1.Id}.{e.Item2}"; _messageQueue.Publish(new UpdateVariableMessage(variable, e.Item3)); }; }
public PluginManagerFactory(ILogger logger, IConfiguration configuration, IMessageQueue messageQueue, IIsolatedEnvironmentFactory isolatedEnvironmentFactory) { _logger = logger; _configuration = configuration; _messageQueue = messageQueue; _isolatedEnvironmentFactory = isolatedEnvironmentFactory; }
public int GetDynamicSize(IMessageQueue queue, LuaObject propertyValue) { if (propertyValue.IsNil) { return queue.GetStringLength(null); } return queue.GetStringLength(propertyValue.AsString()); }
public void CleanUp(IActorRef owner, IMessageQueue deadletters) { Envelope msg; while (TryDequeue(out msg)) // lock gets acquired inside the TryDequeue method { deadletters.Enqueue(owner, msg); } }
public PushalotGateway(IMessageQueue messageQueue) { _messageQueue = messageQueue; Name = "Pushalot"; CanCreateDevices = false; Devices = new List<IDevice>(0); }
public SmsGateway(IMessageQueue messageQueue) { _messageQueue = messageQueue; Name = "SMS"; CanCreateDevices = false; Devices = new List<IDevice>(0); }
public void CleanUp(IActorRef owner, IMessageQueue deadletters) { Envelope msg; while (TryDequeue(out msg)) { deadletters.Enqueue(owner, msg); } }
public NetworkPlayerPortal(IMessageQueue<IncomingGameMessageQueueItem> inQ, IMessageQueue<OutgoingGameMessageQueueItem> outQ, ISerialize iSerializer) { m_qIncomingQueue = inQ; m_qOutgoingQueue = outQ; m_bIsRunning = false; m_slrSerializer = iSerializer; m_tcGameFlow = new ThreadController(false); m_dicStorage = new Dictionary<string, object>(); }
public MyStromDeviceNameService(IMessageQueue messageQueue) { _messageQueue = messageQueue; _username = ConfigurationManager.AppSettings["mystrom.username"]; _password = ConfigurationManager.AppSettings["mystrom.password"]; _recentResultTimestamp = DateTime.MinValue; _recentResult = new Dictionary<string, string>(0); }
public RadioStationController( ITuneInRadioStationService radioStationService, IFavoriteRadioStationService favoriteRadioStationService, IMessageQueue messageQueue) { _radioStationService = radioStationService; _favoriteRadioStationService = favoriteRadioStationService; _messageQueue = messageQueue; }
/// <summary> /// Copy message to other message queue. /// </summary> /// <param name="messageQueue">Soutce queue.</param> /// <param name="position">Position at source queue. Should be valid postion returned by messageQueue.ReadMessage()</param> /// <param name="destinationQueue">Destination queue.</param> public static void CopyTo(this IMessageQueue messageQueue, int position, IMessageQueue destinationQueue) { var len = messageQueue.GetSize(position); var targetPosition = destinationQueue.Allocate(len); for (int i = 0; i < len; ++i) { destinationQueue.WriteInt32(targetPosition + i, messageQueue.ReadInt32(i + position)); } destinationQueue.Commit(len); }
public MessageQueueListener(IMessageQueue queue) : base("MessageQueueListener") { if(queue == null) throw new ArgumentNullException("queue"); _queue = queue; if(!string.IsNullOrWhiteSpace(queue.Name)) base.Name = queue.Name; }
public ZwaveGateway(IMessageQueue messageQueue, IList<ICommandClassHandler> commandClassHandlers) : base("zwave") { _messageQueue = messageQueue; _commandClassHandlers = commandClassHandlers; _canCreateDevices = false; _comPortName = ConfigurationManager.AppSettings["zwave.port"]; _library = new ZwaveDeviceLibrary(); _nodeCommandQueues = new Dictionary<byte, ZwaveCommandQueue>(); }
public MyStromGateway( IMessageQueue messageQueue, IMyStromDeviceNameService myStromDeviceNameService, IUpnpDeviceDiscoveringService upnpDeviceDiscoveringService) : base("myStrom") { _messageQueue = messageQueue; _myStromDeviceNameService = myStromDeviceNameService; _upnpDeviceDiscoveringService = upnpDeviceDiscoveringService; _canCreateDevices = false; _upnpDeviceDiscoveringService.DeviceFound += OnUpnpDeviceFound; }
public void Start(string id, IMessageQueue queue) { var suffix = Guid.NewGuid().ToString(); PipelinePack pipelines = intelligenceManager.ComposePipeline(id, Name); var task1 = Task.Factory.StartNew(() => { RegisterStream(queue, pipelines.OfflinePipeline, id + "-offline-" + suffix, id); }); var task2 = Task.Factory.StartNew(() => { RegisterStream(queue, pipelines.OnlinePipeline, id + "-online-" + suffix, id); }); var task3 = Task.Factory.StartNew(() => { RegisterStream(queue, pipelines.DatabasePipeline, id + "-database-" + suffix, id); }); Task.WaitAll(task1, task2, task3); }
public ImageService( IBinaryRepository binaryRepository, [Dependency("images")] IMessageQueue imageQueue, [Dependency("complete")] IMessageQueue completeQueue ) { _binaryRepository = binaryRepository; _imageQueue = imageQueue; _completeQueue = completeQueue; InitializeComponent(); }
public void Send(IMessageQueue queue, LuaObject luaObject) { var id = (int)luaObject[LuaObject.FromString("MessageId")].AsNumber(); var message = this.registry.GetDefinition(id); var table = luaObject.AsTable(); int dynamicSize = 0; int foundProperties = 0; foreach (var property in message.Properties) { var serializer = this.luaTypeRegistry.GetSerializer(property.PropertyType); LuaObject propertyValue; if (table.TryGetValue(LuaObject.FromString(property.Name), out propertyValue)) { ++foundProperties; } dynamicSize += serializer.GetDynamicSize(queue, propertyValue); } var position = queue.Allocate(message.MinSize + dynamicSize); foreach (var keyValue in table) { var keyObject = keyValue.Key; int propertyKey = 0; if (keyObject.IsNumber) { propertyKey = (int)keyObject.AsNumber(); } else { propertyKey = Hash.Eval(keyObject.AsString()); } var property = message.GetPropertyById(propertyKey); switch (property.PropertyType) { case PropertyTypes.Int32: queue.WriteInt32(position + property.Offset, (int)keyValue.Value.AsNumber()); break; case PropertyTypes.Single: queue.WriteFloat(position + property.Offset, (float)keyValue.Value.AsNumber()); break; case PropertyTypes.String: queue.WriteInt32(position + property.Offset, message.MinSize); queue.WriteStringContent(position + message.MinSize, keyValue.Value.AsString()); break; default: throw new NotImplementedException(); } } queue.Commit(position); }
public void Start(string id, IMessageQueue queue) { var suffix = Guid.NewGuid().ToString(); var pipeline = new StreamPipeline(); pipeline.Register(new MeanPredictionFilter()); pipeline.Register(new ResultOutputFilter(repository) { MeasurementId = id, ForecastModelId = name }); var task1 = Task.Factory.StartNew(() => { RegisterStream(queue, pipeline, id + "-online-" + suffix, id); }); Task.WaitAll(task1); }
public PhilipsHueBridgeDiscoveringService( IMessageQueue messageQueue, IVariableRepository variableRepository, IUpnpDeviceDiscoveringService upnpDeviceDiscoveringService) { _lock = new object(); _bridges = new Dictionary<string, PhilipsHueBridge>(StringComparer.OrdinalIgnoreCase); _messageQueue = messageQueue; _variableRepository = variableRepository; _upnpDeviceDiscoveringService = upnpDeviceDiscoveringService; _upnpDeviceDiscoveringService.DeviceFound += OnUpnpDeviceFound; }
public UploadController( IImageRepository imageRepository, IBinaryRepository binaryRepository, [Dependency("Image")] IMessageQueue messageQueue, FileUploaderAdapter adapter ) { ActionInvoker = new ActionInvokers.ActionInvoker(); _imageRepository = imageRepository; _binaryRepository = binaryRepository; _messageQueue = messageQueue; _adapter = adapter; }
public SurveyAnswerStore( ITenantStore tenantStore, ISurveyAnswerContainerFactory surveyAnswerContainerFactory, IMessageQueue<SurveyAnswerStoredMessage> standardSurveyAnswerStoredQueue, IMessageQueue<SurveyAnswerStoredMessage> premiumSurveyAnswerStoredQueue, IBlobContainer<List<string>> surveyAnswerIdsListContainer) { Trace.WriteLine(string.Format("Called constructor in SurveyAnswerStore"), "UNITY"); this.tenantStore = tenantStore; this.surveyAnswerContainerFactory = surveyAnswerContainerFactory; this.standardSurveyAnswerStoredQueue = standardSurveyAnswerStoredQueue; this.premiumSurveyAnswerStoredQueue = premiumSurveyAnswerStoredQueue; this.surveyAnswerIdsListContainer = surveyAnswerIdsListContainer; }
public ForecastGateway(IMessageQueue messageQueue) : base("Weather") { _messageQueue = messageQueue; _apiKey = ConfigurationManager.AppSettings["forecast.apikey"]; _canCreateDevices = true; _policy = Policy .Handle<WebException>() .WaitAndRetry(new[] { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5) }); }
public SystemInformationMessageQueueFeeder(ISystemInformationProvider systemInformationProvider, IMessageQueue<SystemInformation> workQueue) { if (systemInformationProvider == null) { throw new ArgumentNullException("systemInformationProvider"); } if (workQueue == null) { throw new ArgumentNullException("workQueue"); } this.systemInformationProvider = systemInformationProvider; this.workQueue = workQueue; }
public NetatmoGateway(IMessageQueue messageQueue) : base("Netatmo") { _messageQueue = messageQueue; _clientId = ConfigurationManager.AppSettings["netatmo.clientid"]; _clientSecret = ConfigurationManager.AppSettings["netatmo.clientsecret"]; _username = ConfigurationManager.AppSettings["netatmo.username"]; _password = ConfigurationManager.AppSettings["netatmo.password"]; _isValidConfiguration = !string.IsNullOrEmpty(_clientId) && !string.IsNullOrEmpty(_clientSecret) && !string.IsNullOrEmpty(_username) && !string.IsNullOrEmpty(_password); _canCreateDevices = false; }
protected void Application_Start() { InitializeContainer(); ControllerBuilder.Current.SetControllerFactory(typeof(ControllerFactory)); RegisterRoutes(RouteTable.Routes); _completeQueue = _container.Resolve<IMessageQueue>("Complete"); _pollingThread = new Thread(CompletePolling); var repositories = new Repositories { BinaryRepository = _container.Resolve<IBinaryRepository>(), ImageRepository = _container.Resolve<IImageRepository>() }; _pollingThread.Start(repositories); }
private static void RunTest(string desc, IMessageQueue queue) { _received = 0; _evt.Reset(); using (queue) { queue.StartConsuming(); var sw = Stopwatch.StartNew(); for (int i = 0; i < TIMES; i++) { queue.Publish(i.ToString()); } _evt.WaitOne(); Console.WriteLine(desc + ": " + sw.Elapsed); } }
private void RegisterStream(IMessageQueue messageQueue, StreamPipeline pipeline, string pipelineName, string id) { while (true) { try { var units = messageQueue.Dequeue(id, pipelineName); pipeline.Execute(units); } catch (EndOfStreamException) { Console.WriteLine("End of stream"); break; } catch (Exception ex) { Logging.Debug(ex.ToString()); throw; } } }
public SystemInformationMessageQueueWorker(ISystemInformationSender systemInformationSender, IMessageQueue<SystemInformation> workQueue, IMessageQueue<SystemInformation> errorQueue) { if (systemInformationSender == null) { throw new ArgumentNullException("systemInformationSender"); } if (workQueue == null) { throw new ArgumentNullException("workQueue"); } if (errorQueue == null) { throw new ArgumentNullException("errorQueue"); } this.systemInformationSender = systemInformationSender; this.workQueue = workQueue; this.errorQueue = errorQueue; }
public PluginManager(ILogger logger, IConfiguration configuration, IMessageQueue messageQueue, IDirectory baseDirectory, IIsolatedEnvironment environment, IPackage package) { ErrorCount = 0; if (logger == null) throw new ArgumentNullException("logger"); if (configuration == null) throw new ArgumentNullException("configuration"); if (baseDirectory == null) throw new ArgumentNullException("baseDirectory"); if (environment == null) throw new ArgumentNullException("environment"); if (package == null) throw new ArgumentNullException("package"); State = PluginState.Unloaded; _logger = logger; _configuration = configuration; _messageQueue = messageQueue; _baseDirectory = baseDirectory; _isolatedEnvironment = environment; _package = package; _lazyManifest = new Lazy<IManifest>(_package.GetManifest); _isolatedEnvironment.UnhandledError += OnUnhandledError; }
public static async Task PublishAsBytesAsync(this IMessageQueue messageQueue, string queue, object message) { var bytes = message.ToBytes(); await messageQueue.PublishAsync(queue, bytes); }
public CnblogsSpider(IDynamicMessageQueue dmq, IMessageQueue mq, IStatisticsService statisticsService, ISpiderOptions options, ILogger <Spider> logger, IServiceProvider services) : base(dmq, mq, statisticsService, options, logger, services) { }
public DequeuedCleanupJob(IMessageQueue <TWorkItem> workItemQueue, ILogger <DequeuedCleanupJob <TWorkItem> > logger, IConfiguration configuration) { _workItemQueue = workItemQueue ?? throw new ArgumentNullException(nameof(workItemQueue)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); }
public ImparterChannel(IMessageQueue messageQueue) { _messageQueue = messageQueue; }
public MessageEntrance(IMessageQueue messageQueueIn) { this.messageQueueIn = messageQueueIn; SiteToSiteMessages = new Queue <PlatformMessage>(); }
public WebHookController(IWebHookService webHookService, IMessageQueue messageQueue) { _webHookService = webHookService; _messageQueue = messageQueue; }
/// <summary> /// Creates a new instance of <see cref="SaveReportHandler" />. /// </summary> /// <param name="queue">Queue to store inbound reports in</param> /// <exception cref="ArgumentNullException">queueProvider;connectionFactory</exception> public SaveReportHandler(IMessageQueue queue, IAdoNetUnitOfWork unitOfWork, IReportConfig reportConfig) { _unitOfWork = unitOfWork; _queue = queue ?? throw new ArgumentNullException(nameof(queue)); _maxSizeForJsonErrorReport = reportConfig.MaxReportJsonSize; }
public HjTcpNetwork(int maxBytesOnceSent = 1024 * 100, int maxReceiveBuffer = 1024 * 512) : base(maxBytesOnceSent, maxReceiveBuffer) { mSendSemaphore = new HjSemaphore(); mSendMsgQueue = new MessageQueue(); }
public GithubSpider(IMessageQueue mq, IStatisticsService statisticsService, ISpiderOptions options, ILogger <Spider> logger, IServiceProvider services) : base(mq, statisticsService, options, logger, services) { }
/// <summary> /// Initializes a new instance of the <see cref="UpdateDailyMiningHyconHandler"/> class. /// </summary> /// <param name="repository">Aggregate repository</param> /// <param name="addressHandler">Address info handler</param> /// <param name="messageQueue">Messaging service</param> /// <param name="handler">JSON handler</param> /// <param name="mineHandler">Modify balance handler</param> /// <param name="blockListV2Handler">JSON block list handler</param> /// <param name="blockInfoV2Handler">JSON block info handler</param> /// <param name="log">Log service</param> public UpdateDailyMiningHyconHandler(IEsRepository <IAggregate> repository, ICommandHandler <RequestJson <AddressInfo> > addressHandler, IMessageQueue messageQueue, ICommandHandler <RequestJson <MinedResults> > handler, ICommandHandler <RetroactiveCommand <MineCoin> > mineHandler, ICommandHandler <RequestJson <BlockListV2> > blockListV2Handler, ICommandHandler <RequestJson <BlockInfoV2> > blockInfoV2Handler, ILog log) : base(repository, mineHandler) { _addressHandler = addressHandler; _messageQueue = messageQueue; _handler = handler; _blockListV2Handler = blockListV2Handler; _blockInfoV2Handler = blockInfoV2Handler; _log = log; }
/// <summary> /// Creates a new mailbox /// </summary> /// <param name="messageQueue">The <see cref="IMessageQueue"/> used by this mailbox.</param> public Mailbox(IMessageQueue messageQueue) { MessageQueue = messageQueue; }
public SlackController(IMessageQueue messageQueue) { _messageQueue = messageQueue; _slackRequestValidator = new SlackRequestValidator(); }
/// <summary> /// 构造方法 /// </summary> /// <param name="mq">消息队列</param> /// <param name="downloaderAgentStore">下载器代理存储</param> /// <param name="options">系统选项</param> /// <param name="logger">日志接口</param> public DownloadCenter(IDynamicMessageQueue dmq, IMessageQueue mq, IDownloaderAgentStore downloaderAgentStore, ISpiderOptions options, ILogger logger) : base(dmq, mq, downloaderAgentStore, options, logger) { }
/// <summary> /// Initializes a new instance of the <see cref="MsmqChannelController"/> class. /// </summary> /// <param name="queue">The queue.</param> internal MsmqChannelController(IMessageQueue queue) { _queue = queue; }
public AudioEncoder() { log = ServiceScope.Get <ILogger>(); queue = ServiceScope.Get <IMessageBroker>().GetOrCreate("encoding"); msg = new QueueMessage(); }
internal MessageQueue(IMessageQueue delegateQueue) { this.delegateQueue = delegateQueue; formatter = new XmlMessageFormatter(); delegateQueue.PeekCompleted += new CompletedEventHandler(DelegatePeekCompleted); }
public MQTTDecoderSnowdepth(IMessageQueue messageQueue, IContextBrokerProxy contextBroker) { _fiwareContextBroker = contextBroker; _messageQueue = messageQueue; }
public void ProcessNext(TState state, IMessageQueue queue) => Process(_queue.Dequeue(), state);
public StuffDragManager(string request, IImmutableList <StuffId> stuff, IMessageQueue queue) : base(request) { Stuff = stuff; _queue = queue; }
public MessageQueueFixture(IMessageQueue queue) { _queue = queue; }
public ActionDragManager(string request, IImmutableList <ImmutableAction> action, IMessageQueue queue) : base(request) { _actions = action; _queue = queue; }
/// <summary> /// TBD /// </summary> /// <param name="owner">TBD</param> /// <param name="deadletters">TBD</param> public void CleanUp(IActorRef owner, IMessageQueue deadletters) { // do nothing }
public void Setup() { _queue = new Mock <IMessageQueue>().Object; }
/// <summary> /// Initializes a new instance of the <see cref="GlobalProjection{TState}"/> class. /// </summary> /// <param name="eventStore">Event store service</param> /// <param name="log">Log service</param> /// <param name="activeTimeline">Timeline service</param> /// <param name="messageQueue">Message queue service</param> /// <param name="streamLocator">Stream locator</param> public GlobalProjection(IEventStore <IAggregate> eventStore, ILog log, ITimeline activeTimeline, IMessageQueue messageQueue, IStreamLocator streamLocator) : base(eventStore, log, activeTimeline, streamLocator) { InvalidateSubscription = new LazySubscription(() => messageQueue.Alerts.OfType <InvalidateProjections>() .Throttle(Configuration.Throttle) .Subscribe(Build.InputBlock.AsObserver())); }
public AutoInputHint_BotToUser(IBotToUser inner, IMessageQueue queue) { SetField.NotNull(out this.queue, nameof(queue), queue); SetField.NotNull(out this.inner, nameof(inner), inner); }
/// <summary> /// Initializes a new instance of the <see cref="Remote"/> class. /// </summary> /// <param name="localStore">Local stream store</param> /// <param name="remoteStore">Target remote</param> /// <param name="log">Log helper</param> /// <param name="messageQueue">Message queue</param> /// <param name="serializer">Serializer</param> public Remote(IStreamStore localStore, [Remote] IStreamStore remoteStore, ILog log, IMessageQueue messageQueue, ISerializer <IEvent> serializer) { _localStore = localStore; _remoteStore = remoteStore; _log = log; _messageQueue = messageQueue; _serializer = serializer; }
public MessageQueueFixture(IMessageQueue queue, bool isFifo) { _queue = queue; _isFifo = isFifo; }
public SlackBot(string apiKey) { _msgQueue = new MessageQueue(); _apiKey = apiKey; }
public Mailer(IMessageQueue messageQueue) { _messageQueue = messageQueue ?? throw new ArgumentNullException(nameof(messageQueue)); }
/// <summary> /// 依赖于消息队列的事件模块 /// </summary> /// <param name="queueName">队列名称</param> /// <param name="messageQueue">消息队列实现类</param> public MessageEvent(string queueName, IMessageQueue messageQueue) { QueueName = queueName; MessageQueue = messageQueue; }