Ejemplo n.º 1
0
        void Initialize()
        {
            Subscriptions = new Dictionary <string, List <string> >();

            foreach (Uri baseAddress in BaseAddresses)
            {
                if (baseAddress.Scheme != "sb")
                {
                    throw new InvalidOperationException("Can only use 'sb' for base address scheme");
                }

                Type[] contracts = ServiceBusHelper.GetServiceContracts(Description.ServiceType);
                foreach (Type contract in contracts)
                {
                    AddServiceEndpoint(contract, RelayBinding, baseAddress.AbsoluteUri + contract + "/");
                    Subscriptions[contract.Name] = new List <string>();
                }
            }

            IEndpointBehavior selector = new EventSelector(Subscriptions);

            foreach (ServiceEndpoint endpoint in Description.Endpoints)
            {
                endpoint.Behaviors.Add(selector);
            }
        }
Ejemplo n.º 2
0
      void Initialize()
      {
         Subscriptions = new Dictionary<string,List<string>>();        
         
         foreach(Uri baseAddress in BaseAddresses)
         {
            if(baseAddress.Scheme != "sb")
            {
               throw new InvalidOperationException("Can only use 'sb' for base address scheme");
            }

            Type[] contracts = ServiceBusHelper.GetServiceContracts(Description.ServiceType);
            foreach(Type contract in contracts)
            {
               AddServiceEndpoint(contract,RelayBinding,baseAddress.AbsoluteUri + contract + "/");
               Subscriptions[contract.Name] = new List<string>();
            }
         }

         IEndpointBehavior selector = new EventSelector(Subscriptions);

         foreach(ServiceEndpoint endpoint in Description.Endpoints)
         {
            endpoint.Behaviors.Add(selector); 
         }
      }
Ejemplo n.º 3
0
        public Task <IList <IEvent> > FetchStream(Guid streamId, int version = 0, DateTime?timestamp = null)
        {
            var selector = new EventSelector(_schema.Events.As <EventGraph>(), _serializer);
            var handler  = new EventQueryHandler(selector, streamId, version, timestamp);

            return(AddItem(handler));
        }
Ejemplo n.º 4
0
        public IEnumerable <EventDto> GetListEvents(EventSelector selector)
        {
            var _events   = _uow.EventRepository.GetList(selector, includesEvents);
            var eventsDto = _mapper.Map <IEnumerable <EventDto> >(_events);

            return(eventsDto);
        }
Ejemplo n.º 5
0
        public IActionResult GetList(EventSelector selector)
        {
            var a = _eventService.GetListEvents(selector);

            //return Ok();
            return(Ok(_eventService.GetListEvents(selector)));
        }
