Beispiel #1
0
        public async Task CreateAndSendEmailAsync(TenantRequest tenantRequest)
        {
            //var connectionString =
            //    "DefaultEndpointsProtocol=https;AccountName=demorrstorageaccount;AccountKey=NXluNSsP4tm+NViZ65rN6eM4V6Eniko9b7NON3M5xZGaDmGMV0LSIsM9CUVdFe+2n5L8vyl4DtdaVZz+JMJ3iA==;EndpointSuffix=core.windows.net";

            var model = new NotificationQueueModel()
            {
                TenantRequestModel = _modelMapper.CopyFrom(tenantRequest),
            };
            var det = base.GetWorkerDetails(tenantRequest);

            model.WorkerModel = det == null ? null : _modelMapper.CopyFrom(det);

            var message = _modelSerializer.Serialize(model);

            //var connectionString = "UseDevelopmentStorage=true";


            //// Instantiate a QueueClient which will be used to create and manipulate the queue
            //QueueClient queueClient = new QueueClient(connectionString, "service-requests-queue");// "ServiceRequestsQueue");
            //// Create the queue
            //await queueClient.CreateIfNotExistsAsync();
            //// Send a message to the queue

            //await queueClient.SendMessageAsync(message); //Base64Encode(message));
            await _queueClient.SendMessage(message);

            // Async receive the message
            //QueueMessage[] retrievedMessage = await queueClient.ReceiveMessagesAsync();

            //var tr = _modelMappers.CopyFrom(retrievedMessage[0].MessageText);
        }
Beispiel #2
0
        internal string Serialize(NotificationQueueModel req)
        {
            var str = JsonConvert.SerializeObject(req, JsonSettings());

            return(Base64Encode(str));
        }