예제 #1
0
        public static void FireEvent(string jsonMessage)
        {
            try
            {
                logger.Debug("eventReceived");
                Dictionary <string, object> jsonDict = Json.Deserialize(jsonMessage) as Dictionary <string, object>;
                string eventId = jsonDict["eventId"] as string;
                Dictionary <string, object> response = null;

                if (jsonDict.ContainsKey("response"))
                {
                    response = jsonDict["response"] as Dictionary <string, object>;
                    Jsonable.CheckForErrors(response);
                }

                lock (eventLock)
                {
                    foreach (var delegator in eventListeners[eventId])
                    {
                        if (response != null)
                        {
                            delegator.ExecuteSuccess(response);
                        }
                        else
                        {
                            delegator.ExecuteSuccess();
                        }
                    }
                }
            }
            catch (AmazonException e)
            {
                logger.Debug("Event call threw exception: " + e.ToString());
            }
        }
예제 #2
0
        private static void callbackCaller(Dictionary <string, object> response, string callerId)
        {
            IDelegator delegator = null;

            try
            {
                Jsonable.CheckForErrors(response);

                lock (AmazonIapV2Impl.callbackLock)
                {
                    delegator = AmazonIapV2Impl.callbackDictionary[callerId];
                    AmazonIapV2Impl.callbackDictionary.Remove(callerId);

                    delegator.ExecuteSuccess(response);
                }
            }
            catch (AmazonException e)
            {
                lock (AmazonIapV2Impl.callbackLock)
                {
                    if (delegator == null)
                    {
                        delegator = AmazonIapV2Impl.callbackDictionary[callerId];
                    }
                    AmazonIapV2Impl.callbackDictionary.Remove(callerId);

                    delegator.ExecuteError(e);
                }
            }
        }
예제 #3
0
 public static ResetInput CreateFromJson(string jsonMessage)
 {
     try
     {
         Dictionary <string, object> jsonMap = Json.Deserialize(jsonMessage) as Dictionary <string, object>;
         Jsonable.CheckForErrors(jsonMap);
         return(CreateFromDictionary(jsonMap));
     }
     catch (System.ApplicationException ex)
     {
         throw new AmazonException("Error encountered while UnJsoning", ex);
     }
 }
예제 #4
0
 public override void NotifyFulfillment(NotifyFulfillmentInput notifyFulfillmentInput)
 {
     Start();
     Jsonable.CheckForErrors(Json.Deserialize(NotifyFulfillmentJson(notifyFulfillmentInput.ToJson())) as Dictionary <string, object>);
 }