Exemple #1
0
        /// <summary>
        /// Handle a GetVehicleInfo message.
        /// </summary>
        /// <param name="msg">The message to process.</param>
        private void Handle(GetVehicleInfo msg)
        {
            // simulate web-service call
            VehicleInfoAvailable info = new VehicleInfoAvailable(msg.VehicleId, GetRandomBrand(), GetRandomColor());

            Sender.Tell(info);
        }
Exemple #2
0
 internal void Handle(GetVehicleInfo input) {
    using (var dbConn = DatabaseManager.DbConn()) {
       var vi = dbConn.ExecuteBpl(new VehicleGetById { VehicleId = input.VehicleId });
       if (vi.NotNull()) {
          Reply(vi.VehicleInfo);
       } else {
          Reply(null);
       }
    }
 }
Exemple #3
0
        /// <summary>
        /// Handle a GetVehicleInfo message.
        /// </summary>
        /// <param name="msg">The message to process.</param>
        private void Handle(GetVehicleInfo msg)
        {
            // simulate web-service call ...

            // create event
            string brand = GetRandomBrand();
            string color = GetRandomColor();
            VehicleInfoAvailable info =
                new VehicleInfoAvailable(msg.VehicleId, brand, color);

            // send response to sender
            Sender.Tell(info);
        }
Exemple #4
0
      internal void Handle(GetVehicleInfo input) {
         Log.Trace("Request vehicle info from BP");

         // TODO: this is hardcoded for IL, need to rewrite either to use IL/DK RV bus, or global bus
         if (TibcoBroker.TibcoRvIl != null) {
            TibcoBroker.TibcoRvIl.Send(new S.VehicleInfoRequest { VehicleId = input.VehicleId }, (S.VehicleInfoResponse r) => {
               Reply(_getVehicleInfo(r));
            }, e => {
               Log.Warn("Unable to get vehicle information {0}", e);
               Throw(GeneralFailureCode.ServiceUnavailable);
            });
         }
      }
Exemple #5
0
        private void Handle(GetVehicleInfo message)
        {
            switch (message.Registration)
            {
            case "1S32456":
                Sender.Tell(new VehicleInfoAvailable("bílé", "Škoda Octavia"));
                break;

            case "1S81519":
                Sender.Tell(new VehicleInfoAvailable("červené", "BMW E3"));
                break;

            case "2U65487":
                Sender.Tell(new VehicleInfoAvailable("černé", "Audi A8"));
                break;
            }
        }
Exemple #6
0
 public void RequestVehicleInfo(BplIdentity vehicleId) {
    var info = new GetVehicleInfo { VehicleId = vehicleId };
    var server = (OscarServer)(OscarServer.Current);
    Forward(info, _onSuccess, _onFailure);
 }