Ejemplo n.º 1
0
 public ActionResult <string> Subscribe([FromBody] DatafeedAction datafeedAction)
 {
     if (_generatorService.Subscribe(datafeedAction.MarketId, datafeedAction.SessionId))
     {
         return(Ok("OK"));
     }
     return(Ok("Wrong"));
 }
Ejemplo n.º 2
0
        public async Task <bool> UnsubscribeMarketAsync(DatafeedAction datafeedAction)
        {
            try
            {
                string result = await PostAsync <DatafeedAction, string>("api/market-updates/unsubscribe", datafeedAction);

                return(result == "OK");
            }
            catch (Exception e)
            {
                return(false);
            };
        }
Ejemplo n.º 3
0
        private async Task UnsubscribeDatafeed(MessageHandler messageHandler)
        {
            DatafeedAction datafeedAction = new DatafeedAction(messageHandler.MarketId, _sessionId);

            try
            {
                if (await _datafeedHttpService.UnsubscribeMarketAsync(datafeedAction))
                {
                    _logger.LogInformation("UnsubscribeDatafeedAsync marketId={0} result=true", messageHandler.MarketId);
                }
                else
                {
                    _logger.LogInformation("UnsubscribeDatafeedAsync marketId={0} result=false", messageHandler.MarketId);
                }
            }
            catch { }
            _messageBus.Unsubscribe <MarketUpdateDtoI, MessageHandler>(_exchangeName, "Update:" + messageHandler.MarketId.ToString());
        }
Ejemplo n.º 4
0
        private async Task SubscribeDatafeedAsync(MessageHandler messageHandler)
        {
            DatafeedAction datafeedAction = new DatafeedAction(messageHandler.MarketId, _sessionId);

            try
            {
                await _datafeedHttpService.SubscribeMarketAsync(datafeedAction);

                // {
                //_logger.LogInformation("SubscribeDatafeedAsync marketId={0} result=true", messageHandler.MarketId);
                //  }
                //else
                //  {
                // _logger.LogInformation("SubscribeDatafeedAsync marketId={0} result=false", messageHandler.MarketId);
                // }
            }
            catch (Exception e)
            { }

            _messageBus.Subscribe <MarketUpdateDtoI, MessageHandler>(messageHandler, _exchangeName, RabbitExchangeType.DirectExchange, $"Update:{messageHandler.MarketId}", false);
        }