Beispiel #1
0
        public void HandleScoreEvent(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv("gameSessionId", "score");

            _blobOutputManager.QueueAppendToBlob(data, serializedGameEvent);
            //_eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #2
0
        public void HandleStopEvent(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv("eventCorrelationId");

            _blobOutputManager.QueueAppendToBlob(data, serializedGameEvent);
            //_eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #3
0
        public void HandleGenericEvent(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv();

            _blobOutputManager.QueueAppendToBlob(data, serializedGameEvent);
            //_eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #4
0
        //TODO: Fix Game Event Handlers to use reflection over properties if possible
        //TODO: Enrich events with knows facts, such as location on heartbeats, etc.
        public void HandleCountEvent(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv("displayName", "value", "gameSessionId");

            _blobOutputManager.QueueAppendToBlob(data, serializedGameEvent);
            _eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #5
0
        public async Task HandleGenericEventAsync(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv();

            await _blobOutputManager.QueueAppendToBlobAsync(data, serializedGameEvent);

            //_eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #6
0
        public async Task HandleGameStartEventAsync(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv("gameSessionId", "gamerTag");

            await _blobOutputManager.QueueAppendToBlobAsync(data, serializedGameEvent);

            //_eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #7
0
        //TODO: Fix Game Event Handlers to use reflection over properties if possible
        //TODO: Enrich events with knows facts, such as location on heartbeats, etc.
        public async Task HandleCountEventAsync(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv("displayName", "value", "gameSessionId");

            await _blobOutputManager.QueueAppendToBlobAsync(data, serializedGameEvent);

            await _eventHubOutputManager.SendToEventHubAsync(data, serializedGameEvent);
        }
Beispiel #8
0
        public async Task HandleStopEventAsync(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv("eventCorrelationId");

            await _blobOutputManager.QueueAppendToBlobAsync(data, serializedGameEvent);

            //_eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #9
0
        public void HandleLocationEvent(GameEventData data)
        {
            //TODO: Implement more properties on Location Event
            var serializedGameEvent = data.ToCsv("gameSessionId");

            _blobOutputManager.QueueAppendToBlob(data, serializedGameEvent);
            //_eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #10
0
        public async Task HandleLocationEventAsync(GameEventData data)
        {
            const int GeoHashBitPrecision = 32;                //bits
            const int LocationLookupGeoHashBitPrecistion = 30; //bits

            var inEvent = JsonConvert.DeserializeObject <IncommingLocationEvent>(data.Data);

            var geoHash = GeoHash.EncodeInt(inEvent.Lat, inEvent.Lon, GeoHashBitPrecision);
            var geoHashCenterCoordinates = GeoHash.DecodeInt(geoHash, GeoHashBitPrecision).Coordinates;
            var locationLookupGeoHash    = GeoHash.EncodeInt(inEvent.Lat, inEvent.Lon, LocationLookupGeoHashBitPrecistion);

            var l        = new LocationEventHandler(_locationLookupProvider);
            var location = l.LookupGeoHash(locationLookupGeoHash, LocationLookupGeoHashBitPrecistion);

            var outEvent = new OutgoingLocationEvent
            {
                EnqueueTime      = data.EnqueuedTime,
                DequeueTime      = data.DequeuedTime,
                ClientUtcTime    = inEvent.ClientUtcTime,
                GameSessionId    = inEvent.GameSessionId,
                Lat              = inEvent.Lat,
                Lon              = inEvent.Lon,
                GeoHash          = geoHash,
                GeoHashPrecision = GeoHashBitPrecision,
                GeoHashCenterLat = geoHashCenterCoordinates.Lat,
                GeoHashCenterLon = geoHashCenterCoordinates.Lon,
                Country          = location.Country,
                District         = location.District,
                City             = location.City,
                Properties       = inEvent.Properties
            };

            //TODO: Optimize this so we don't serialize back to JSON first and then to CSV

            var jsonObject = JsonConvert.SerializeObject(
                outEvent,
                Formatting.Indented,
                new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            });

            data.Data = jsonObject;

            var csvObject = data.ToCsv("gameSessionId", "lat", "lon",
                                       "geoHash", "geoHashPrecision",
                                       "geoHashCenterLat", "geoHashCenterLon", "country", "district", "city");

            // Output CSV to BLOB Storage and JSON to StreamAnalytics (via EventHub)
            await _blobOutputManager.QueueAppendToBlobAsync(data, csvObject);

            await _eventHubOutputManager.SendToEventHubAsync(data, jsonObject);
        }
Beispiel #11
0
        public void HandleLocationEvent(GameEventData data)
        {
            var locationEvent = JsonConvert.DeserializeObject <LocationEvent>(data.Data);

            var geoHash = GeoHash.Encode(locationEvent.Latitude, locationEvent.Longitude);

            locationEvent.Geohash = geoHash;

            //TODO: Optimize this so we don't serialize back to JSON first and then to CSV

            data.Data = JsonConvert.SerializeObject(
                locationEvent,
                Formatting.Indented,
                new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            });

            var serializedGameEvent = data.ToCsv("gameSessionId", "longitude", "latitude", "geohash");

            _blobOutputManager.QueueAppendToBlob(data, serializedGameEvent);
            _eventHubOutputManager.SendToEventHub(data, serializedGameEvent);
        }
Beispiel #12
0
        public async Task HandleLevelStartEventAsync(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv("gameSessionId", "level");

            await _blobOutputManager.QueueAppendToBlobAsync(data, serializedGameEvent);
        }
Beispiel #13
0
        public void HandleLevelStartEvent(GameEventData data)
        {
            var serializedGameEvent = data.ToCsv("gameSessionId", "level");

            _blobOutputManager.QueueAppendToBlob(data, serializedGameEvent);
        }