/// <summary>
 /// ResetJWTSecretKey -
 /// </summary>
 public Task ResetJWTSecretKey(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT)
 {
     return(this.SendMessage("crudcoordinator.general.crudcoordinator.resetjwtsecretkey", payload, replyHandler, timeoutHandler, waitTimeout));
 }
        protected virtual void OnCRUDCoordinatorResetRabbitSassyMQConfigurationReceived(StandardPayload payload, BasicDeliverEventArgs bdea)
        {
            var plea = new PayloadEventArgs(payload, bdea);

            if (!ReferenceEquals(this.CRUDCoordinatorResetRabbitSassyMQConfigurationReceived, null))
            {
                plea.Payload.IsHandled = true;
                this.CRUDCoordinatorResetRabbitSassyMQConfigurationReceived(this, plea);
            }
        }
 /// <summary>
 /// ResetRabbitSassyMQConfiguration -
 /// </summary>
 public Task ResetRabbitSassyMQConfiguration(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT)
 {
     return(this.SendMessage("crudcoordinator.general.crudcoordinator.resetrabbitsassymqconfiguration", payload, replyHandler, timeoutHandler, waitTimeout));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// ValidateTemporaryAccessToken -
 /// </summary>
 public Task ValidateTemporaryAccessToken(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT)
 {
     return(this.SendMessage("crudcoordinator.general.guest.validatetemporaryaccesstoken", payload, replyHandler, timeoutHandler, waitTimeout));
 }
        protected override void CheckRouting(StandardPayload payload, BasicDeliverEventArgs bdea)
        {
            var originalAccessToken = payload.AccessToken;

            try
            {
                switch (bdea.RoutingKey)
                {
                case "crudcoordinator.general.guest.requesttoken":
                    this.OnGuestRequestTokenReceived(payload, bdea);
                    break;

                case "crudcoordinator.general.guest.validatetemporaryaccesstoken":
                    this.OnGuestValidateTemporaryAccessTokenReceived(payload, bdea);
                    break;

                case "crudcoordinator.general.guest.whoami":
                    this.OnGuestWhoAmIReceived(payload, bdea);
                    break;

                case "crudcoordinator.general.guest.whoareyou":
                    this.OnGuestWhoAreYouReceived(payload, bdea);
                    break;

                case "crudcoordinator.utlity.guest.storetempfile":
                    this.OnGuestStoreTempFileReceived(payload, bdea);
                    break;

                case "crudcoordinator.general.crudcoordinator.resetrabbitsassymqconfiguration":
                    this.OnCRUDCoordinatorResetRabbitSassyMQConfigurationReceived(payload, bdea);
                    break;

                case "crudcoordinator.general.crudcoordinator.resetjwtsecretkey":
                    this.OnCRUDCoordinatorResetJWTSecretKeyReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.guest.getportfolios":
                    this.OnGuestGetPortfoliosReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.admin.addportfolio":
                    this.OnAdminAddPortfolioReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.admin.getportfolios":
                    this.OnAdminGetPortfoliosReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.admin.updateportfolio":
                    this.OnAdminUpdatePortfolioReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.admin.deleteportfolio":
                    this.OnAdminDeletePortfolioReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.user.addportfolio":
                    this.OnUserAddPortfolioReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.user.getportfolios":
                    this.OnUserGetPortfoliosReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.user.updateportfolio":
                    this.OnUserUpdatePortfolioReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.user.deleteportfolio":
                    this.OnUserDeletePortfolioReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.admin.addappuser":
                    this.OnAdminAddAppUserReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.admin.getappusers":
                    this.OnAdminGetAppUsersReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.admin.updateappuser":
                    this.OnAdminUpdateAppUserReceived(payload, bdea);
                    break;

                case "crudcoordinator.crud.admin.deleteappuser":
                    this.OnAdminDeleteAppUserReceived(payload, bdea);
                    break;
                }
            }
            catch (Exception ex)
            {
                payload.ErrorMessage = ex.Message;
            }
            var reply = payload.ReplyPayload is null ? payload  : payload.ReplyPayload;

            reply.IsHandled = payload.IsHandled;
            if (reply.AccessToken == originalAccessToken)
            {
                reply.AccessToken = null;
            }
            this.Reply(reply, bdea.BasicProperties);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// GetPortfolios -
 /// </summary>
 public Task GetPortfolios(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT)
 {
     return(this.SendMessage("crudcoordinator.crud.guest.getportfolios", payload, replyHandler, timeoutHandler, waitTimeout));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// RequestToken -
 /// </summary>
 public Task RequestToken(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT)
 {
     return(this.SendMessage("crudcoordinator.general.guest.requesttoken", payload, replyHandler, timeoutHandler, waitTimeout));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// WhoAreYou -
 /// </summary>
 public Task WhoAreYou(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT)
 {
     return(this.SendMessage("crudcoordinator.general.guest.whoareyou", payload, replyHandler, timeoutHandler, waitTimeout));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// StoreTempFile -
 /// </summary>
 public Task StoreTempFile(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT)
 {
     return(this.SendMessage("crudcoordinator.utlity.guest.storetempfile", payload, replyHandler, timeoutHandler, waitTimeout));
 }
 public void CheckPayload(StandardPayload payload)
 {
     payload.SenderId   = this.SenderId.ToString();
     payload.SenderName = this.SenderName;
     payload.PayloadId  = Guid.NewGuid().ToString();
 }
 protected abstract void CheckRouting(StandardPayload payload, BasicDeliverEventArgs bdea);
        private void ConnectAndMonitor()
        {
            this.MonitorTask = new Task(() =>
            {
                var count                  = 0;
                var subscription           = new Subscription(RMQChannel, QueueName);
                BasicDeliverEventArgs bdea = default(BasicDeliverEventArgs);
                while (this.RMQChannel.IsOpen)
                {
                    var gotMessage = subscription.Next(100, out bdea);
                    if (gotMessage)
                    {
                        var payload = new StandardPayload();
                        try
                        {
                            var msgText = string.Format("{0}{1}. {2} => {3}{0}", Environment.NewLine, ++count, bdea.Exchange, bdea.RoutingKey);
                            //var msgText = string.Format("{3}. {0}: {1} -> '{2}'", bdea.Exchange, bdea.RoutingKey, Encoding.UTF8.GetString(bdea.Body), ++count);

                            if (SMQActorBase.IsDebugMode)
                            {
                                Console.WriteLine(msgText);
                            }

                            var body = Encoding.UTF8.GetString(bdea.Body);
                            payload  = JsonConvert.DeserializeObject <StandardPayload>(body, this.DefaultJsonSerializerSettings);
                            if (ReferenceEquals(payload, null))
                            {
                                payload = new StandardPayload()
                                {
                                    ErrorMessage = "Payload missing."
                                }
                            }
                            ;

                            this.OnMessageReceived(payload, bdea);
                            this.CheckRouting(payload, bdea);
                        }
                        catch (Exception ex)
                        {
                            payload.ErrorMessage = ex.Message;
                            this.Reply(payload, bdea.BasicProperties);
                        }
                        this.OnAfterMessageReceived(payload, bdea);
                    }
                }

                try
                {
                    if (this.RMQChannel.IsOpen)
                    {
                        this.RMQChannel.Close();
                    }
                }
                catch { } // Ignore errors on closing the channel

                try
                {
                    if (this.RMQConnection.IsOpen)
                    {
                        this.RMQConnection.Close();
                    }
                }
                catch { } // Ignore errrors on closing connection
            });

            this.MonitorTask.Start();
        }
Ejemplo n.º 13
0
 /// <summary>
 /// AddPortfolio -
 /// </summary>
 public Task AddPortfolio(StandardPayload payload, PayloadHandler replyHandler = null, PayloadHandler timeoutHandler = null, int waitTimeout = StandardPayload.DEFAULT_TIMEOUT)
 {
     return(this.SendMessage("crudcoordinator.crud.user.addportfolio", payload, replyHandler, timeoutHandler, waitTimeout));
 }
Ejemplo n.º 14
0
 public PayloadEventArgs(StandardPayload payload, BasicDeliverEventArgs bdea)
 {
     this.Payload = payload;
     this.BasicDeliverEventArgs = bdea;
 }