Ejemplo n.º 6
0
        public Task <IReadOnlyList <IEvent> > FetchStream(Guid streamId, int version = 0, DateTime?timestamp = null)
        {
            var selector = new EventSelector(_store.Events, _store.Serializer);
            var handler  = new EventQueryHandler <Guid>(selector, streamId, version, timestamp, _store.Events.TenancyStyle, _parent.Tenant.TenantId);

            return(AddItem(handler, null));
        }
 private void Start()
 {
     m_CameraFollow    = Camera.main.GetComponent <CameraFollow>();
     m_Bars            = GameObject.FindGameObjectWithTag("Bars").GetComponent <Animator>();
     m_Event           = GameObject.Find("GameManager").GetComponent <EventSelector>();
     m_Active          = false;
     m_CameraSmoothing = m_CameraFollow.m_Smoothing;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Unsubscribes the provided selector, you can only unsubscribe the exact selector you subscribed previously.
        /// </summary>
        /// <param name="selector">The selector.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        public async Task UnsubscribeAsync(EventSelector selector, CancellationToken cancellationToken = default(CancellationToken))
        {
            // connect if not open
            if (_client == null || _client.State != WebSocketState.Open)
            {
                _reset = false;
                await ConnectAndAuthenticateAsync(cancellationToken).ConfigureAwait(false);
            }

            await UnsubscribeNoConnectAsync(selector, cancellationToken).ConfigureAwait(false);
        }
Ejemplo n.º 9
0
        public EventQueryMapping(StoreOptions storeOptions) : base(typeof(IEvent), storeOptions)
        {
            Selector = new EventSelector(storeOptions.Events, storeOptions.Serializer());
            DatabaseSchemaName = storeOptions.Events.DatabaseSchemaName;

            Table = new TableName(DatabaseSchemaName, "mt_events");

            duplicateField(x => x.Sequence, "seq_id");
            duplicateField(x => x.StreamId, "stream_id");
            duplicateField(x => x.Version, "version");
            duplicateField(x => x.Timestamp, "timestamp");
        }
Ejemplo n.º 10
0
        public StagedEventData(StagedEventOptions options, IConnectionFactory factory, EventGraph events,
                               ISerializer serializer)
        {
            _options = options;
            _events  = events;
            _conn    = factory.Create();

            _conn.Open();

            _selector = new EventSelector(events, serializer);
            _map      = new NulloIdentityMap(serializer);

            _sproc = new FunctionName(events.DatabaseSchemaName, "mt_mark_event_progression");
        }
Ejemplo n.º 11
0
        public Fetcher(IDocumentStore store, DaemonSettings settings, AsyncOptions options, IDaemonLogger logger, IDaemonErrorHandler errorHandler, IEnumerable<Type> eventTypes)
        {
            _settings = settings;
            _options = options;
            _logger = logger;
            _errorHandler = errorHandler;
            State = FetcherState.Waiting;

            _connectionFactory = store.Advanced.Options.ConnectionFactory();

            _selector = new EventSelector(store.Schema.Events, store.Advanced.Serializer);
            _map = new NulloIdentityMap(store.Advanced.Serializer);

            EventTypeNames = eventTypes.Select(x => store.Schema.Events.EventMappingFor(x).Alias).ToArray();
        }
Ejemplo n.º 12
0
        public Fetcher(IDocumentStore store, DaemonSettings settings, AsyncOptions options, IDaemonLogger logger, IDaemonErrorHandler errorHandler, IEnumerable <Type> eventTypes)
        {
            _settings     = settings;
            _options      = options;
            _logger       = logger;
            _errorHandler = errorHandler;
            State         = FetcherState.Waiting;

            _connectionFactory = store.Advanced.Options.ConnectionFactory();

            _selector = new EventSelector(store.Schema.Events, store.Advanced.Serializer);
            _map      = new NulloIdentityMap(store.Advanced.Serializer);

            EventTypeNames = eventTypes.Select(x => store.Schema.Events.EventMappingFor(x).Alias).ToArray();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Subscribes to the provided selector.
        /// </summary>
        /// <param name="selector">The subscription selector.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        private async Task SubscribeNoConnectAsync(EventSelector selector, CancellationToken cancellationToken = default(CancellationToken))
        {
            // throw if cancelled
            cancellationToken.ThrowIfCancellationRequested();

            // serialize
            string requestMsg = JsonConvert.SerializeObject(new Message()
            {
                Payload = new SubscribeMessage()
                {
                    Selector = selector.ToString()
                },
                Type      = "Subscribe",
                MessageID = Guid.NewGuid()
            });

            // wait for subscription semaphore
            await _subscriptionSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);

            try {
                // wait for send semaphore
                await _sendSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);

                try {
                    // send to opposing client
                    await _client.SendAsync(new ArraySegment <byte>(Encoding.UTF8.GetBytes(requestMsg)), WebSocketMessageType.Text, true, cancellationToken)
                    .ConfigureAwait(false);

                    // add to subscriptions
                    lock (_subscriptionList)
                        _subscriptionList.Add(selector.ToString());
                } finally {
                    _sendSemaphore.Release();
                }
            } finally {
                _subscriptionSemaphore.Release();
            }
        }
Ejemplo n.º 14
0
        public Fetcher(IDocumentStore store, DaemonSettings settings, AsyncOptions options, IDaemonLogger logger, IDaemonErrorHandler errorHandler, IEnumerable <Type> eventTypes)
        {
            _settings     = settings;
            _options      = options;
            _logger       = logger;
            _errorHandler = errorHandler;
            State         = FetcherState.Waiting;

            // TODO -- this will have to change
            _tenant = store.Tenancy.Default;

            _selector = new EventSelector(store.Events, store.Advanced.Serializer);
            _map      = new NulloIdentityMap(store.Advanced.Serializer);

            EventTypeNames = eventTypes.Select(x => store.Events.EventMappingFor(x).Alias).ToArray();

            _sql =
                $@"
select seq_id from {_selector.Events.DatabaseSchemaName}.mt_events where seq_id > :last and seq_id <= :limit and age(transaction_timestamp(), {_selector.Events.DatabaseSchemaName}.mt_events.timestamp) >= :buffer order by seq_id;
{_selector.ToSelectClause(null)} where seq_id > :last and seq_id <= :limit and type = ANY(:types) and age(transaction_timestamp(), {_selector.Events.DatabaseSchemaName}.mt_events.timestamp) >= :buffer order by seq_id;
select min(seq_id) from {_selector.Events.DatabaseSchemaName}.mt_events where seq_id > :limit and type = ANY(:types) and age(transaction_timestamp(), {_selector.Events.DatabaseSchemaName}.mt_events.timestamp) >= :buffer;
select max(seq_id) from {_selector.Events.DatabaseSchemaName}.mt_events where seq_id >= :limit and age(transaction_timestamp(), {_selector.Events.DatabaseSchemaName}.mt_events.timestamp) >= :buffer
".Replace(" as d", "");
        }
Ejemplo n.º 15
0
 public static EventDelegate GetDelegate(EventSelector eventSelector)
 {
     return(EventDelegates[(int)eventSelector]);
 }
Ejemplo n.º 16
0
 public void init(EventSelector e)
 {
     target = e;
 }
Ejemplo n.º 17
0
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        EventSelector eSel = animator.gameObject.GetComponent <EventSelector>();

        eSel.startCour();
    }
Ejemplo n.º 18
0
 public void SetEventSelector(EventSelector select)
 {
     eventQueue = new Queue <EventSelector>();
     eventQueue.Enqueue(select);
 }